Commit 5404ac8e4418ab3d254950ee4f9bcafc1da20b4a
Committed by
Linus Torvalds
1 parent
5c4a656b7e
Exists in
master
and in
7 other branches
isofs: cleanup mount option processing
Remove unused variables from isofs_sb_info (used to be some mount options), unify variables for option to use 0/1 (some options used 'y'/'n'), use bit fields for option flags in superblock. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 4 changed files with 40 additions and 45 deletions Side-by-side Diff
fs/isofs/dir.c
... | ... | @@ -195,9 +195,8 @@ |
195 | 195 | * Do not report hidden files if so instructed, or associated |
196 | 196 | * files unless instructed to do so |
197 | 197 | */ |
198 | - if ((sbi->s_hide == 'y' && | |
199 | - (de->flags[-sbi->s_high_sierra] & 1)) || | |
200 | - (sbi->s_showassoc =='n' && | |
198 | + if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) || | |
199 | + (!sbi->s_showassoc && | |
201 | 200 | (de->flags[-sbi->s_high_sierra] & 4))) { |
202 | 201 | filp->f_pos += de_len; |
203 | 202 | continue; |
fs/isofs/inode.c
... | ... | @@ -141,24 +141,24 @@ |
141 | 141 | }; |
142 | 142 | |
143 | 143 | struct iso9660_options{ |
144 | - char map; | |
145 | - char rock; | |
144 | + unsigned int rock:1; | |
145 | + unsigned int cruft:1; | |
146 | + unsigned int hide:1; | |
147 | + unsigned int showassoc:1; | |
148 | + unsigned int nocompress:1; | |
149 | + unsigned int overriderockperm:1; | |
150 | + unsigned int uid_set:1; | |
151 | + unsigned int gid_set:1; | |
152 | + unsigned int utf8:1; | |
153 | + unsigned char map; | |
146 | 154 | char joliet; |
147 | - char cruft; | |
148 | - char hide; | |
149 | - char showassoc; | |
150 | - char nocompress; | |
151 | - char overriderockperm; | |
152 | 155 | unsigned char check; |
153 | 156 | unsigned int blocksize; |
154 | 157 | mode_t fmode; |
155 | 158 | mode_t dmode; |
156 | - char uid_set; | |
157 | - char gid_set; | |
158 | 159 | gid_t gid; |
159 | 160 | uid_t uid; |
160 | 161 | char *iocharset; |
161 | - unsigned char utf8; | |
162 | 162 | /* LVE */ |
163 | 163 | s32 session; |
164 | 164 | s32 sbsector; |
... | ... | @@ -363,11 +363,11 @@ |
363 | 363 | int option; |
364 | 364 | |
365 | 365 | popt->map = 'n'; |
366 | - popt->rock = 'y'; | |
367 | - popt->joliet = 'y'; | |
368 | - popt->cruft = 'n'; | |
369 | - popt->hide = 'n'; | |
370 | - popt->showassoc = 'n'; | |
366 | + popt->rock = 1; | |
367 | + popt->joliet = 1; | |
368 | + popt->cruft = 0; | |
369 | + popt->hide = 0; | |
370 | + popt->showassoc = 0; | |
371 | 371 | popt->check = 'u'; /* unset */ |
372 | 372 | popt->nocompress = 0; |
373 | 373 | popt->blocksize = 1024; |
374 | 374 | |
375 | 375 | |
376 | 376 | |
377 | 377 | |
... | ... | @@ -395,20 +395,20 @@ |
395 | 395 | token = match_token(p, tokens, args); |
396 | 396 | switch (token) { |
397 | 397 | case Opt_norock: |
398 | - popt->rock = 'n'; | |
398 | + popt->rock = 0; | |
399 | 399 | break; |
400 | 400 | case Opt_nojoliet: |
401 | - popt->joliet = 'n'; | |
401 | + popt->joliet = 0; | |
402 | 402 | break; |
403 | 403 | case Opt_hide: |
404 | - popt->hide = 'y'; | |
404 | + popt->hide = 1; | |
405 | 405 | break; |
406 | 406 | case Opt_unhide: |
407 | 407 | case Opt_showassoc: |
408 | - popt->showassoc = 'y'; | |
408 | + popt->showassoc = 1; | |
409 | 409 | break; |
410 | 410 | case Opt_cruft: |
411 | - popt->cruft = 'y'; | |
411 | + popt->cruft = 1; | |
412 | 412 | break; |
413 | 413 | case Opt_utf8: |
414 | 414 | popt->utf8 = 1; |
... | ... | @@ -657,7 +657,7 @@ |
657 | 657 | goto out_freebh; |
658 | 658 | |
659 | 659 | sbi->s_high_sierra = 1; |
660 | - opt.rock = 'n'; | |
660 | + opt.rock = 0; | |
661 | 661 | h_pri = (struct hs_primary_descriptor *)vdp; |
662 | 662 | goto root_found; |
663 | 663 | } |
... | ... | @@ -680,7 +680,7 @@ |
680 | 680 | |
681 | 681 | root_found: |
682 | 682 | |
683 | - if (joliet_level && (pri == NULL || opt.rock == 'n')) { | |
683 | + if (joliet_level && (pri == NULL || !opt.rock)) { | |
684 | 684 | /* This is the case of Joliet with the norock mount flag. |
685 | 685 | * A disc with both Joliet and Rock Ridge is handled later |
686 | 686 | */ |
... | ... | @@ -809,7 +809,7 @@ |
809 | 809 | s->s_op = &isofs_sops; |
810 | 810 | s->s_export_op = &isofs_export_ops; |
811 | 811 | sbi->s_mapping = opt.map; |
812 | - sbi->s_rock = (opt.rock == 'y' ? 2 : 0); | |
812 | + sbi->s_rock = (opt.rock ? 2 : 0); | |
813 | 813 | sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/ |
814 | 814 | sbi->s_cruft = opt.cruft; |
815 | 815 | sbi->s_hide = opt.hide; |
... | ... | @@ -1315,7 +1315,7 @@ |
1315 | 1315 | * this CDROM was mounted with the cruft option. |
1316 | 1316 | */ |
1317 | 1317 | |
1318 | - if (sbi->s_cruft == 'y') | |
1318 | + if (sbi->s_cruft) | |
1319 | 1319 | inode->i_size &= 0x00ffffff; |
1320 | 1320 | |
1321 | 1321 | if (de->interleave[0]) { |
fs/isofs/isofs.h
... | ... | @@ -35,24 +35,20 @@ |
35 | 35 | unsigned long s_log_zone_size; |
36 | 36 | unsigned long s_max_size; |
37 | 37 | |
38 | - unsigned char s_high_sierra; /* A simple flag */ | |
39 | - unsigned char s_mapping; | |
40 | 38 | int s_rock_offset; /* offset of SUSP fields within SU area */ |
41 | - unsigned char s_rock; | |
42 | 39 | unsigned char s_joliet_level; |
43 | - unsigned char s_utf8; | |
44 | - unsigned char s_cruft; /* Broken disks with high | |
45 | - byte of length containing | |
46 | - junk */ | |
47 | - unsigned char s_unhide; | |
48 | - unsigned char s_nosuid; | |
49 | - unsigned char s_nodev; | |
50 | - unsigned char s_nocompress; | |
51 | - unsigned char s_hide; | |
52 | - unsigned char s_showassoc; | |
53 | - unsigned char s_overriderockperm; | |
54 | - unsigned char s_uid_set; | |
55 | - unsigned char s_gid_set; | |
40 | + unsigned char s_mapping; | |
41 | + unsigned int s_high_sierra:1; | |
42 | + unsigned int s_rock:2; | |
43 | + unsigned int s_utf8:1; | |
44 | + unsigned int s_cruft:1; /* Broken disks with high byte of length | |
45 | + * containing junk */ | |
46 | + unsigned int s_nocompress:1; | |
47 | + unsigned int s_hide:1; | |
48 | + unsigned int s_showassoc:1; | |
49 | + unsigned int s_overriderockperm:1; | |
50 | + unsigned int s_uid_set:1; | |
51 | + unsigned int s_gid_set:1; | |
56 | 52 | |
57 | 53 | mode_t s_fmode; |
58 | 54 | mode_t s_dmode; |
fs/isofs/namei.c
... | ... | @@ -142,9 +142,9 @@ |
142 | 142 | */ |
143 | 143 | match = 0; |
144 | 144 | if (dlen > 0 && |
145 | - (sbi->s_hide =='n' || | |
145 | + (!sbi->s_hide || | |
146 | 146 | (!(de->flags[-sbi->s_high_sierra] & 1))) && |
147 | - (sbi->s_showassoc =='y' || | |
147 | + (sbi->s_showassoc || | |
148 | 148 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { |
149 | 149 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); |
150 | 150 | } |