aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/super.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-03-09 14:59:30 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-03-09 14:59:30 -0500
commit69eb66d7da7dba2696281981347698e1693c2340 (patch)
treeba699dc7a1a80efe159f4a4401b174a7e80779fc /fs/jfs/super.c
parentbe0bf7da19135a7a0f8c275f20c819940be218d9 (diff)
JFS: add uid, gid, and umask mount options
OS/2 doesn't initialize the uid, gid, or unix-style permission bits. The uid, gid, & umask mount options perform pretty much like those for the fat file system, overriding what is stored on disk. This is useful for users sharing the file system with OS/2. I implemented a little feature so that if you mask the execute bit, it will be re-enabled on directories when the appropriate read bit is unmasked. I didn't want to implement an fmask & dmask option. Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r--fs/jfs/super.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index ab6333347004..18f69e6aa719 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -194,7 +194,7 @@ static void jfs_put_super(struct super_block *sb)
194enum { 194enum {
195 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, 195 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
196 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, 196 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
197 Opt_usrquota, Opt_grpquota 197 Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
198}; 198};
199 199
200static match_table_t tokens = { 200static match_table_t tokens = {
@@ -208,6 +208,9 @@ static match_table_t tokens = {
208 {Opt_ignore, "quota"}, 208 {Opt_ignore, "quota"},
209 {Opt_usrquota, "usrquota"}, 209 {Opt_usrquota, "usrquota"},
210 {Opt_grpquota, "grpquota"}, 210 {Opt_grpquota, "grpquota"},
211 {Opt_uid, "uid=%u"},
212 {Opt_gid, "gid=%u"},
213 {Opt_umask, "umask=%u"},
211 {Opt_err, NULL} 214 {Opt_err, NULL}
212}; 215};
213 216
@@ -312,7 +315,29 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
312 "JFS: quota operations not supported\n"); 315 "JFS: quota operations not supported\n");
313 break; 316 break;
314#endif 317#endif
315 318 case Opt_uid:
319 {
320 char *uid = args[0].from;
321 sbi->uid = simple_strtoul(uid, &uid, 0);
322 break;
323 }
324 case Opt_gid:
325 {
326 char *gid = args[0].from;
327 sbi->gid = simple_strtoul(gid, &gid, 0);
328 break;
329 }
330 case Opt_umask:
331 {
332 char *umask = args[0].from;
333 sbi->umask = simple_strtoul(umask, &umask, 8);
334 if (sbi->umask & ~0777) {
335 printk(KERN_ERR
336 "JFS: Invalid value of umask\n");
337 goto cleanup;
338 }
339 break;
340 }
316 default: 341 default:
317 printk("jfs: Unrecognized mount option \"%s\" " 342 printk("jfs: Unrecognized mount option \"%s\" "
318 " or missing value\n", p); 343 " or missing value\n", p);
@@ -400,6 +425,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
400 return -ENOSPC; 425 return -ENOSPC;
401 sb->s_fs_info = sbi; 426 sb->s_fs_info = sbi;
402 sbi->sb = sb; 427 sbi->sb = sb;
428 sbi->uid = sbi->gid = sbi->umask = -1;
403 429
404 /* initialize the mount flag and determine the default error handler */ 430 /* initialize the mount flag and determine the default error handler */
405 flag = JFS_ERR_REMOUNT_RO; 431 flag = JFS_ERR_REMOUNT_RO;
@@ -562,10 +588,14 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
562{ 588{
563 struct jfs_sb_info *sbi = JFS_SBI(vfs->mnt_sb); 589 struct jfs_sb_info *sbi = JFS_SBI(vfs->mnt_sb);
564 590
591 if (sbi->uid != -1)
592 seq_printf(seq, ",uid=%d", sbi->uid);
593 if (sbi->gid != -1)
594 seq_printf(seq, ",gid=%d", sbi->gid);
595 if (sbi->umask != -1)
596 seq_printf(seq, ",umask=%03o", sbi->umask);
565 if (sbi->flag & JFS_NOINTEGRITY) 597 if (sbi->flag & JFS_NOINTEGRITY)
566 seq_puts(seq, ",nointegrity"); 598 seq_puts(seq, ",nointegrity");
567 else
568 seq_puts(seq, ",integrity");
569 599
570#if defined(CONFIG_QUOTA) 600#if defined(CONFIG_QUOTA)
571 if (sbi->flag & JFS_USRQUOTA) 601 if (sbi->flag & JFS_USRQUOTA)