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

Jeff Layton jlayton at redhat.com
Fri Feb 6 10:08:34 GMT 2009


On Thu, 5 Feb 2009 21:18:48 -0600
Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:

> 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

Doesn't seem to apply to current master branch:

$ patch -p1 < /tmp/fakemount.3.patch 
patching file mount.cifs.c
Hunk #3 FAILED at 1211.
Hunk #4 succeeded at 1412 (offset -2 lines).

Can you respin, retest and send again with a proper commit message?

Also, it's customary to cut patches so that when you're sitting in the
top directory of the repository that it will apply with -p1. Using git
makes this easy...

Thanks,
-- 
Jeff Layton <jlayton at redhat.com>


More information about the linux-cifs-client mailing list