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

Jeff Layton jlayton at redhat.com
Thu Feb 5 22:11:15 GMT 2009


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>


More information about the linux-cifs-client mailing list