Busybox[PATCH] for mount.c - enable fsc as a mount option for NFS

Roland Arnold rolandarnold at gmail.com
Tue May 12 07:40:38 UTC 2009


Hi All,

This is a patch to mount.c to allow the file-system caching 'fsc' flag
for NFS mounts. FS-Cache is new in the 2.6.30 kernel. Note that this
changes the behaviour of the mount sys-call to pass through a string
and not a struct anymore; it makes the code match what nfs-utils does
- at least for NFS3.

--- orig/util-linux/mount.c	2009-05-09 13:35:41.854799281 +0200
+++ mod/util-linux/mount.c	2009-05-09 13:33:23.147299934 +0200
@@ -991,8 +991,9 @@ static int nfsmount(struct mntent *mp, l
 	mclient = NULL;

 	/* NB: hostname, mounthost, filteropts must be free()d prior to return */
-
-	filteropts = xstrdup(filteropts); /* going to trash it later... */
+
+	free(mp->mnt_opts);
+	mp->mnt_opts = xstrdup(filteropts); /* going to trash it later... */

 	hostname = xstrdup(mp->mnt_fsname);
 	/* mount_main() guarantees that ':' is there */
@@ -1035,7 +1036,6 @@ static int nfsmount(struct mntent *mp, l
 		free(mp->mnt_opts);
 		mp->mnt_opts = tmp;
 	}
-
 	/* Set default options.
 	 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
 	 * let the kernel decide.
@@ -1190,7 +1190,8 @@ static int nfsmount(struct mntent *mp, l
 				"tcp\0"
 				"udp\0"
 				"lock\0"
-				"rdirplus\0";
+				"rdirplus\0"
+				"fsc\0";
 			int val = 1;
 			if (!strncmp(opt, "no", 2)) {
 				val = 0;
@@ -1240,6 +1241,8 @@ static int nfsmount(struct mntent *mp, l
 			case 11: //rdirplus
 				nordirplus = !val;
 				break;
+			case 12: //fsc
+				break;
 			default:
 				bb_error_msg("unknown nfs mount option: %s%s", val ? "" : "no", opt);
 				goto fail;
@@ -1538,7 +1541,7 @@ static int nfsmount(struct mntent *mp, l
  do_mount: /* perform actual mount */

 	mp->mnt_type = (char*)"nfs";
-	retval = mount_it_now(mp, vfsflags, (char*)&data);
+	retval = mount_it_now(mp, vfsflags, (char*)mp->mnt_opts);
 	goto ret;

  fail:	/* abort */

--

Roland Arnold


More information about the busybox mailing list