aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-02-08 07:21:09 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:38 -0500
commit9b7880e7bb30e641037550888b5c22d94c77f254 (patch)
tree4e2ef4fa7a5fc63059fcd928a300169e41aa207c
parent6d141c3ff6d74cc30cdbf26155842756ac16cf7f (diff)
isofs: implement dmode option
Implement dmode option for iso9660 filesystem to allow setting of access rights for directories on the filesystem. Signed-off-by: Jan Kara <jack@suse.cz> Cc: "Ilya N. Golubev" <gin@mo.msk.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/filesystems/isofs.txt1
-rw-r--r--fs/isofs/inode.c23
-rw-r--r--fs/isofs/isofs.h3
3 files changed, 18 insertions, 9 deletions
diff --git a/Documentation/filesystems/isofs.txt b/Documentation/filesystems/isofs.txt
index 758e50401c16..6973b980ca2a 100644
--- a/Documentation/filesystems/isofs.txt
+++ b/Documentation/filesystems/isofs.txt
@@ -24,6 +24,7 @@ Mount options unique to the isofs filesystem.
24 map=normal Map non-Rock Ridge filenames to lower case 24 map=normal Map non-Rock Ridge filenames to lower case
25 map=acorn As map=normal but also apply Acorn extensions if present 25 map=acorn As map=normal but also apply Acorn extensions if present
26 mode=xxx Sets the permissions on files to xxx 26 mode=xxx Sets the permissions on files to xxx
27 dmode=xxx Sets the permissions on directories to xxx
27 nojoliet Ignore Joliet extensions if they are present. 28 nojoliet Ignore Joliet extensions if they are present.
28 norock Ignore Rock Ridge extensions if they are present. 29 norock Ignore Rock Ridge extensions if they are present.
29 hide Completely strip hidden files from the file system. 30 hide Completely strip hidden files from the file system.
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 875d37fb6c70..c3240b42ebf5 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -144,7 +144,8 @@ struct iso9660_options{
144 char nocompress; 144 char nocompress;
145 unsigned char check; 145 unsigned char check;
146 unsigned int blocksize; 146 unsigned int blocksize;
147 mode_t mode; 147 mode_t fmode;
148 mode_t dmode;
148 gid_t gid; 149 gid_t gid;
149 uid_t uid; 150 uid_t uid;
150 char *iocharset; 151 char *iocharset;
@@ -305,7 +306,7 @@ enum {
305 Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore, 306 Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore,
306 Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet, 307 Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet,
307 Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err, 308 Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err,
308 Opt_nocompress, Opt_hide, Opt_showassoc, 309 Opt_nocompress, Opt_hide, Opt_showassoc, Opt_dmode,
309}; 310};
310 311
311static match_table_t tokens = { 312static match_table_t tokens = {
@@ -332,6 +333,7 @@ static match_table_t tokens = {
332 {Opt_uid, "uid=%u"}, 333 {Opt_uid, "uid=%u"},
333 {Opt_gid, "gid=%u"}, 334 {Opt_gid, "gid=%u"},
334 {Opt_mode, "mode=%u"}, 335 {Opt_mode, "mode=%u"},
336 {Opt_dmode, "dmode=%u"},
335 {Opt_block, "block=%u"}, 337 {Opt_block, "block=%u"},
336 {Opt_ignore, "conv=binary"}, 338 {Opt_ignore, "conv=binary"},
337 {Opt_ignore, "conv=b"}, 339 {Opt_ignore, "conv=b"},
@@ -359,7 +361,7 @@ static int parse_options(char *options, struct iso9660_options *popt)
359 popt->check = 'u'; /* unset */ 361 popt->check = 'u'; /* unset */
360 popt->nocompress = 0; 362 popt->nocompress = 0;
361 popt->blocksize = 1024; 363 popt->blocksize = 1024;
362 popt->mode = S_IRUGO | S_IXUGO; /* 364 popt->fmode = popt->dmode = S_IRUGO | S_IXUGO; /*
363 * r-x for all. The disc could 365 * r-x for all. The disc could
364 * be shared with DOS machines so 366 * be shared with DOS machines so
365 * virtually anything could be 367 * virtually anything could be
@@ -451,7 +453,12 @@ static int parse_options(char *options, struct iso9660_options *popt)
451 case Opt_mode: 453 case Opt_mode:
452 if (match_int(&args[0], &option)) 454 if (match_int(&args[0], &option))
453 return 0; 455 return 0;
454 popt->mode = option; 456 popt->fmode = option;
457 break;
458 case Opt_dmode:
459 if (match_int(&args[0], &option))
460 return 0;
461 popt->dmode = option;
455 break; 462 break;
456 case Opt_block: 463 case Opt_block:
457 if (match_int(&args[0], &option)) 464 if (match_int(&args[0], &option))
@@ -801,7 +808,8 @@ root_found:
801 * on the disk as suid, so we merely allow them to set the default 808 * on the disk as suid, so we merely allow them to set the default
802 * permissions. 809 * permissions.
803 */ 810 */
804 sbi->s_mode = opt.mode & 0777; 811 sbi->s_fmode = opt.fmode & 0777;
812 sbi->s_dmode = opt.dmode & 0777;
805 813
806 /* 814 /*
807 * Read the root inode, which _may_ result in changing 815 * Read the root inode, which _may_ result in changing
@@ -1248,7 +1256,7 @@ static int isofs_read_inode(struct inode *inode)
1248 ei->i_file_format = isofs_file_normal; 1256 ei->i_file_format = isofs_file_normal;
1249 1257
1250 if (de->flags[-high_sierra] & 2) { 1258 if (de->flags[-high_sierra] & 2) {
1251 inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR; 1259 inode->i_mode = sbi->s_dmode | S_IFDIR;
1252 inode->i_nlink = 1; /* 1260 inode->i_nlink = 1; /*
1253 * Set to 1. We know there are 2, but 1261 * Set to 1. We know there are 2, but
1254 * the find utility tries to optimize 1262 * the find utility tries to optimize
@@ -1258,9 +1266,8 @@ static int isofs_read_inode(struct inode *inode)
1258 */ 1266 */
1259 } else { 1267 } else {
1260 /* Everybody gets to read the file. */ 1268 /* Everybody gets to read the file. */
1261 inode->i_mode = sbi->s_mode; 1269 inode->i_mode = sbi->s_fmode | S_IFREG;
1262 inode->i_nlink = 1; 1270 inode->i_nlink = 1;
1263 inode->i_mode |= S_IFREG;
1264 } 1271 }
1265 inode->i_uid = sbi->s_uid; 1272 inode->i_uid = sbi->s_uid;
1266 inode->i_gid = sbi->s_gid; 1273 inode->i_gid = sbi->s_gid;
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index f3213f9f89af..d1bdf8adb351 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -51,7 +51,8 @@ struct isofs_sb_info {
51 unsigned char s_hide; 51 unsigned char s_hide;
52 unsigned char s_showassoc; 52 unsigned char s_showassoc;
53 53
54 mode_t s_mode; 54 mode_t s_fmode;
55 mode_t s_dmode;
55 gid_t s_gid; 56 gid_t s_gid;
56 uid_t s_uid; 57 uid_t s_uid;
57 struct nls_table *s_nls_iocharset; /* Native language support table */ 58 struct nls_table *s_nls_iocharset; /* Native language support table */