diff options
Diffstat (limited to 'fs/fat/fat.h')
-rw-r--r-- | fs/fat/fat.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 313b645b8126..e9dce5d8e7a7 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -38,7 +38,8 @@ struct fat_mount_options { | |||
38 | flush:1, /* write things quickly */ | 38 | flush:1, /* write things quickly */ |
39 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ | 39 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ |
40 | usefree:1, /* Use free_clusters for FAT32 */ | 40 | usefree:1, /* Use free_clusters for FAT32 */ |
41 | tz_utc:1; /* Filesystem timestamps are in UTC */ | 41 | tz_utc:1, /* Filesystem timestamps are in UTC */ |
42 | rodir:1; /* allow ATTR_RO for directory */ | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define FAT_HASH_BITS 8 | 45 | #define FAT_HASH_BITS 8 |
@@ -120,15 +121,20 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) | |||
120 | /* | 121 | /* |
121 | * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to | 122 | * If ->i_mode can't hold S_IWUGO (i.e. ATTR_RO), we use ->i_attrs to |
122 | * save ATTR_RO instead of ->i_mode. | 123 | * save ATTR_RO instead of ->i_mode. |
124 | * | ||
125 | * If it's directory and !sbi->options.rodir, ATTR_RO isn't read-only | ||
126 | * bit, it's just used as flag for app. | ||
123 | */ | 127 | */ |
124 | static inline int fat_mode_can_hold_ro(struct inode *inode) | 128 | static inline int fat_mode_can_hold_ro(struct inode *inode) |
125 | { | 129 | { |
126 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 130 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
127 | mode_t mask; | 131 | mode_t mask; |
128 | 132 | ||
129 | if (S_ISDIR(inode->i_mode)) | 133 | if (S_ISDIR(inode->i_mode)) { |
134 | if (!sbi->options.rodir) | ||
135 | return 0; | ||
130 | mask = ~sbi->options.fs_dmask; | 136 | mask = ~sbi->options.fs_dmask; |
131 | else | 137 | } else |
132 | mask = ~sbi->options.fs_fmask; | 138 | mask = ~sbi->options.fs_fmask; |
133 | 139 | ||
134 | if (!(mask & S_IWUGO)) | 140 | if (!(mask & S_IWUGO)) |
@@ -140,7 +146,7 @@ static inline int fat_mode_can_hold_ro(struct inode *inode) | |||
140 | static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, | 146 | static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, |
141 | u8 attrs, mode_t mode) | 147 | u8 attrs, mode_t mode) |
142 | { | 148 | { |
143 | if (attrs & ATTR_RO) | 149 | if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) |
144 | mode &= ~S_IWUGO; | 150 | mode &= ~S_IWUGO; |
145 | 151 | ||
146 | if (attrs & ATTR_DIR) | 152 | if (attrs & ATTR_DIR) |