diff options
author | Steven J. Magnani <steve@digidescorp.com> | 2012-07-30 14:42:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 17:25:19 -0700 |
commit | a943ed71c9171fb5e3b256e8022bbedff95cc826 (patch) | |
tree | e4b3a997bac0a802677557dbc52e5a55fb526a28 /fs/fat/fat.h | |
parent | 497d48bd27ec1c44b4600e8e98a776188f2e11f2 (diff) | |
download | linux-rpi3-a943ed71c9171fb5e3b256e8022bbedff95cc826.tar.gz linux-rpi3-a943ed71c9171fb5e3b256e8022bbedff95cc826.tar.bz2 linux-rpi3-a943ed71c9171fb5e3b256e8022bbedff95cc826.zip |
fat: accessors for msdos_dir_entry 'start' fields
Simplify code by providing accessor functions for the directory entry
start cluster fields.
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/fat.h')
-rw-r--r-- | fs/fat/fat.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index fc35c5c69136..2deeeb86f331 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -217,6 +217,21 @@ static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len) #endif } +static inline int fat_get_start(const struct msdos_sb_info *sbi, + const struct msdos_dir_entry *de) +{ + int cluster = le16_to_cpu(de->start); + if (sbi->fat_bits == 32) + cluster |= (le16_to_cpu(de->starthi) << 16); + return cluster; +} + +static inline void fat_set_start(struct msdos_dir_entry *de, int cluster) +{ + de->start = cpu_to_le16(cluster); + de->starthi = cpu_to_le16(cluster >> 16); +} + static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len) { #ifdef __BIG_ENDIAN |