Skip to content

Commit 564cd13

Browse files
Miklos SzerediLinus Torvalds
authored andcommitted
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>
1 parent d0132ee commit 564cd13

1 file changed

Lines changed: 45 additions & 4 deletions

File tree

‎fs/ncpfs/inode.c‎

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <linux/init.h>
2929
#include <linux/smp_lock.h>
3030
#include <linux/vfs.h>
31+
#include <linux/mount.h>
32+
#include <linux/seq_file.h>
3133

3234
#include <linux/ncp_fs.h>
3335

@@ -36,9 +38,15 @@
3638
#include "ncplib_kernel.h"
3739
#include "getopt.h"
3840

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+
3946
static void ncp_delete_inode(struct inode *);
4047
static void ncp_put_super(struct super_block *);
4148
static int ncp_statfs(struct dentry *, struct kstatfs *);
49+
static int ncp_show_options(struct seq_file *, struct vfsmount *);
4250

4351
static struct kmem_cache * ncp_inode_cachep;
4452

@@ -96,6 +104,7 @@ static const struct super_operations ncp_sops =
96104
.put_super = ncp_put_super,
97105
.statfs = ncp_statfs,
98106
.remount_fs = ncp_remount,
107+
.show_options = ncp_show_options,
99108
};
100109

101110
extern struct dentry_operations ncp_root_dentry_operations;
@@ -304,6 +313,37 @@ static void ncp_stop_tasks(struct ncp_server *server) {
304313
flush_scheduled_work();
305314
}
306315

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+
307347
static const struct ncp_option ncp_opts[] = {
308348
{ "uid", OPT_INT, 'u' },
309349
{ "gid", OPT_INT, 'g' },
@@ -331,12 +371,12 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
331371
data->mounted_uid = 0;
332372
data->wdog_pid = NULL;
333373
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;
336376
data->uid = 0;
337377
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;
340380
data->info_fd = -1;
341381
data->mounted_vol[0] = 0;
342382

@@ -982,6 +1022,7 @@ static struct file_system_type ncp_fs_type = {
9821022
.name = "ncpfs",
9831023
.get_sb = ncp_get_sb,
9841024
.kill_sb = kill_anon_super,
1025+
.fs_flags = FS_BINARY_MOUNTDATA,
9851026
};
9861027

9871028
static int __init init_ncp_fs(void)

0 commit comments

Comments
 (0)