Skip to contentSkip to conversation

make autofs understand the -[no]browse option

PATCH In review Jeff Moyer 2 participants 3 messages Nov 15, 2004 – Nov 24, 2004 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 make autofs understand the -[no]browse option

Hi, Ian, list,

The patch below makes the Linux automounter a bit more compatibile with the Sun automounter, by parsing the -[no]browse options, and converting them into the equivalent --ghost option.

Ian, I've not made this patch against vanilla 4.1.3. This is the patch that went into the Red Hat RPM. I will generate a diff to whatever version you like, but I didn't want to do extra work since your tree may be quite different from 4.1.3 at this point.

Please let me know if you want me to rediff this.

Thanks!

Jeff

modules/mount_autofs.c renamed from modules/mount_autofs.c.b4phro +9 -3
@@ -40,7 +40,7 @@ int mount_mount(const char *root, const 
 		void *context)
 {
 	char *fullpath, **argv;
-	int argc, status;
+	int argc, status, ghost = ap.ghost;
 	char *options, *p;
 	pid_t slave, wp;
 	char timeout_opt[30];
@@ -78,10 +78,16 @@ int mount_mount(const char *root, const 
 		return 0;
 	}
 
+	if (strstr(options, "browse")) {
+		if (strstr(options, "nobrowse"))
+			ghost = 0;
+		else
+			ghost = 1;
+	}
 	/* Build our argument vector.  */
 
 	argc = 5;
-	if (ap.ghost)
+	if (ghost)
 		argc++;
 
 	if (do_verbose || do_debug)
@@ -106,8 +112,8 @@ int mount_mount(const char *root, const 
 	argv[argc++] = PATH_AUTOMOUNT;
 	argv[argc++] = "--submount";
 
-	if (ap.ghost)
+	if (ghost)
 		argv[argc++] = "--ghost";
 
 	if (ap.exp_timeout != DEFAULT_TIMEOUT)
 
samples/rc.autofs.in renamed from samples/rc.autofs.in.b4phro +8 -2
@@ -182,7 +182,12 @@ function getmounts()
 		then
 		    startupoptions="$startupoptions --ghost"
 		fi
-
+		# Dont even deal with conflicts between --ghost and [no]browse
+		# Its just insane to configure things like that.
+		if echo "$options" | grep -qE -- '\B-browse\b' ;
+		then
+		    startupoptions="$startupoptions --ghost"
+		fi
 		# Check for verbose
 		if echo "$DAEMONOPTIONS $options" | \
 					grep -qE -- '\B-(v\b|-verbose\b)' ;
@@ -202,7 +207,8 @@ function getmounts()
 		      sed   's/-\(t[^0-9]*\|-timeout\)[ \t=]*\([0-9][0-9]*\)//g' |
 		      sed   's/-\(g\b\|-ghost\b\)//g' |
 		      sed   's/-\(v\b\|-verbose\b\)//g' |
-		      sed   's/-\(d\b\|-debug\b\)//g')"
+		      sed   's/-\(d\b\|-debug\b\)//g' |
+		      sed   's/-\(no\)\?browse\b//g')"
 
 		# Break up the maptype and map, if the map type is specified
 		maptype=`echo $map | cut -f1 -d:`

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

maintainer
#1 lore raw
Quoted 10 lines · Jeff Moyer

Hi, Ian, list,

The patch below makes the Linux automounter a bit more compatibile with the Sun automounter, by parsing the -[no]browse options, and converting them into the equivalent --ghost option.

Ian, I've not made this patch against vanilla 4.1.3. This is the patch that went into the Red Hat RPM. I will generate a diff to whatever version you like, but I didn't want to do extra work since your tree may be quite different from 4.1.3 at this point.

Quite likely.

Doesn't look to complicated. I might do it by hand if needed.

Ian

maintainer
#2 lore raw
Quoted 8 lines · Ian Kent
Quoted 6 lines · Jeff Moyer

Hi, Ian, list,

The patch below makes the Linux automounter a bit more compatibile with the Sun automounter, by parsing the -[no]browse options, and converting them into the equivalent --ghost option.

Quoted 8 lines
Quoted 4 lines

Ian, I've not made this patch against vanilla 4.1.3. This is the patch that went into the Red Hat RPM. I will generate a diff to whatever version you like, but I didn't want to do extra work since your tree may be quite different from 4.1.3 at this point.

Quite likely.

Doesn't look to complicated. I might do it by hand if needed.

I've tried to apply this but it appears to depend on a previous patch. It's one of the few patches that remain outstanding for 4.1.4.

I didn't spend long on it. When I saw some stuff I didn't recognise in the init script I put it on the "get back to it list".

If you get a chance to create a diff againt the current code that would be good otherwise I'll get back to it after I've done the straight forward stuff.

Ian