Anticipating NetBSD mount option -s

This commit is contained in:
Thomas Schmitt 2014-05-28 12:57:48 +00:00
parent a52df24acd
commit d80ad57083
9 changed files with 130 additions and 79 deletions

View File

@ -1823,6 +1823,7 @@ int Xorriso_afile_fopen(struct XorrisO *xorriso,
@param flag bit0= make absolute command paths with known systems
bit1= do not allow prefixes with cmd
bit2= interpret unprefixed cmd as shell:
bit3= do not care for device filetype
*/
int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
int lba, int track, int session, char *volid,
@ -1831,18 +1832,21 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
int ret, reg_file= 0, is_safe= 0, sys_code= 0;
char *form= NULL, session_text[12], track_text[12], lba_text[12];
char *vars[5][2], *sfe= NULL, *volid_sfe= NULL, *cpt, *sysname;
char *cooked_dev= NULL, *eff_dev;
struct stat stbuf;
Xorriso_alloc_meM(form, char, 6 * SfileadrL);
Xorriso_alloc_meM(sfe, char, 5 * SfileadrL);
Xorriso_alloc_meM(volid_sfe, char, 5 * 80 + 1);
Xorriso_alloc_meM(cooked_dev, char, SfileadrL);
if(strlen(cmd) > SfileadrL) {
Xorriso_msgs_submit(xorriso, 0, "Argument much too long", 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
eff_dev= devadr;
ret= stat(devadr, &stbuf);
if(ret != -1)
if(ret != -1 && !(flag & 8))
if(S_ISREG(stbuf.st_mode))
reg_file= 1;
if(strncmp(cmd, "linux:", 6) == 0 && !(flag & 2)) {
@ -1851,6 +1855,9 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
} else if(strncmp(cmd, "freebsd:", 8) == 0 && !(flag & 2)) {
cpt= cmd + 8;
sys_code= 2;
} else if(strncmp(cmd, "netbsd:", 7) == 0 && !(flag & 2)) {
cpt= cmd + 7;
sys_code= 3;
} else if(strncmp(cmd, "string:", 7) == 0 && !(flag & 2)) {
cpt= cmd + 7;
strcpy(form, cpt);
@ -1869,6 +1876,8 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
strcmp(sysname, "GNU/kFreeBSD") == 0) {
/* "GNU/kFreeBSD" = Debian kfreebsd */
sys_code= 2;
} else if(strcmp(sysname, "NetBSD") == 0) {
sys_code= 3;
} else if(strcmp(sysname, "Linux") == 0) {
sys_code= 1;
} else {
@ -1886,7 +1895,7 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
(reg_file || (xorriso->mount_opts_flag & 1) ? "loop," : ""),
Text_shellsafe(cpt, sfe, 0));
is_safe= 1;
} else if(sys_code == 2) { /* FreeBSD */
} else if(sys_code == 2 || sys_code == 3) { /* FreeBSD , NetBSD */
if(reg_file) {
/* <<< Considered to create vnode as of
@ -1900,20 +1909,26 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
*/
Xorriso_msgs_submit(xorriso, 0,
"Detected regular file as mount device with FreeBSD style command.",
"Detected regular file as mount device with BSD style command.",
0, "FAILURE", 0);
Xorriso_msgs_submit(xorriso, 0,
if(sys_code == 2) {
Xorriso_msgs_submit(xorriso, 0,
"Command mdconfig -a -t vnode -f can create a device node which uses the file",
0, "HINT", 0);
} else {
Xorriso_msgs_submit(xorriso, 0,
"Command vnconfig -c vndX can create a device node which uses the file",
0, "HINT", 0);
}
{ret= 0; goto ex;}
} else {
if(sys_code == 3 && strncmp(devadr, "/dev/rcd", 8) == 0) {
sprintf(cooked_dev, "/dev/cd%s", devadr + 8);
eff_dev= cooked_dev;
}
sprintf(form,
"%smount_cd9660 -o noexec,nosuid -s %%sbsector%% %%device%% %s",
(flag & 1 ? "/sbin/" : ""), Text_shellsafe(cmd+8, sfe, 0));
/*
Not working on FreeBSD 7.2 according to Zsolt Kuti, 11 Oct 2009:
"%smount -t cd9660 -o noexec,nosuid -o -s %%sbsector%% %%device%% %s",
*/
(flag & 1 ? "/sbin/" : ""), Text_shellsafe(cpt, sfe, 0));
}
is_safe= 1;
}
@ -1929,15 +1944,16 @@ int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd,
vars[3][0]= "volid";
vars[3][1]= Text_shellsafe(volid, volid_sfe, 0);
vars[4][0]= "device";
vars[4][1]= Text_shellsafe(devadr, sfe, 0);
vars[4][1]= Text_shellsafe(eff_dev, sfe, 0);
ret= Sregex_resolve_var(form, vars, 5, "%", "%", "%", result, SfileadrL, 0);
if(ret <= 0)
goto ex;
ret= 1 + is_safe;
ex:;
Xorriso_free_meM(form);
Xorriso_free_meM(sfe);
Xorriso_free_meM(cooked_dev);
Xorriso_free_meM(volid_sfe);
Xorriso_free_meM(sfe);
Xorriso_free_meM(form);
return(ret);
}

View File

@ -1092,7 +1092,7 @@ int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode,
if(strstr(devadr, "mmc:") == devadr)
devadr+= 4;
ret= Xorriso_make_mount_cmd(xorriso, cmd, lba, track, session, volid, devadr,
mount_command, flag & (2 | 4));
mount_command, (flag & (2 | 4)) | ((flag & 4) << 1));
if(ret <= 0)
goto ex;
if(ret == 2)

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Version 1.3.7, Apr 29, 2014"
.TH XORRISO 1 "Version 1.3.7, May 18, 2014"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -3685,7 +3685,7 @@ if the desired drive is not aquired.
\fB\-mount_cmd\fR drive entity id path
Emit an appropriate command line for mounting the ISO session
indicated by drive, entity and id.
The result will be different on GNU/Linux and on FreeBSD.
The result will be different on GNU/Linux and on FreeBSD or NetBSD.
.br
drive can be "indev" or "outdev" to indicate already acquired drives,
or it can be the path of a not yet acquired drive.
@ -5465,7 +5465,7 @@ sums against the current file content on hard disk. This is usually much faster
than the default which compares both contents directly.
.br
With \fBmount\fR option \fB\-o "sbsector="\fR on GNU/Linux
resp. \fB\-s\fR on FreeBSD
resp. \fB\-s\fR on FreeBSD or NetBSD
it is possible to access the session trees which represent the older backup
versions. With CD media, GNU/Linux mount accepts session numbers directly by
its option "session=".

