mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: "Fabian LoneStar Frédérick " <fabian.frederick@gmx.fr>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [PATCH 2.6.4rc2mm1] nfsroot parser
Date: Wed, 10 Mar 2004 09:14:24 -0800	[thread overview]
Message-ID: <20040310091424.4ce14f15.rddunlap@osdl.org> (raw)
In-Reply-To: <24490.1078916018@www18.gmx.net>

On Wed, 10 Mar 2004 11:53:38 +0100 (MET) Fabian LoneStar Frédérick wrote:

| Hi,
| 
|       Here's a patch against 2.6.4rc2mm1.
| 
|             -Nfs root standard parser
|             -Enum activated :)
| 
| PS : This time it compiles :)


diff -Naur orig/fs/nfs/nfsroot.c edited/fs/nfs/nfsroot.c
--- orig/fs/nfs/nfsroot.c	2004-03-10 10:54:23.000000000 +0100
+++ edited/fs/nfs/nfsroot.c	2004-03-10 11:43:05.000000000 +0100
 
-static void __init root_nfs_parse(char *name, char *buf)
+
+static int __init root_nfs_parse(char *name, char *buf)
 {
 
+	char *p;
+	substring_t args[MAX_OPT_ARGS];
+	int option;
+
+	if (!name)
+		return 1;
+
+	if (name[0] && strcmp(name, "default")){
+		strlcpy(buf, name, NFS_MAXPATHLEN);
+		return 1;
+	}
+	while ((p = strsep (&name, ",")) != NULL) {
+		int token; 
+		if (!*p)
+			continue;
+		token = match_token(p, tokens, args);
+
+		/* %u tokens only */
+		if (match_int(&args[0], &option))
+                                return 0;
+		switch (token) {
...

What??  "soft" just needs to set NFS_MOUNT_SOFT, "hard" needs to clear
(reset) it.
That "... |= 0" is useless.
Similar for other options that are "opposites" of each other.
So typically each case below is:
				set_or_reset_a_value;
				break;

And please s/ ;/;/ on those line endings.

+			case Opt_soft:
+				nfs_data.flags &= ~NFS_MOUNT_SOFT;
+				nfs_data.flags |= NFS_MOUNT_SOFT;
+				break;
+			case Opt_hard:
+				nfs_data.flags &= ~NFS_MOUNT_SOFT ;
+				nfs_data.flags |= 0 ;
+				break;
+			case Opt_intr:
+				nfs_data.flags &= ~NFS_MOUNT_INTR;
+				nfs_data.flags |= NFS_MOUNT_INTR;
+				break;
+			case Opt_nointr:
+				nfs_data.flags &= ~NFS_MOUNT_INTR;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_posix:
+				nfs_data.flags &= ~NFS_MOUNT_POSIX;
+				nfs_data.flags |= NFS_MOUNT_POSIX;
+				break;
+			case Opt_noposix:
+				nfs_data.flags &= ~NFS_MOUNT_POSIX;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_cto:
+				nfs_data.flags &= ~NFS_MOUNT_NOCTO;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_nocto:
+				nfs_data.flags &= ~NFS_MOUNT_NOCTO;
+				nfs_data.flags |= NFS_MOUNT_NOCTO;
+				break;
+			case Opt_ac:
+				nfs_data.flags &= ~NFS_MOUNT_NOAC;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_noac:
+				nfs_data.flags &= ~NFS_MOUNT_NOAC;
+				nfs_data.flags |= NFS_MOUNT_NOAC;
+				break;
+			case Opt_lock:
+				nfs_data.flags &= ~NFS_MOUNT_NONLM;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_nolock:
+				nfs_data.flags &= ~NFS_MOUNT_NONLM;
+				nfs_data.flags |= NFS_MOUNT_NONLM;
+				break;
+			case Opt_v2:
+				nfs_data.flags &= ~NFS_MOUNT_VER3;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_v3:
+				nfs_data.flags &= ~NFS_MOUNT_VER3;
+				nfs_data.flags |= NFS_MOUNT_VER3;
+				break;
+			case Opt_udp:
+				nfs_data.flags &= ~NFS_MOUNT_TCP;
+				nfs_data.flags |= 0;
+				break;
+			case Opt_tcp:
+				nfs_data.flags &= ~NFS_MOUNT_TCP;
+				nfs_data.flags |= NFS_MOUNT_TCP;
+				break;
+			case Opt_broken_suid:
+				nfs_data.flags &= ~NFS_MOUNT_BROKEN_SUID;
+				nfs_data.flags |= NFS_MOUNT_BROKEN_SUID;
+				break;
+			default : 
+				return 0;
 		}
 	}

--
~Randy

  reply	other threads:[~2004-03-10 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 10:53 "Fabian LoneStar Frédérick"
2004-03-10 17:14 ` Randy.Dunlap [this message]
2004-03-10 18:23 "Fabian LoneStar Frédérick"
2004-03-10 18:43 ` Randy.Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040310091424.4ce14f15.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=akpm@osdl.org \
    --cc=fabian.frederick@gmx.fr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®