This changes following: - it always adds ``--'' as delimiter for supermount-specific options to avoid "unknown option" error (e.g. vfat is installed by default with "unhide" option that is of course unknown by supermount) - it slightly changes kernel option parsing to allow for trailing ``--''. It happens, when all standard options are removed by mount command, e.g. in case like fs=iso9660,dev=/dev/cdrom,--,ro,noexec both ``ro'' and ``noexec'' will be removed by mount. I was tempted to remove empty option as delimiter as well because it is slurped by mount. - it adds --mountpoint option as suggested by TODO - it changes logic to not supermount everything with ``user'' option in it to avoid supermounting Windows hard disk vfat partitions. So, logic is "if acceptable filesystems && user option" - I believe, we should allow supermount only for filesystems with ``user'' flag. - it removes ``noauto'' option when converting to supermount. Attached because of line length. -andrej
--- /usr/src/linux/fs/supermount/super.c.org Wed Feb 21 14:38:05 2001 +++ /usr/src/linux/fs/supermount/super.c Sun Feb 25 17:42:15 2001 @@ -147,16 +147,6 @@ if (!options) return 0; while ((this_char = options)) { - if (!strncmp(this_char, "--,", 3)) - this_char += 2; - if (*this_char == ',') { - /* An empty option, or the option "--", - introduces options to be passed through to - the subfs */ - supermount_debug ("assigning remainder\n"); - return copy_option(&sb->u.supermount_sb.s_data, - ++this_char); - } if ((options = strchr (this_char, ','))) *options++ = 0; @@ -177,6 +167,13 @@ #endif } else if (!strcmp (this_char, "fail_statfs_until_mount")) { supermount_fail_statfs = 1; + } else if (!*this_char || !strcmp(this_char, "--")) { + /* An empty option, or the option "--", + introduces options to be passed through to + the subfs */ + supermount_debug ("assigning remainder\n"); + return copy_option(&sb->u.supermount_sb.s_data, + ++this_char); } else { printk ("supermount: " "Unrecognized mount option %s\n", this_char); --- /usr/sbin/supermount.org Thu Feb 22 14:30:50 2001 +++ /usr/sbin/supermount Sun Feb 25 18:47:50 2001 @@ -6,12 +6,12 @@ # $Id: supermount,v 1.1.1.1 2000/07/30 05:07:38 chmouel Exp $ my $file = '/etc/fstab'; -my $ofile; +my ($ofile, $mpoint); #"bad" or "nessesary" options for "normal" and "supermount" entry # "bad" options can be regexp. -my @normal_bad = qw ( fs=\S+ dev=\S+); -my @super_bad = qw (sync user); +my @normal_bad = qw ( fs=\S+ dev=\S+ --); +my @super_bad = qw (sync user noauto); my @normal_must = qw (user noauto nodev nosuid); my @super_must = qw (nodev nosuid); my $fs_ok = '(auto|vfat|iso9660)'; @@ -22,6 +22,8 @@ $_ = shift; if (/^--file=([^ \t]+)/ || /^-f=([^ \t]+)/) { $file = $1; + } elsif (/^--mountpoint=([^ \t]+)/ || /^-m=([^ \t]+)/) { + $mpoint = $1; } elsif (/^--infile/ || /^-i/) { $infile++; } elsif (/^--help/ || /^-h/ || /^-\?/) { @@ -45,7 +47,7 @@ while (<FH>) { my ($dev, $point, $fs, $opt, $d1, $d2) = split; my @opt = split (',', $opt); - if ( $disable && ($fs eq "supermount") ) { + if ( $disable && ($fs eq "supermount") && (!defined($mpoint) || $point eq $mpoint) +) { my @must; map { m/^fs=(\S+)/ && ($fs = $1); m/dev=(\S+)/ && ($dev= $1); } @opt; @@ -60,18 +62,17 @@ $opt = join (',' , @opt); print "$dev\t$point\t$fs $opt\t$d1 $d2\n"; next; - } elsif ( $enable && ( - $fs eq "iso9660" || - ( ( $fs =~ m/$fs_ok/ ) && - ( ($dev =~ /^\/dev\/($dev_ok)$/) - || ($opt =~ m/(^|.*,)user.*/ ) - ) - ) - ) + } elsif ( $enable && (!defined($mpoint) || $point eq $mpoint) && + ( $fs eq "iso9660" || + ( $fs =~ m/$fs_ok/ && + $dev =~ /^\/dev\/($dev_ok)$/ + ) + ) && + ($opt =~ m/(^|.*,)user.*/) ) { &clean_options(\@opt,\@super_must, \@super_bad); $opt = join (',' , @opt); - print "$point\t$point\tsupermount\tfs=$fs,dev=$dev,$opt 0 0\n"; + print "$point\t$point\tsupermount\tfs=$fs,dev=$dev,--,$opt 0 0\n"; next; } print; @@ -96,14 +97,22 @@ Usage: $0 [OPTION]... <disable | enable> Enable or disable supermount in fstab. - -f=FILE, --file=FILE: Specify an alternarte fstab file (default: /etc/fstab). - -i, --infile: Modify directly in the file. + -m=DIR, --mountpoint=DIR: Specifiy single mount point to enable/disable (default: +all) + -f=FILE, --file=FILE: Specify an alternarte fstab file (default: +/etc/fstab). + -i, --infile: Modify directly in the file. EOF exit($e); } __END__ CHANGELOG: +Thu Feb 25 2001 Andrej Borsenkow <[EMAIL PROTECTED]> +- added ``--'' as delimiter for supermount fs options to avoid mount errors on +fs-specific options +- added --mountpoint option to operate on single mount point +- changed condition to enable supermount to (($fs eq iso9660) || (($fs =~ m/$fs_ok) +&& + ($dev =~ /^\/dev\/($dev_ok)$/))) && ($opt =~ m/(^|.*,)user.*/ ) +Before it tried to supermount Windows vfat partitions that were defined with user +option. + Thu Apr 13 2000 Denis Havlik <[EMAIL PROTECTED]> - moved definitions of "good" and "bad" fs-options, "allowed fs-s" and "good devices" to top of the script for easier maintainance. - added &clean_options(\@opt,\@must, \@bad) function, which parses the @opt @@ -113,6 +122,3 @@ - changed the rules used to decide which mount points are going to be supermounted to: ($fs eq "iso9660") || (( $fs =~ m/$fs_ok/ ) && (($dev =~ /^\/dev\/($dev_ok)$/) || ($opt =~ m/(^|.*,)user.*/ )) ) - TODO: -add --mountpoint option to get targeted supermount-enabling/disabling on - the single moint point.