diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-02-08 07:21:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:40 -0500 |
commit | 564cd138cb30658c12e80c33582bf50816ec7a41 (patch) | |
tree | 71e8c52e0c41210b3f9091e6dd6bfb828088b1e5 /fs/ncpfs/inode.c | |
parent | d0132eea7a295623e34e26b0977638cc0f62a2c6 (diff) |
mount options: fix ncpfs
Add a .show_options super operation to ncpfs.
Small fix: add FS_BINARY_MOUNTDATA to the filesystem type flags, since
it can take binary data, as well as text (similarly to NFS).
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ncpfs/inode.c')
-rw-r--r-- | fs/ncpfs/inode.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index eff1f18d034..fbbb9f7afa1 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
30 | #include <linux/vfs.h> | 30 | #include <linux/vfs.h> |
31 | #include <linux/mount.h> | ||
32 | #include <linux/seq_file.h> | ||
31 | 33 | ||
32 | #include <linux/ncp_fs.h> | 34 | #include <linux/ncp_fs.h> |
33 | 35 | ||
@@ -36,9 +38,15 @@ | |||
36 | #include "ncplib_kernel.h" | 38 | #include "ncplib_kernel.h" |
37 | #include "getopt.h" | 39 | #include "getopt.h" |
38 | 40 | ||
41 | #define NCP_DEFAULT_FILE_MODE 0600 | ||
42 | #define NCP_DEFAULT_DIR_MODE 0700 | ||
43 | #define NCP_DEFAULT_TIME_OUT 10 | ||
44 | #define NCP_DEFAULT_RETRY_COUNT 20 | ||
45 | |||
39 | static void ncp_delete_inode(struct inode *); | 46 | static void ncp_delete_inode(struct inode *); |
40 | static void ncp_put_super(struct super_block *); | 47 | static void ncp_put_super(struct super_block *); |
41 | static int ncp_statfs(struct dentry *, struct kstatfs *); | 48 | static int ncp_statfs(struct dentry *, struct kstatfs *); |
49 | static int ncp_show_options(struct seq_file *, struct vfsmount *); | ||
42 | 50 | ||
43 | static struct kmem_cache * ncp_inode_cachep; | 51 | static struct kmem_cache * ncp_inode_cachep; |
44 | 52 | ||
@@ -96,6 +104,7 @@ static const struct super_operations ncp_sops = | |||
96 | .put_super = ncp_put_super, | 104 | .put_super = ncp_put_super, |
97 | .statfs = ncp_statfs, | 105 | .statfs = ncp_statfs, |
98 | .remount_fs = ncp_remount, | 106 | .remount_fs = ncp_remount, |
107 | .show_options = ncp_show_options, | ||
99 | }; | 108 | }; |
100 | 109 | ||
101 | extern struct dentry_operations ncp_root_dentry_operations; | 110 | extern struct dentry_operations ncp_root_dentry_operations; |
@@ -304,6 +313,37 @@ static void ncp_stop_tasks(struct ncp_server *server) { | |||
304 | flush_scheduled_work(); | 313 | flush_scheduled_work(); |
305 | } | 314 | } |
306 | 315 | ||
316 | static int ncp_show_options(struct seq_file *seq, struct vfsmount *mnt) | ||
317 | { | ||
318 | struct ncp_server *server = NCP_SBP(mnt->mnt_sb); | ||
319 | unsigned int tmp; | ||
320 | |||
321 | if (server->m.uid != 0) | ||
322 | seq_printf(seq, ",uid=%u", server->m.uid); | ||
323 | if (server->m.gid != 0) | ||
324 | seq_printf(seq, ",gid=%u", server->m.gid); | ||
325 | if (server->m.mounted_uid != 0) | ||
326 | seq_printf(seq, ",owner=%u", server->m.mounted_uid); | ||
327 | tmp = server->m.file_mode & S_IALLUGO; | ||
328 | if (tmp != NCP_DEFAULT_FILE_MODE) | ||
329 | seq_printf(seq, ",mode=0%o", tmp); | ||
330 | tmp = server->m.dir_mode & S_IALLUGO; | ||
331 | if (tmp != NCP_DEFAULT_DIR_MODE) | ||
332 | seq_printf(seq, ",dirmode=0%o", tmp); | ||
333 | if (server->m.time_out != NCP_DEFAULT_TIME_OUT * HZ / 100) { | ||
334 | tmp = server->m.time_out * 100 / HZ; | ||
335 | seq_printf(seq, ",timeout=%u", tmp); | ||
336 | } | ||
337 | if (server->m.retry_count != NCP_DEFAULT_RETRY_COUNT) | ||
338 | seq_printf(seq, ",retry=%u", server->m.retry_count); | ||
339 | if (server->m.flags != 0) | ||
340 | seq_printf(seq, ",flags=%lu", server->m.flags); | ||
341 | if (server->m.wdog_pid != NULL) | ||
342 | seq_printf(seq, ",wdogpid=%u", pid_vnr(server->m.wdog_pid)); | ||
343 | |||
344 | return 0; | ||
345 | } | ||
346 | |||
307 | static const struct ncp_option ncp_opts[] = { | 347 | static const struct ncp_option ncp_opts[] = { |
308 | { "uid", OPT_INT, 'u' }, | 348 | { "uid", OPT_INT, 'u' }, |
309 | { "gid", OPT_INT, 'g' }, | 349 | { "gid", OPT_INT, 'g' }, |
@@ -331,12 +371,12 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options) | |||
331 | data->mounted_uid = 0; | 371 | data->mounted_uid = 0; |
332 | data->wdog_pid = NULL; | 372 | data->wdog_pid = NULL; |
333 | data->ncp_fd = ~0; | 373 | data->ncp_fd = ~0; |
334 | data->time_out = 10; | 374 | data->time_out = NCP_DEFAULT_TIME_OUT; |
335 | data->retry_count = 20; | 375 | data->retry_count = NCP_DEFAULT_RETRY_COUNT; |
336 | data->uid = 0; | 376 | data->uid = 0; |
337 | data->gid = 0; | 377 | data->gid = 0; |
338 | data->file_mode = 0600; | 378 | data->file_mode = NCP_DEFAULT_FILE_MODE; |
339 | data->dir_mode = 0700; | 379 | data->dir_mode = NCP_DEFAULT_DIR_MODE; |
340 | data->info_fd = -1; | 380 | data->info_fd = -1; |
341 | data->mounted_vol[0] = 0; | 381 | data->mounted_vol[0] = 0; |
342 | 382 | ||
@@ -982,6 +1022,7 @@ static struct file_system_type ncp_fs_type = { | |||
982 | .name = "ncpfs", | 1022 | .name = "ncpfs", |
983 | .get_sb = ncp_get_sb, | 1023 | .get_sb = ncp_get_sb, |
984 | .kill_sb = kill_anon_super, | 1024 | .kill_sb = kill_anon_super, |
1025 | .fs_flags = FS_BINARY_MOUNTDATA, | ||
985 | }; | 1026 | }; |
986 | 1027 | ||
987 | static int __init init_ncp_fs(void) | 1028 | static int __init init_ncp_fs(void) |