On Tue, May 29, 2007 at 05:08:01PM -0400, Chuck Lever wrote:
> Karel Zak wrote:
> >On Mon, May 21, 2007 at 12:09:54PM -0400, Chuck Lever wrote:
> >>For NFSv2 and NFSv3 mount options.
> >>Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
> >
> > ....
> >
> >>+static int nfs_parse_options(char *raw, struct nfs_mount_args *mnt)
> >>+{
> >>+   char *p, *string;
> >>+
> >>+   if (!raw) {
> >>+           dprintk("NFS: mount options string was NULL.\n");
> >>+           return 1;
> >>+   }
> >>+
> >>+   while ((p = strsep (&raw, ",")) != NULL) {
> >>+           substring_t args[MAX_OPT_ARGS];
> >>+           int option, token;
> >>+
> >>+           if (!*p)
> >>+                   continue;
> >>+           token = match_token(p, nfs_tokens, args);
> >
> > ....
> >
> >>+
> >>+           case Opt_context:
> >>+                   match_strcpy(mnt->nmd.context, args);
> >>+                   break;
> >
> > The userspace version (nfs-utils) of this code supports a quoted
> > context strings. For example:
> >
> >    context="aaa,bbb,ccc",hard
> >
> > It seems your code blindly parses a raw option string by ",".
> 
> Karel-
> 
> I've never used the context= option, and didn't find any documentation 
> describing how it was used.

 That's SELinux stuff. See original discussion:

 http://thread.gmane.org/gmane.linux.redhat.security.lspp/1002/focus=1004

 There are also fscontext, defcontext and context for normal (non-NFS)
 mounts. See the mount.8 patch (where is basic docs):

 
http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blobdiff;f=mount/mount.8;h=8ed5a11b77985c8da2dcac4602a67f8785a95070;hp=4692a42b3487b8e0db6dc0b7d17cfd214e8aefc8;hb=3a620ba4bffade41d81c429560c40bb65c9b81a7;hpb=6573c985a4077fa7d50ccb993bae177526fde8ec
 
> Is there a clean example of how to use the in-kernel parser to handle 
> quoted strings containing commas?

 Not sure.

 It was introduced by "[PATCH] SELinux: support mls categories for context
 mounts":

 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3528a95322b5c1ce882ab723f175a1845430cd89

 The SELinux specific options are extracted from mount options by the
 sb_copy_data hook (fs/super.c, vfs_kern_mount()) -- that's probably
 transparent for all filesystems, maybe for your NFS options too. (I
 didn't study it in detail.)

    Karel

-- 
 Karel Zak  <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to