[klibc] [klibc:master] mount: Implement -o defaults

klibc-bot for Ben Hutchings ben at decadent.org.uk
Tue Jan 5 17:54:06 PST 2016


Commit-ID:  76e7a4a89826c76b9ebbe9d6015ab16aadbe3dcd
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=76e7a4a89826c76b9ebbe9d6015ab16aadbe3dcd
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Wed, 6 Jan 2016 01:09:36 +0000
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 5 Jan 2016 17:48:54 -0800

[klibc] mount: Implement -o defaults

This is needed to support mounting non-root filesystems in
initramfs-tools.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 usr/utils/mount_opts.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/usr/utils/mount_opts.c b/usr/utils/mount_opts.c
index 05d1729..bb26c7d 100644
--- a/usr/utils/mount_opts.c
+++ b/usr/utils/mount_opts.c
@@ -89,8 +89,13 @@ parse_mount_options(char *arg, unsigned long rwflag, struct extra_opts *extra)
 				break;
 		}
 
-		if (res != 0 && s[0])
-			add_extra_option(extra, opt);
+		if (res != 0 && s[0]) {
+			if (!strcmp(opt, "defaults"))
+				rwflag &= ~(MS_RDONLY|MS_NOSUID|MS_NODEV|
+					    MS_NOEXEC|MS_SYNCHRONOUS);
+			else
+				add_extra_option(extra, opt);
+		}
 	}
 
 	return rwflag;


More information about the klibc mailing list