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

Shirish Pargaonkar shirishpargaonkar at gmail.com
Fri Feb 6 03:18:48 GMT 2009


On Thu, Feb 5, 2009 at 4:11 PM, Jeff Layton <jlayton at redhat.com> wrote:
> On Wed, 4 Feb 2009 23:09:12 -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-04 17:48:18.000000000 -0600
>> @@ -85,6 +85,7 @@
>>
>>  const char *thisprogram;
>>  int verboseflag = 0;
>> +int fakemnt = 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':
>> +                     ++fakemnt;
>>                       break;
>>               default:
>>                       printf("unknown mount option %c\n",c);
>> @@ -1412,7 +1414,7 @@ mount_retry:
>>               }
>>       }
>>
>> -     if (mount(dev_name, mountpoint, "cifs", flags, options)) {
>> +     if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
>>               switch (errno) {
>>               case ECONNREFUSED:
>>               case EHOSTUNREACH:
>> @@ -1443,6 +1445,8 @@ mount_retry:
>>       }
>>
>>       atexit(unlock_mtab);
>> +     if (nomtab)
>> +             goto mount_exit;
>
>         ^^^
> If nomtab is set, it's probably better to not do the atexit call since
> we're not going to lock the mtab anyway.
>
>>       rc = lock_mtab();
>>       if (rc) {
>>               printf("cannot lock mtab");
>
> Other than that it looks fine. If you feel like cleaning up the bad
> indentation around the nomtab++ statement, I also wouldn't
> object.
>
> --
> Jeff Layton <jlayton at redhat.com>
>

Jeff,

Sure, makes sense to not bother with atexit call in case of -n.
Added tabs as well.

Regards,

Shirish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fakemount.3.patch
Type: application/octet-stream
Size: 1081 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20090205/c57d9dfd/fakemount.3.obj


More information about the linux-cifs-client mailing list