Re: CD writing in future Linux (stirring up a hornets' nest)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 6 Feb 2006, Joerg Schilling wrote:
> Matthias Andree <[email protected]> wrote:
> > Joerg Schilling schrieb am 2006-02-03:

> > > This is a limitation of the implementation used on Linux and not true for e.g. 
> > > Solaris.
> >
> > Linux is not Solaris.
> >
> > Do you want your application to work with Linux,
> > because it brings customers?
> >
> > If yes, listen to kernel developers if they say "you don't need that
> > feature". Note I do not consider myself kernel developer. I'm a
> > bystander who's trying to help out.
> 
> ????
> 
> Kernel developers should listen to the right application developers
> (in special when they may have more kernel skills) to find out
> what's needed.

>From what I read, you need a way to map a short ID (possibly formed like 
\mathbb{N}^4) to a (devicename, ID')-tupel, where ID' may be ID, a dummy 
value or something completely different.


With the old /dev/sg-scheme, you had a hard time assigning 
/dev/sg_num_of_the_day to a device, and you had to enqure each for the ID 
in order to at least give a stable name. Obviously this was bad, therefore 
it was superseded by the current method, making /dev/sg obsolete. It is 
still supported, but nobody will enheance it to include IDE.


With the current mechanism, you can assign a user-defined name like
/dev/scsi/host1/bus2/id3/lun4/cd, /dev/scsi/1.2.3.4, /dev/bjørn or
/dev/cdr/vendor_model. Obviously some are hard to type, and some are 
designed to be typed by the user. In the later case, the user should be 
allowed to use these names even if it isn't portable, and in the 
former cases, having a nice thing.

For systems using /dev/scsi/1.2.3.4 etc., you can enumerate all devices by
walking a list of paths and trying each device in turn, and you can find
the device node using a regular expression.

On systems using /dev/cdr/vendor_model or /dev/bjørn, you can't list all 
devices yourself, but maybe you can exec a user-defined program doing this 
work for you. In order to find the device again, you can either make the  
list be (device node, ID), or define a reverse switch giving you just the 
device node. I'd prefer the later, since that'd let you handle device 
names containing spaces.

I'd use a script for both cases, and since many systems will use the 
numeric scheme, maybe provide a default script for them. If the user or 
the distribution doesn't use numeric IDs, they can create their own 
script. (Off cause you'll still need the sg-scanning for 2.4 kernels).


Example for my system, obviously slightly untested:

---/etc/default/cdrecord:---
#aliases
toshiba TOSHIBA_XM-6201TA -1 -1
liteon  LITE-ON_LTR-48246K 40 16m
apple   MATSHITA_CR-8004 -1 -1

CDR_DEVICE      = LITE-ON_LTR-48246K
enumerate_devices_bin = /usr/lib/cdrecord-scandevices.sh
---

---/usr/lib/cdrecord-scandevices.sh---
#!/bin/sh
if [ "$1" == "-r" ]; then # reverse mapping
	exec /usr/bin/find /dev/cd{,r} -follow -name "$2"
else
	exec /usr/bin/find /dev/cd{,r} -follow -type b -printf "%f\n"
fi
---

---default script---
#!/bin/sh

if [ "$1" == "-r" ]; then # reverse mapping
	case "$2" in
	-1.* )  a="`echo "$2"|sed -e \
's,\(.*\)\.\(.*\)\.\(.*\)\.\(.*\),.*[^0-9]\2[^0-9]+\3[^0-9]*,'`"
		/usr/bin/find /dev/ide/ -regex "$a" -type b
	;;
	*)      a="`echo "$2"|sed -e \
's,\(.*\)\.\(.*\)\.\(.*\)\.\(.*\),.*[^0-9]\1[^0-9]+\2[^0-9]+\3[^0-9]+\4[^0-9]*,'`"
		/usr/bin/find /dev/scsi/ -regex "$a" -type b
	;;
	esac
else
	/usr/bin/find /dev/ide/ -type b \! -regex '.*part[0-9]+' \
	| sed -e \
's/[^0-9]/./g;s/\.\.*/\./g;s/^\.*//;s/\.*$//;s/^/-1./;s/$/.0/'

	/usr/bin/find /dev/scsi/ \! -regex '.*part[0-9]+' -type b \
	| sed -e 's/[^0-9]/./g;s/\.\.*/\./g;s/^\.*//;s/\.*$//'
fi
---

-- 
One enemy soldier is never enough, but two is entirely too many. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux