New option -mount_opts

This commit is contained in:
Thomas Schmitt 2009-10-10 14:22:50 +00:00
parent 13746bfc58
commit 0e3dafe5e4
7 changed files with 77 additions and 9 deletions

View File

@ -2,7 +2,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 "Oct 07, 2009"
.TH XORRISO 1 "Oct 10, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -2374,6 +2374,14 @@ path will be used as mount point and must already exist as a directory.
The command gets printed to the result channel. See option -mount
for direct execution of this command.
.TP
\fB\-mount_opts\fR option[:option...]
Set options which influence -mount and -mount_cmd. Currently there is only
option "exclusive" which is default and its counterpart "shared". The latter
causes xorriso not to give up the affected drive with command -mount. On Linux
it adds mount option "loop" which may allow to mount several sessions of
the same block device at the same time. One should not write to a mounted
optical media, of course. Take care to umount all sessions before ejecting.
.TP
\fB\-session_string\fR drive entity id format
Print to the result channel a text which gets composed according to
format and the parameters of the addressed session.

View File

@ -6832,7 +6832,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
xorriso->do_restore_sort_lba ? "sort_lba_on" : "sort_lba_off",
xorriso->drives_exclusive ? "o_excl_on" : "o_excl_off"
);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->mount_opts_flag == 0);
sprintf(line,"-mount_opts %s\n",
xorriso->mount_opts_flag & 1 ? "shared" : "exclusive");
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -12222,7 +12227,8 @@ too_long:;
if(sys_code == 1) { /* Linux */
sprintf(form,
"%smount -t iso9660 -o %snodev,noexec,nosuid,ro,sbsector=%%sbsector%% %%device%% %s",
(flag & 1 ? "/bin/" : ""), (reg_file ? "loop," : ""),
(flag & 1 ? "/bin/" : ""),
(reg_file || (xorriso->mount_opts_flag & 1) ? "loop," : ""),
Text_shellsafe(cpt, sfe, 0));
is_safe= 1;
} else if(sys_code == 2) { /* FreeBSD */
@ -15950,6 +15956,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -mount_cmd drive entity id path",
" Print to result channel a command suitable to mount the",
" depicted entity (see -load) at the given directory path.",
" -mount_opts \"exclusive\"|\"shared\"",
" Set options for -mount and -mount_cmd.",
" -session_string drive entity id \"linux:\"path|\"freebsd:\"path|form",
" Print foreign OS command or custom line.",
"",
@ -17098,6 +17106,41 @@ int Xorriso_option_mount(struct XorrisO *xorriso, char *dev, char *adr_mode,
}
/* Option -mount_opts option[:...] */
int Xorriso_option_mount_opts(struct XorrisO *xorriso, char *mode, int flag)
{
int was, l;
char *cpt, *npt;
was= xorriso->mount_opts_flag;
npt= cpt= mode;
for(cpt= mode; npt!=NULL; cpt= npt+1) {
npt= strchr(cpt,':');
if(npt==NULL)
l= strlen(cpt);
else
l= npt-cpt;
if(l==0)
goto unknown_mode;
if(strncmp(cpt, "shared", l)==0) {
xorriso->mount_opts_flag|= 1;
} else if(strncmp(cpt, "exclusive", l)==0) {
xorriso->mount_opts_flag&= ~1;
} else {
unknown_mode:;
if(l<SfileadrL)
sprintf(xorriso->info_text, "-mount_opts: unknown option '%s'", cpt);
else
sprintf(xorriso->info_text, "-mount_opts: oversized parameter (%d)",l);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
xorriso->mount_opts_flag= was;
return(0);
}
}
return(1);
}
/* Option -mv alias -mvi */
int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
@ -19209,7 +19252,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks",
"history","indev","in_charset","joliet",
"list_delimiter","list_profiles","local_charset",
"mark","md5","not_leaf","not_list","not_mgt",
"mark","md5","mount_opts","not_leaf","not_list","not_mgt",
"options_from_file","osirrox","outdev","out_charset","overwrite",
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
"prog","prog_help","publisher","quoted_not_list","quoted_path_list",
@ -19746,6 +19789,10 @@ next_command:;
argv[(*idx)-2], argv[(*idx)-1],
(strcmp(cmd, "mount_cmd") == 0));
} else if(strcmp(cmd, "mount_opts")==0) {
(*idx)++;
ret= Xorriso_option_mount_opts(xorriso, arg1, 0);
} else if(strcmp(cmd,"mv")==0 || strcmp(cmd,"mvi")==0) {
ret= Xorriso_option_mvi(xorriso, argc, argv, idx, 0);

View File

@ -759,12 +759,16 @@ int Xorriso_option_md5(struct XorrisO *xorriso, char *mode, int flag);
int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
/* Option -mount */
/* @param bit0= print mount command to result channel rather than performing it
*/
/* Options -mount , -mount_cmd , -session_string */
/* @param bit0= -mount_cmd: print mount command to result channel rather
than performing it
bit1= perform -session_string rather than -mount_cmd
*/
int Xorriso_option_mount(struct XorrisO *xorriso, char *dev, char *adr_mode,
char *adr, char *cmd, int flag);
/* Option -mount_opts option[:...] */
int Xorriso_option_mount_opts(struct XorrisO *xorriso, char *mode, int flag);
/* Option -mv alias -mvi */
int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,

View File

@ -551,6 +551,7 @@ cdrecord and mkisofs.</DT>
<LI>New option -pvd_info</LI>
<LI>Option -toc now reports "Media product:"</LI>
<LI>New options -system_id , -volset_id</LI>
<LI>New option -mount_opts</LI>
<!--
<LI>- none yet -</LI>
-->

View File

@ -290,6 +290,14 @@ struct XorrisO { /* the global context of xorriso */
tree traversal. Better read performance,
no directory mtime restore, needs do_auto_chmod
*/
int mount_opts_flag; /* bit0= "shared" = not "exclusive"
Try to emit non-exclusive mount command.
Do not give up drives.
Linux: use loop device even on block devices
in order to circumvent the ban to mount a
device twice (with different sbsector=)
FreeBSD: ?
*/
int dialog; /* 0=off , 1=single-line , 2=multi-line */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.10.08.155749"
#define Xorriso_timestamP "2009.10.10.142353"

View File

@ -10628,7 +10628,7 @@ int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode,
isoburn_drive_release(drive, 0);
burn_drive_info_free(dinfo);
drive= NULL;
} else if(give_up > 0 && !(flag & 1)) {
} else if(give_up > 0 && !((flag & 1) || (xorriso->mount_opts_flag & 1))) {
Xorriso_give_up_drive(xorriso, give_up);
if(ret <= 0)
goto ex;