summaryrefslogtreecommitdiffstats
path: root/fs/fat/fat.h
diff options
context:
space:
mode:
authorSteven J. Magnani2012-07-30 23:42:13 +0200
committerLinus Torvalds2012-07-31 02:25:19 +0200
commita943ed71c9171fb5e3b256e8022bbedff95cc826 (patch)
treee4b3a997bac0a802677557dbc52e5a55fb526a28 /fs/fat/fat.h
parenthfsplus: use -ENOMEM when kzalloc() fails (diff)
downloadkernel-qcow2-linux-a943ed71c9171fb5e3b256e8022bbedff95cc826.tar.gz
kernel-qcow2-linux-a943ed71c9171fb5e3b256e8022bbedff95cc826.tar.xz
kernel-qcow2-linux-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.h15
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