]> err.no Git - linux-2.6/blobdiff - include/linux/ext3_fs.h
[ARM] 4653/1: pxa: fix a gpio typo in mfp-pxa320.h
[linux-2.6] / include / linux / ext3_fs.h
index 64134456ed8cf33782e3d4a83757f4c46515f644..241c01cb92b24e64027c11341475c030a2a825d3 100644 (file)
@@ -656,6 +656,26 @@ struct ext3_dir_entry_2 {
 #define EXT3_DIR_ROUND                 (EXT3_DIR_PAD - 1)
 #define EXT3_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT3_DIR_ROUND) & \
                                         ~EXT3_DIR_ROUND)
+#define EXT3_MAX_REC_LEN               ((1<<16)-1)
+
+static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
+{
+       unsigned len = le16_to_cpu(dlen);
+
+       if (len == EXT3_MAX_REC_LEN)
+               return 1 << 16;
+       return len;
+}
+
+static inline __le16 ext3_rec_len_to_disk(unsigned len)
+{
+       if (len == (1 << 16))
+               return cpu_to_le16(EXT3_MAX_REC_LEN);
+       else if (len > (1 << 16))
+               BUG();
+       return cpu_to_le16(len);
+}
+
 /*
  * Hash Tree Directory indexing
  * (c) Daniel Phillips, 2001