diff options
Diffstat (limited to 'fs/fat/fat.h')
-rw-r--r-- | fs/fat/fat.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 2b8e94c3eef4..3b4753a024e3 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -117,14 +117,32 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) | |||
117 | return container_of(inode, struct msdos_inode_info, vfs_inode); | 117 | return container_of(inode, struct msdos_inode_info, vfs_inode); |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Convert attribute bits and a mask to the UNIX mode. */ | ||
121 | static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, | ||
122 | u8 attrs, mode_t mode) | ||
123 | { | ||
124 | if (attrs & ATTR_RO) | ||
125 | mode &= ~S_IWUGO; | ||
126 | |||
127 | if (attrs & ATTR_DIR) | ||
128 | return (mode & ~sbi->options.fs_dmask) | S_IFDIR; | ||
129 | else | ||
130 | return (mode & ~sbi->options.fs_fmask) | S_IFREG; | ||
131 | } | ||
132 | |||
120 | /* Return the FAT attribute byte for this inode */ | 133 | /* Return the FAT attribute byte for this inode */ |
121 | static inline u8 fat_attr(struct inode *inode) | 134 | static inline u8 fat_make_attrs(struct inode *inode) |
122 | { | 135 | { |
123 | return ((inode->i_mode & S_IWUGO) ? ATTR_NONE : ATTR_RO) | | 136 | return ((inode->i_mode & S_IWUGO) ? ATTR_NONE : ATTR_RO) | |
124 | (S_ISDIR(inode->i_mode) ? ATTR_DIR : ATTR_NONE) | | 137 | (S_ISDIR(inode->i_mode) ? ATTR_DIR : ATTR_NONE) | |
125 | MSDOS_I(inode)->i_attrs; | 138 | MSDOS_I(inode)->i_attrs; |
126 | } | 139 | } |
127 | 140 | ||
141 | static inline void fat_save_attrs(struct inode *inode, u8 attrs) | ||
142 | { | ||
143 | MSDOS_I(inode)->i_attrs = attrs & ATTR_UNUSED; | ||
144 | } | ||
145 | |||
128 | static inline unsigned char fat_checksum(const __u8 *name) | 146 | static inline unsigned char fat_checksum(const __u8 *name) |
129 | { | 147 | { |
130 | unsigned char s = name[0]; | 148 | unsigned char s = name[0]; |