New option --device_links

This commit is contained in:
Thomas Schmitt 2011-07-28 19:16:06 +00:00
parent 57185dc9e7
commit 11420e4a32
3 changed files with 59 additions and 14 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH CDRSKIN 1 "Jan 09, 2011" .TH CDRSKIN 1 "Jul 28, 2011"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -256,7 +256,7 @@ that it has to be formatted again. If in doubt, just give it a try.
.br .br
The drives, CD, DVD, or BD burners, are accessed via addresses which The drives, CD, DVD, or BD burners, are accessed via addresses which
are specific to libburn and the operating system. Those addresses get listed are specific to libburn and the operating system. Those addresses get listed
by a run of \fBcdrskin --devices\fP. by a run of \fBcdrskin --devices\fP or \fBcdrskin --device_links\fP.
.br .br
On Linux, they are device files which traditionally do not offer On Linux, they are device files which traditionally do not offer
w-permissions for normal users. Because libburn needs rw-permission, w-permissions for normal users. Because libburn needs rw-permission,
@ -512,7 +512,7 @@ cdrskin will not write CD-ROM XA but rather strip the header bytes and write as
.TP .TP
.BI dev= target .BI dev= target
Set the address of the drive to use. Valid are at least the Set the address of the drive to use. Valid are at least the
addresses listed with option --devices, addresses listed with options --devices or --device_links,
X,Y,Z addresses listed with option -scanbus, X,Y,Z addresses listed with option -scanbus,
ATA:X,Y,Z addresses listed with options dev=ATA -scanbus, ATA:X,Y,Z addresses listed with options dev=ATA -scanbus,
and volatile libburn drive numbers (numbering starts at "0"). and volatile libburn drive numbers (numbering starts at "0").
@ -881,6 +881,17 @@ Number dev='Devicefile' rw-Permissions : 'Vendor' 'Model'
Number and Devicefile can both be used with option dev=, but number is Number and Devicefile can both be used with option dev=, but number is
volatile (numbering changes if drives become busy). volatile (numbering changes if drives become busy).
.TP .TP
.BI \--device_links
Like --devices, but presenting the drives with addresses of symbolic links
which point to the actual device files.
.br
Modern GNU/Linux systems may shuffle drive addresses from boot to boot.
The udev daemon is supposed to create links which always point to the
same drive, regardless of its system address.
Option --device_links shows the addresses of such links if they begin
by "/dev/dvd" or "/dev/cd".
Precedence is: "dvdrw", "cdrw", "dvd", "cdrom", "cd".
.TP
.BI direct_write_amount= size .BI direct_write_amount= size
Do not write a session with tracks but rather make an appropriate number of Do not write a session with tracks but rather make an appropriate number of
direct write operations with no preparations. Flushing the drive buffer will direct write operations with no preparations. Flushing the drive buffer will
@ -1136,7 +1147,7 @@ Wether this leads to senseful behavior depends on operating system and kernel.
.TP .TP
.BI drive_scsi_dev_family= sr | scd | sg .BI drive_scsi_dev_family= sr | scd | sg
Linux specific: Select a SCSI device file family to be scanned for by Linux specific: Select a SCSI device file family to be scanned for by
options --devices and -scanbus. options --devices, --device_links and -scanbus.
Normally this is /dev/sgN on kernel versions < 2.6 and /dev/srN Normally this is /dev/sgN on kernel versions < 2.6 and /dev/srN
on kernels >= 2.6 . This option allows to explicitly override that default on kernels >= 2.6 . This option allows to explicitly override that default
in order to meet other programs at a common device file for each drive. in order to meet other programs at a common device file for each drive.
@ -1242,7 +1253,7 @@ cdrskin -scanbus
.br .br
cdrskin dev=ATA -scanbus cdrskin dev=ATA -scanbus
.br .br
cdrskin --devices cdrskin --device_links
.SS .SS
.B Get info about a particular drive or loaded media: .B Get info about a particular drive or loaded media:
.br .br

