|
28 | 28 | #include <linux/init.h> |
29 | 29 | #include <linux/smp_lock.h> |
30 | 30 | #include <linux/vfs.h> |
| 31 | +#include <linux/mount.h> |
| 32 | +#include <linux/seq_file.h> |
31 | 33 |
|
32 | 34 | #include <linux/ncp_fs.h> |
33 | 35 |
|
|
36 | 38 | #include "ncplib_kernel.h" |
37 | 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 | 46 | static void ncp_delete_inode(struct inode *); |
40 | 47 | static void ncp_put_super(struct super_block *); |
41 | 48 | static int ncp_statfs(struct dentry *, struct kstatfs *); |
| 49 | +static int ncp_show_options(struct seq_file *, struct vfsmount *); |
42 | 50 |
|
43 | 51 | static struct kmem_cache * ncp_inode_cachep; |
44 | 52 |
|
@@ -96,6 +104,7 @@ static const struct super_operations ncp_sops = |
96 | 104 | .put_super = ncp_put_super, |
97 | 105 | .statfs = ncp_statfs, |
98 | 106 | .remount_fs = ncp_remount, |
| 107 | + .show_options = ncp_show_options, |
99 | 108 | }; |
100 | 109 |
|
101 | 110 | extern struct dentry_operations ncp_root_dentry_operations; |
@@ -304,6 +313,37 @@ static void ncp_stop_tasks(struct ncp_server *server) { |
304 | 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 | 347 | static const struct ncp_option ncp_opts[] = { |
308 | 348 | { "uid", OPT_INT, 'u' }, |
309 | 349 | { "gid", OPT_INT, 'g' }, |
@@ -331,12 +371,12 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options) |
331 | 371 | data->mounted_uid = 0; |
332 | 372 | data->wdog_pid = NULL; |
333 | 373 | data->ncp_fd = ~0; |
334 | | - data->time_out = 10; |
335 | | - data->retry_count = 20; |
| 374 | + data->time_out = NCP_DEFAULT_TIME_OUT; |
| 375 | + data->retry_count = NCP_DEFAULT_RETRY_COUNT; |
336 | 376 | data->uid = 0; |
337 | 377 | data->gid = 0; |
338 | | - data->file_mode = 0600; |
339 | | - data->dir_mode = 0700; |
| 378 | + data->file_mode = NCP_DEFAULT_FILE_MODE; |
| 379 | + data->dir_mode = NCP_DEFAULT_DIR_MODE; |
340 | 380 | data->info_fd = -1; |
341 | 381 | data->mounted_vol[0] = 0; |
342 | 382 |
|
@@ -982,6 +1022,7 @@ static struct file_system_type ncp_fs_type = { |
982 | 1022 | .name = "ncpfs", |
983 | 1023 | .get_sb = ncp_get_sb, |
984 | 1024 | .kill_sb = kill_anon_super, |
| 1025 | + .fs_flags = FS_BINARY_MOUNTDATA, |
985 | 1026 | }; |
986 | 1027 |
|
987 | 1028 | static int __init init_ncp_fs(void) |
|
0 commit comments