aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/inode.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2006-03-27 04:14:49 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:40 -0500
commitd7c4a5f1080a61fd4a3a00ba5f741986f8fb71f0 (patch)
treee8f87bd83b674826b3e7f90fcfc4dba8ac93fa7c /fs/autofs4/inode.c
parent862b110f0132401e422783bf68521ade3dc67578 (diff)
[PATCH] autofs4: add a show mount options for proc filesystem
Add show_options method to display autofs4 mount options in the proc filesystem. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r--fs/autofs4/inode.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 2335b1d6490f..d9a71dab40fc 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/file.h> 15#include <linux/file.h>
16#include <linux/seq_file.h>
16#include <linux/pagemap.h> 17#include <linux/pagemap.h>
17#include <linux/parser.h> 18#include <linux/parser.h>
18#include <linux/bitops.h> 19#include <linux/bitops.h>
@@ -163,9 +164,26 @@ static void autofs4_put_super(struct super_block *sb)
163 DPRINTK("shutting down"); 164 DPRINTK("shutting down");
164} 165}
165 166
167static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
168{
169 struct autofs_sb_info *sbi = autofs4_sbi(mnt->mnt_sb);
170
171 if (!sbi)
172 return 0;
173
174 seq_printf(m, ",fd=%d", sbi->pipefd);
175 seq_printf(m, ",pgrp=%d", sbi->oz_pgrp);
176 seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ);
177 seq_printf(m, ",minproto=%d", sbi->min_proto);
178 seq_printf(m, ",maxproto=%d", sbi->max_proto);
179
180 return 0;
181}
182
166static struct super_operations autofs4_sops = { 183static struct super_operations autofs4_sops = {
167 .put_super = autofs4_put_super, 184 .put_super = autofs4_put_super,
168 .statfs = simple_statfs, 185 .statfs = simple_statfs,
186 .show_options = autofs4_show_options,
169}; 187};
170 188
171enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto}; 189enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto};
@@ -261,7 +279,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
261 int pipefd; 279 int pipefd;
262 struct autofs_sb_info *sbi; 280 struct autofs_sb_info *sbi;
263 struct autofs_info *ino; 281 struct autofs_info *ino;
264 int minproto, maxproto;
265 282
266 sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL); 283 sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL);
267 if ( !sbi ) 284 if ( !sbi )
@@ -273,12 +290,15 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
273 s->s_fs_info = sbi; 290 s->s_fs_info = sbi;
274 sbi->magic = AUTOFS_SBI_MAGIC; 291 sbi->magic = AUTOFS_SBI_MAGIC;
275 sbi->root = NULL; 292 sbi->root = NULL;
293 sbi->pipefd = -1;
276 sbi->catatonic = 0; 294 sbi->catatonic = 0;
277 sbi->exp_timeout = 0; 295 sbi->exp_timeout = 0;
278 sbi->oz_pgrp = process_group(current); 296 sbi->oz_pgrp = process_group(current);
279 sbi->sb = s; 297 sbi->sb = s;
280 sbi->version = 0; 298 sbi->version = 0;
281 sbi->sub_version = 0; 299 sbi->sub_version = 0;
300 sbi->min_proto = 0;
301 sbi->max_proto = 0;
282 mutex_init(&sbi->wq_mutex); 302 mutex_init(&sbi->wq_mutex);
283 spin_lock_init(&sbi->fs_lock); 303 spin_lock_init(&sbi->fs_lock);
284 sbi->queues = NULL; 304 sbi->queues = NULL;
@@ -311,22 +331,26 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
311 if (parse_options(data, &pipefd, 331 if (parse_options(data, &pipefd,
312 &root_inode->i_uid, &root_inode->i_gid, 332 &root_inode->i_uid, &root_inode->i_gid,
313 &sbi->oz_pgrp, 333 &sbi->oz_pgrp,
314 &minproto, &maxproto)) { 334 &sbi->min_proto, &sbi->max_proto)) {
315 printk("autofs: called with bogus options\n"); 335 printk("autofs: called with bogus options\n");
316 goto fail_dput; 336 goto fail_dput;
317 } 337 }
318 338
319 /* Couldn't this be tested earlier? */ 339 /* Couldn't this be tested earlier? */
320 if (maxproto < AUTOFS_MIN_PROTO_VERSION || 340 if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
321 minproto > AUTOFS_MAX_PROTO_VERSION) { 341 sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
322 printk("autofs: kernel does not match daemon version " 342 printk("autofs: kernel does not match daemon version "
323 "daemon (%d, %d) kernel (%d, %d)\n", 343 "daemon (%d, %d) kernel (%d, %d)\n",
324 minproto, maxproto, 344 sbi->min_proto, sbi->max_proto,
325 AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); 345 AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
326 goto fail_dput; 346 goto fail_dput;
327 } 347 }
328 348
329 sbi->version = maxproto > AUTOFS_MAX_PROTO_VERSION ? AUTOFS_MAX_PROTO_VERSION : maxproto; 349 /* Establish highest kernel protocol version */
350 if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
351 sbi->version = AUTOFS_MAX_PROTO_VERSION;
352 else
353 sbi->version = sbi->max_proto;
330 sbi->sub_version = AUTOFS_PROTO_SUBVERSION; 354 sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
331 355
332 DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp); 356 DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
@@ -339,6 +363,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
339 if ( !pipe->f_op || !pipe->f_op->write ) 363 if ( !pipe->f_op || !pipe->f_op->write )
340 goto fail_fput; 364 goto fail_fput;
341 sbi->pipe = pipe; 365 sbi->pipe = pipe;
366 sbi->pipefd = pipefd;
342 367
343 /* 368 /*
344 * Take a reference to the root dentry so we get a chance to 369 * Take a reference to the root dentry so we get a chance to