View File

@ -3213,7 +3213,7 @@ File: xorriso.info, Node: Inquiry, Next: Navigate, Prev: DialogCtl, Up: Comm
-mount_cmd drive entity id path
Emit an appropriate command line for mounting the ISO session
indicated by drive, entity and id. The result will be different
on GNU/Linux and on FreeBSD.
on GNU/Linux and on FreeBSD or NetBSD.
drive can be "indev" or "outdev" to indicate already acquired
drives, or it can be the path of a not yet acquired drive. Prefix
"stdio:" for non-MMC drives is not mandatory.
@ -4779,9 +4779,9 @@ match recorded MD5 sums against the current file content on hard disk.
This is usually much faster than the default which compares both
contents directly.
With *mount* option *-o "sbsector="* on GNU/Linux resp. *-s* on FreeBSD
it is possible to access the session trees which represent the older
backup versions. With CD media, GNU/Linux mount accepts session numbers
directly by its option "session=".
or NetBSD it is possible to access the session trees which represent
the older backup versions. With CD media, GNU/Linux mount accepts
session numbers directly by its option "session=".
Multi-session media and most overwriteable media written by `xorriso'
can tell the sbsectors of their sessions by `xorriso' command -toc.
Used after -commit the following command prints the matching mount
@ -5554,34 +5554,34 @@ Node: Charset151157
Node: Exception154472
Node: DialogCtl160592
Node: Inquiry163190
Node: Navigate170611
Node: Verify178909
Node: Restore188736
Node: Emulation197340
Node: Scripting207728
Node: Frontend215499
Node: Examples225106
Node: ExDevices226284
Node: ExCreate226950
Node: ExDialog228235
Node: ExGrowing229500
Node: ExModifying230305
Node: ExBootable230809
Node: ExCharset231361
Node: ExPseudo232253
Node: ExCdrecord233151
Node: ExMkisofs233468
Node: ExGrowisofs234808
Node: ExException235943
Node: ExTime236397
Node: ExIncBackup236856
Node: ExRestore240836
Node: ExRecovery241769
Node: Files242339
Node: Seealso243638
Node: Bugreport244361
Node: Legal244942
Node: CommandIdx245953
Node: ConceptIdx262834
Node: Navigate170621
Node: Verify178919
Node: Restore188746
Node: Emulation197350
Node: Scripting207738
Node: Frontend215509
Node: Examples225116
Node: ExDevices226294
Node: ExCreate226960
Node: ExDialog228245
Node: ExGrowing229510
Node: ExModifying230315
Node: ExBootable230819
Node: ExCharset231371
Node: ExPseudo232263
Node: ExCdrecord233161
Node: ExMkisofs233478
Node: ExGrowisofs234818
Node: ExException235953
Node: ExTime236407
Node: ExIncBackup236866
Node: ExRestore240856
Node: ExRecovery241789
Node: Files242359
Node: Seealso243658
Node: Bugreport244381
Node: Legal244962
Node: CommandIdx245973
Node: ConceptIdx262854

