All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: lczerner@redhat.com
Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] vfs: Handle fs_param_neg_with_empty
Date: Wed, 16 Oct 2019 11:37:54 +0100	[thread overview]
Message-ID: <157122227425.17182.1135743644487819585.stgit@warthog.procyon.org.uk> (raw)

Make fs_param_neg_with_empty work.  It says that a parameter with no value
or and empty value should be marked as negated.

This is intended for use with ext4, which hadn't yet been converted.

Fixes: 31d921c7fb96 ("vfs: Add configuration parser helpers")
Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/fs_parser.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index d1930adce68d..f95997a76738 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -129,6 +129,11 @@ int fs_parse(struct fs_context *fc,
 	case fs_param_is_string:
 		if (param->type != fs_value_is_string)
 			goto bad_value;
+		if ((p->flags & fs_param_neg_with_empty) &&
+		    (!result->has_value || !param->string[0])) {
+			result->negated = true;
+			goto okay;
+		}
 		if (!result->has_value) {
 			if (p->flags & fs_param_v_optional)
 				goto okay;


             reply	other threads:[~2019-10-16 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 10:37 David Howells [this message]
2019-10-16 13:42 ` [PATCH] vfs: Handle fs_param_neg_with_empty Lukas Czerner

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=157122227425.17182.1135743644487819585.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.