aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Hering <olh@suse.de>2004-10-10 17:17:46 +0000
committerH. Peter Anvin <hpa@zytor.com>2004-10-10 17:17:46 +0000
commita2fb0779412a620260cf36df58c8114ffdf740e1 (patch)
treeac4a7a80d64f5560d94b82348b7f36250c7ed348
parent26b076f667bcb9803cd6ec3509ef6e0167009876 (diff)
downloadklibc-a2fb0779412a620260cf36df58c8114ffdf740e1.tar.gz
add "rw" and "ro" option to nfsmountklibc-0.182
-rw-r--r--nfsmount/main.c2
-rw-r--r--nfsmount/mount.c5
-rw-r--r--nfsmount/nfsmount.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/nfsmount/main.c b/nfsmount/main.c
index a9a38c74f618b..537880a4f4229 100644
--- a/nfsmount/main.c
+++ b/nfsmount/main.c
@@ -75,6 +75,8 @@ static struct bool_opts {
{ "udp", ~NFS_MOUNT_TCP, 0 },
{ "tcp", ~NFS_MOUNT_TCP, NFS_MOUNT_TCP },
{ "broken_suid",~NFS_MOUNT_BROKEN_SUID, NFS_MOUNT_BROKEN_SUID },
+ { "ro", ~NFS_MOUNT_KLIBC_RONLY, NFS_MOUNT_KLIBC_RONLY },
+ { "rw", ~NFS_MOUNT_KLIBC_RONLY, 0 },
{ NULL, 0, 0 }
};
diff --git a/nfsmount/mount.c b/nfsmount/mount.c
index 909e2543ca19c..7f7f25b65fed3 100644
--- a/nfsmount/mount.c
+++ b/nfsmount/mount.c
@@ -247,6 +247,7 @@ int nfs_mount(const char *pathname, const char *hostname,
char mounted = 0;
int sock = -1;
int ret = 0;
+ int mountflags;
get_ports(server, data);
@@ -298,7 +299,9 @@ int nfs_mount(const char *pathname, const char *hostname,
data->fd = sock;
- ret = mount(pathname, path, "nfs", 0, data);
+ mountflags = (data->flags & NFS_MOUNT_KLIBC_RONLY) ? MS_RDONLY : 0;
+ data->flags = data->flags & NFS_MOUNT_FLAGMASK;
+ ret = mount(pathname, path, "nfs", mountflags, data);
if (ret == -1) {
perror("mount");
diff --git a/nfsmount/nfsmount.h b/nfsmount/nfsmount.h
index 8a9eb41d51658..d30e98a19b61e 100644
--- a/nfsmount/nfsmount.h
+++ b/nfsmount/nfsmount.h
@@ -16,6 +16,8 @@ enum nfs_proto {
v3,
};
+/* masked with NFS_MOUNT_FLAGMASK before mount() call */
+#define NFS_MOUNT_KLIBC_RONLY 0x00010000U
/*
* Note for gcc 3.2.2:
*