End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Version 1.3.7, Apr 29, 2014"
@c man .TH XORRISO 1 "Version 1.3.7, May 18, 2014"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -4288,7 +4288,7 @@ if the desired drive is not aquired.
@cindex Session, mount command line, -mount_cmd
Emit an appropriate command line for mounting the ISO session
indicated by drive, entity and id.
The result will be different on GNU/Linux and on FreeBSD.
The result will be different on GNU/Linux and on FreeBSD or NetBSD.
@*
drive can be "indev" or "outdev" to indicate already acquired drives,
or it can be the path of a not yet acquired drive.
@ -6419,7 +6419,7 @@ sums against the current file content on hard disk. This is usually much faster
than the default which compares both contents directly.
@*
With @strong{mount} option @strong{-o "sbsector="} on GNU/Linux
resp. @strong{-s} on FreeBSD
resp. @strong{-s} on FreeBSD or NetBSD
it is possible to access the session trees which represent the older backup
versions. With CD media, GNU/Linux mount accepts session numbers directly by
its option "session=".

View File

@ -1 +1 @@
#define Xorriso_timestamP "2014.05.18.144453"
#define Xorriso_timestamP "2014.05.28.125704"

View File

@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISOFS 1 "Version 1.3.7, Apr 09, 2014"
.TH XORRISOFS 1 "Version 1.3.7, May 18, 2014"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -1614,7 +1614,7 @@ sums against the current file content on hard disk.
.br
.sp 1
With \fBmount\fR option \fB\-o "sbsector="\fR on GNU/Linux
resp. \fB\-s\fR on FreeBSD
resp. \fB\-s\fR on FreeBSD or NetBSD
it is possible to access the session trees which represent the older backup
versions. With CD media, GNU/Linux mount accepts session numbers directly by
its option "session=".

View File

