mtd/include/linux jffs2.h,1.27,1.28

David Woodhouse dwmw2 at infradead.org
Tue Jan 21 18:58:33 EST 2003


Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv11196

Modified Files:
	jffs2.h 
Log Message:
separate type for mode, to enforce os-fixing

Index: jffs2.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/jffs2.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- jffs2.h	12 Jan 2003 13:21:29 -0000	1.27
+++ jffs2.h	21 Jan 2003 23:58:31 -0000	1.28
@@ -80,29 +80,42 @@
 } __attribute__((packed))  jint32_t;
 
 typedef struct {
+	uint32_t m;
+} __attribute__((packed))  jmode_t;
+
+typedef struct {
 	uint16_t v16;
 } __attribute__((packed)) jint16_t;
 
 #define JFFS2_NATIVE_ENDIAN
 
+/* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from
+   whatever OS we're actually running on here too. */
+
 #if defined(JFFS2_NATIVE_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){x})
 #define cpu_to_je32(x) ((jint32_t){x})
+#define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)})
 
 #define je16_to_cpu(x) ((x).v16)
 #define je32_to_cpu(x) ((x).v32)
+#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m))
 #elif defined(JFFS2_BIG_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)})
 #define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)})
+#define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))})
 
 #define je16_to_cpu(x) (be16_to_cpu(x.v16))
 #define je32_to_cpu(x) (be32_to_cpu(x.v32))
+#define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m)))
 #elif defined(JFFS2_LITTLE_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)})
 #define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
+#define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))})
 
 #define je16_to_cpu(x) (le16_to_cpu(x.v16))
 #define je32_to_cpu(x) (le32_to_cpu(x.v32))
+#define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m)))
 #else 
 #error wibble
 #endif
@@ -148,7 +161,7 @@
 	jint32_t hdr_crc;
 	jint32_t ino;        /* Inode number.  */
 	jint32_t version;    /* Version number.  */
-	jint32_t mode;       /* The file's type or mode.  */
+	jmode_t mode;       /* The file's type or mode.  */
 	jint16_t uid;        /* The file's owner.  */
 	jint16_t gid;        /* The file's group.  */
 	jint32_t isize;      /* Total resultant size of this inode (used for truncations)  */





More information about the linux-mtd-cvs mailing list