[patch][linux-cifs-client] add fake mount option (-f) to mount.cifs

Shirish Pargaonkar shirishpargaonkar at gmail.com
Wed Feb 4 02:23:41 GMT 2009


On Tue, Feb 3, 2009 at 7:25 PM, Jeff Layton <jlayton at redhat.com> wrote:
> On Mon, 2 Feb 2009 13:33:37 -0600
> Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:
>
>> --- client.orig/mount.cifs.c  2009-02-02 06:59:20.000000000 -0600
>> +++ client/mount.cifs.c       2009-02-02 07:06:51.000000000 -0600
>> @@ -85,6 +85,7 @@
>>
>>  const char *thisprogram;
>>  int verboseflag = 0;
>> +int fakemntflag = 0;
>>  static int got_password = 0;
>>  static int got_user = 0;
>>  static int got_domain = 0;
>> @@ -1210,6 +1211,7 @@ int main(int argc, char ** argv)
>>               case 't':
>>                       break;
>>               case 'f':
>> +                     ++fakemntflag;
>>                       break;
>>               default:
>>                       printf("unknown mount option %c\n",c);
>> @@ -1262,6 +1264,11 @@ int main(int argc, char ** argv)
>>               goto mount_exit;
>>       }
>>
>> +     if (fakemntflag) {
>> +             rc = 0;
>> +             goto mount_exit;
>> +     }
>> +
>>       if(stat (".", &statbuf)) {
>>               printf("mount error: mount point %s does not exist\n",mountpoint);
>>               rc = EX_USAGE;
>
> This doesn't look right. You have the fakemntflag check happening very
> early and making it shortcut a large chunk of the mount process. To
> quote mount(8):
>
>       -f     Causes  everything to be done except for the actual system call;
>              if it's not obvious, this ''fakes'' mounting  the  file  system.
>              This  option is useful in conjunction with the -v flag to deter-
>              mine what the mount command is trying to do. It can also be used
>              to add entries for devices that were mounted earlier with the -n
>              option. The -f option checks for existing  record  in  /etc/mtab
>              and  fails when the record already exists (with regular non-fake
>              mount, this check is done by kernel).
>
>
> ...ok, so the last part of this sounds bogus (I doubt the kernel
> checks /etc/mtab), but the main point is that we don't want to skip
> adding the mtab entry since that's pretty fundamental.
>
> I suggest just making fakemntflag skip the mount() syscall and just
> assume that it succeeded when it's set.
>
> --
> Jeff Layton <jlayton at redhat.com>
>

Jeff,

I was going by with this comment

-f
Fake mount. Go through the motions of checking the device and
directory, but do not actually mount the filesystem

Let me work on the other functionality.

Regards,

Shirish


More information about the linux-cifs-client mailing list