@ -998,8 +998,8 @@ Macs for booting and for mounting.
MBR, GPT and APM are combinable. APM occupies the first 8 bytes of MBR
boot code. All three do not hamper El Torito booting from CDROM.
`xorrisofs' supports further boot facilities: MIPS Big Endian (SGI),
MIPS Little Endian (DEC), SUN SPARC. Those are mutually not combinable
and also not combinable with MBR, GPT, or APM.
MIPS Little Endian (DEC), SUN SPARC, HP-PA. Those are mutually not
combinable and also not combinable with MBR, GPT, or APM.
-G disk_path
Copy at most 32768 bytes from the given disk file to the very
@ -1185,6 +1185,29 @@ and also not combinable with MBR, GPT, or APM.
number to byte 0x228. The size is written as 32 bit big-endian
number to byte 0x230.
-hppa-cmdline text
Set the PALO command line for HP-PA. Up to 1023 characters are
permitted by default. With -hppa-hdrversion 4 the limit is 127.
Note that the first five -hppa options are mandatory, if any of
the -hppa options is given. Only option -hppa-hdrversion is
allowed to be missing.
-hppa-bootloader iso_rr_path
Designate the given path as HP-PA bootloader file.
-hppa-kernel-32 iso_rr_path
Designate the given path as HP-PA 32 bit kernel file.
-hppa-kernel-64 iso_rr_path
Designate the given path as HP-PA 64 bit kernel file.
-hppa-ramdisk iso_rr_path
Designate the given path as HP-PA RAM disk file.
-hppa-hdrversion number
Choose between PALO header version 5 (default) and version 4. For
the appropriate value see in PALO source code: PALOHDRVERSION.

File: xorrisofs.info, Node: Charset, Next: Jigdo, Prev: SystemArea, Up: Options
@ -1543,9 +1566,9 @@ If inode numbers on disk are not persistent, then use option
MD5 sums against the current file content on hard disk.
With *mount* option *-o "sbsector="* on GNU/Linux resp. *-s* on FreeBSD
it is possible to access the session trees which represent the older
backup versions. With CD media, GNU/Linux mount accepts session numbers
directly by its option "session=".
or NetBSD it is possible to access the session trees which represent
the older backup versions. With CD media, GNU/Linux mount accepts
session numbers directly by its option "session=".
Multi-session media and most overwriteable media written by xorriso can
tell the sbsectors of their sessions by xorriso option -toc:
@ -1899,6 +1922,12 @@ File: xorrisofs.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: T
(line 16)
* -hide-rr-moved set deep directory relocation target: SetExtras.
(line 64)
* -hppa-bootloader HP-PA bootloader file: SystemArea. (line 216)
* -hppa-cmdline HP-PA PALO command line: SystemArea. (line 209)
* -hppa-hdrversion HP-PA PALO header version: SystemArea. (line 228)
* -hppa-kernel_32 HP-PA kernel_32 file: SystemArea. (line 219)
* -hppa-kernel_64 HP-PA kernel_64 file: SystemArea. (line 222)
* -hppa-ramdisk HP-PA ramdisk file: SystemArea. (line 225)
* -input-charset set character set of disk file names: Charset.
(line 17)
* -iso-level define ISO 9660 limitations: SetCompl. (line 7)
@ -2028,6 +2057,12 @@ File: xorrisofs.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Bootability, control, -b, -eltorito-boot: Bootable. (line 32)
* Bootability, control, -B, -sparc-boot: SystemArea. (line 184)
* Bootability, control, -e: Bootable. (line 50)
* Bootability, control, -hppa-bootloader: SystemArea. (line 216)
* Bootability, control, -hppa-cmdline: SystemArea. (line 209)
* Bootability, control, -hppa-hdrversion: SystemArea. (line 228)
* Bootability, control, -hppa-kernel_32: SystemArea. (line 219)
* Bootability, control, -hppa-kernel_64: SystemArea. (line 222)
* Bootability, control, -hppa-ramdisk: SystemArea. (line 225)
* Bootability, control, -mips-boot: SystemArea. (line 171)
* Bootability, control, -mipsel-boot: SystemArea. (line 178)
* Bootability, El Torito section id string, -eltorito-id: Bootable.
@ -2210,22 +2245,22 @@ Node: SetHide30591
Node: ImageId31899
Node: Bootable36067
Node: SystemArea41061
Node: Charset51358
Node: Jigdo52384
Node: Miscellaneous56651
Node: Examples58295
Node: ExSimple58781
Node: ExGraft59260
Node: ExMkisofs60507
Node: ExGrowisofs61760
Node: ExIncBackup62932
Node: ExIncBckAcc66040
Node: ExBootable67716
Node: Files69808
Node: Seealso70882
Node: Bugreport71538
Node: Legal72119
Node: CommandIdx73014
Node: ConceptIdx87716
Node: Charset52192
Node: Jigdo53218
Node: Miscellaneous57485
Node: Examples59129
Node: ExSimple59615
Node: ExGraft60094
Node: ExMkisofs61341
Node: ExGrowisofs62594
Node: ExIncBackup63766
Node: ExIncBckAcc66884
Node: ExBootable68560
Node: Files70652
Node: Seealso71726
Node: Bugreport72382
Node: Legal72963
Node: CommandIdx73858
Node: ConceptIdx88998

End Tag Table

View File

@ -50,7 +50,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISOFS 1 "Version 1.3.7, Apr 09, 2014"
@c man .TH XORRISOFS 1 "Version 1.3.7, May 18, 2014"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -2159,7 +2159,7 @@ sums against the current file content on hard disk.
@sp 1
@c man .sp 1
With @strong{mount} option @strong{-o "sbsector="} on GNU/Linux
resp. @strong{-s} on FreeBSD
resp. @strong{-s} on FreeBSD or NetBSD
it is possible to access the session trees which represent the older backup
versions. With CD media, GNU/Linux mount accepts session numbers directly by
its option "session=".