View File

@ -2684,7 +2684,8 @@ return:
o->scan_demands_drive= 1; o->scan_demands_drive= 1;
o->demands_cdrskin_caps= 1; o->demands_cdrskin_caps= 1;
} else if(strcmp(argv[i],"--devices")==0) { } else if(strcmp(argv[i],"--devices") == 0 ||
strcmp(argv[i],"--device_links") == 0) {
#ifndef Cdrskin_extra_leaN #ifndef Cdrskin_extra_leaN
printf("Note: If this hangs for a while then there is a drive with\n"); printf("Note: If this hangs for a while then there is a drive with\n");
printf(" unexpected problems (e.g. ill DMA).\n"); printf(" unexpected problems (e.g. ill DMA).\n");
@ -2879,6 +2880,7 @@ set_dev:;
" direct_write_amount=<size> write random access to media like DVD+RW\n"); " direct_write_amount=<size> write random access to media like DVD+RW\n");
printf(" --demand_a_drive exit !=0 on bus scans with empty result\n"); printf(" --demand_a_drive exit !=0 on bus scans with empty result\n");
printf(" --devices list accessible devices (tells /dev/...)\n"); printf(" --devices list accessible devices (tells /dev/...)\n");
printf(" --device_links list accessible devices by (udev) links\n");
printf( printf(
" dev_translation=<sep><from><sep><to> set input address alias\n"); " dev_translation=<sep><from><sep><to> set input address alias\n");
printf(" e.g.: dev_translation=+ATA:1,0,0+/dev/sg1\n"); printf(" e.g.: dev_translation=+ATA:1,0,0+/dev/sg1\n");
@ -3400,7 +3402,7 @@ struct CdrskiN {
int single_track; int single_track;
int prodvd_cli_compatible; int prodvd_cli_compatible;
int do_devices; int do_devices; /* 1= --devices , 2= --device_links */
int do_scanbus; int do_scanbus;
@ -4727,14 +4729,16 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s,
/** Perform operations -scanbus or --devices /** Perform operations -scanbus or --devices
@param flag Bitfield for control purposes: @param flag Bitfield for control purposes:
bit0= perform --devices rather than -scanbus bit0= perform --devices rather than -scanbus
bit1= with bit0: perform --device_links
@return <=0 error, 1 success @return <=0 error, 1 success
*/ */
int Cdrskin_scanbus(struct CdrskiN *skin, int flag) int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
{ {
int ret,i,busno,first_on_bus,pseudo_transport_group= 0,skipped_devices= 0; int ret,i,busno,first_on_bus,pseudo_transport_group= 0,skipped_devices= 0;
int busmax= 16, busidx; int busmax= 16, busidx, max_dev_len, pad, j;
char shellsafe[5*Cdrskin_strleN+2],perms[40],btldev[Cdrskin_adrleN]; char shellsafe[5*Cdrskin_strleN+2],perms[40],btldev[Cdrskin_adrleN];
char adr[Cdrskin_adrleN],*raw_dev,*drives_shown= NULL; char adr[Cdrskin_adrleN],*raw_dev,*drives_shown= NULL;
char link_adr[BURN_DRIVE_ADR_LEN];
int *drives_busses= NULL; int *drives_busses= NULL;
struct stat stbuf; struct stat stbuf;
@ -4742,9 +4746,26 @@ int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
drives_busses= calloc((skin->n_drives+1), sizeof(int)); drives_busses= calloc((skin->n_drives+1), sizeof(int));
if(drives_shown == NULL || drives_busses == NULL) if(drives_shown == NULL || drives_busses == NULL)
{ret= -1; goto ex;} {ret= -1; goto ex;}
for(i= 0; i < (int) skin->n_drives; i++)
drives_shown[i]= 0;
if(flag&1) { if(flag&1) {
max_dev_len= 0;
for(i= 0; i < (int) skin->n_drives; i++) {
drives_shown[i]= 0;
ret= burn_drive_get_adr(&(skin->drives[i]), adr);
if(ret<=0)
continue;
if(flag & 2) {
ret= burn_lookup_device_link(adr, link_adr, "/dev", NULL, 0, 0);
if(ret == 1)
strcpy(adr, link_adr);
}
if(strlen(adr)>=Cdrskin_strleN)
Text_shellsafe("failure:oversized string", shellsafe, 0);
else
Text_shellsafe(adr, shellsafe,0);
if((int) strlen(shellsafe) > max_dev_len)
max_dev_len= strlen(shellsafe);
}
printf("cdrskin: Overview of accessible drives (%d found) :\n", printf("cdrskin: Overview of accessible drives (%d found) :\n",
skin->n_drives); skin->n_drives);
printf("-----------------------------------------------------------------------------\n"); printf("-----------------------------------------------------------------------------\n");
@ -4771,12 +4792,22 @@ int Cdrskin_scanbus(struct CdrskiN *skin, int flag)
if(stbuf.st_mode&S_IROTH) perms[4]= 'r'; if(stbuf.st_mode&S_IROTH) perms[4]= 'r';
if(stbuf.st_mode&S_IWOTH) perms[5]= 'w'; if(stbuf.st_mode&S_IWOTH) perms[5]= 'w';
} }
if(flag & 2) {
ret= burn_lookup_device_link(adr, link_adr, "/dev", NULL, 0, 0);
if(ret == 1)
strcpy(adr, link_adr);
}
if(strlen(adr)>=Cdrskin_strleN) if(strlen(adr)>=Cdrskin_strleN)
Text_shellsafe("failure:oversized string",shellsafe,0); Text_shellsafe("failure:oversized string",shellsafe,0);
else else
Text_shellsafe(adr,shellsafe,0); Text_shellsafe(adr,shellsafe,0);
printf("%d dev=%s %s : '%-8.8s' '%s'\n", printf("%d dev=%s", i, shellsafe);
i,shellsafe,perms,skin->drives[i].vendor,skin->drives[i].product); pad= max_dev_len - strlen(shellsafe);
if(pad > 0)
for(j= 0; j < pad; j++)
printf(" ");
printf(" %s : '%-8.8s' '%s'\n",
perms, skin->drives[i].vendor, skin->drives[i].product);
} }
printf("-----------------------------------------------------------------------------\n"); printf("-----------------------------------------------------------------------------\n");
} else { } else {
@ -8123,6 +8154,9 @@ option_data:;
} else if(strcmp(argv[i],"--devices")==0) { } else if(strcmp(argv[i],"--devices")==0) {
skin->do_devices= 1; skin->do_devices= 1;
} else if(strcmp(argv[i],"--device_links")==0) {
skin->do_devices= 2;
#ifndef Cdrskin_extra_leaN #ifndef Cdrskin_extra_leaN
} else if(strncmp(argv[i],"dev_translation=",16)==0) { } else if(strncmp(argv[i],"dev_translation=",16)==0) {
@ -9054,7 +9088,7 @@ int Cdrskin_run(struct CdrskiN *skin, int *exit_value, int flag)
{*exit_value= 4; goto no_drive;} {*exit_value= 4; goto no_drive;}
if(Cdrskin__is_aborting(0)) if(Cdrskin__is_aborting(0))
goto ex; goto ex;
ret= Cdrskin_scanbus(skin,1); ret= Cdrskin_scanbus(skin, 1 | (2 * (skin->do_devices == 2)));
if(ret<=0) { if(ret<=0) {
fprintf(stderr,"cdrskin: FATAL : --devices failed.\n"); fprintf(stderr,"cdrskin: FATAL : --devices failed.\n");
{*exit_value= 4; goto ex;} {*exit_value= 4; goto ex;}

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.07.28.191202" #define Cdrskin_timestamP "2011.07.28.191536"