Revert "endian: #define __BYTE_ORDER"
[safe/jmp/linux-2.6] / include / linux / jffs2.h
index acb51a3..0874ab5 100644 (file)
@@ -5,22 +5,20 @@
  *
  * Created by David Woodhouse <dwmw2@infradead.org>
  *
- * For licensing information, see the file 'LICENCE' in the 
+ * For licensing information, see the file 'LICENCE' in the
  * jffs2 directory.
- *
- * $Id: jffs2.h,v 1.37 2005/09/07 08:34:55 havasi Exp $
- *
  */
 
 #ifndef __LINUX_JFFS2_H__
 #define __LINUX_JFFS2_H__
 
+#include <linux/types.h>
+#include <linux/magic.h>
+
 /* You must include something which defines the C99 uintXX_t types. 
    We don't do it from here because this file is used in too many
    different environments. */
 
-#define JFFS2_SUPER_MAGIC 0x72b6
-
 /* Values we may expect to find in the 'magic' field */
 #define JFFS2_OLD_MAGIC_BITMASK 0x1984
 #define JFFS2_MAGIC_BITMASK 0x1985
@@ -46,6 +44,7 @@
 #define JFFS2_COMPR_COPY       0x04
 #define JFFS2_COMPR_DYNRUBIN   0x05
 #define JFFS2_COMPR_ZLIB       0x06
+#define JFFS2_COMPR_LZO                0x07
 /* Compatibility flags. */
 #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
 #define JFFS2_NODE_ACCURATE 0x2000
 
 #define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6)
 
+#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8)
+#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9)
+
+/* XATTR Related */
+#define JFFS2_XPREFIX_USER             1       /* for "user." */
+#define JFFS2_XPREFIX_SECURITY         2       /* for "security." */
+#define JFFS2_XPREFIX_ACL_ACCESS       3       /* for "system.posix_acl_access" */
+#define JFFS2_XPREFIX_ACL_DEFAULT      4       /* for "system.posix_acl_default" */
+#define JFFS2_XPREFIX_TRUSTED          5       /* for "trusted.*" */
+
+#define JFFS2_ACL_VERSION              0x0001
+
 // Maybe later...
 //#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
 //#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4)
 
 
-#define JFFS2_INO_FLAG_PREREAD   1     /* Do read_inode() for this one at 
-                                          mount time, don't wait for it to 
+#define JFFS2_INO_FLAG_PREREAD   1     /* Do read_inode() for this one at
+                                          mount time, don't wait for it to
                                           happen later */
-#define JFFS2_INO_FLAG_USERCOMPR  2    /* User has requested a specific 
+#define JFFS2_INO_FLAG_USERCOMPR  2    /* User has requested a specific
                                           compression type */
 
 
    byteswapping */
 
 typedef struct {
-       uint32_t v32;
-} __attribute__((packed))  jint32_t;
+       __u32 v32;
+} __attribute__((packed)) jint32_t;
 
 typedef struct {
-       uint32_t m;
-} __attribute__((packed))  jmode_t;
+       __u32 m;
+} __attribute__((packed)) jmode_t;
 
 typedef struct {
-       uint16_t v16;
+       __u16 v16;
 } __attribute__((packed)) jint16_t;
 
 struct jffs2_unknown_node
@@ -99,7 +110,7 @@ struct jffs2_unknown_node
        jint16_t nodetype;
        jint32_t totlen; /* So we can skip over nodes we don't grok */
        jint32_t hdr_crc;
-} __attribute__((packed));
+};
 
 struct jffs2_raw_dirent
 {
@@ -111,16 +122,16 @@ struct jffs2_raw_dirent
        jint32_t version;
        jint32_t ino; /* == zero for unlink */
        jint32_t mctime;
-       uint8_t nsize;
-       uint8_t type;
-       uint8_t unused[2];
+       __u8 nsize;
+       __u8 type;
+       __u8 unused[2];
        jint32_t node_crc;
        jint32_t name_crc;
-       uint8_t name[0];
-} __attribute__((packed));
+       __u8 name[0];
+};
 
 /* The JFFS2 raw inode structure: Used for storage on physical media.  */
-/* The uid, gid, atime, mtime and ctime members could be longer, but 
+/* The uid, gid, atime, mtime and ctime members could be longer, but
    are left like this for space efficiency. If and when people decide
    they really need them extended, it's simple enough to add support for
    a new type of raw node.
@@ -143,17 +154,45 @@ struct jffs2_raw_inode
        jint32_t offset;     /* Where to begin to write.  */
        jint32_t csize;      /* (Compressed) data size */
        jint32_t dsize;      /* Size of the node's data. (after decompression) */
-       uint8_t compr;       /* Compression algorithm used */
-       uint8_t usercompr;   /* Compression algorithm requested by the user */
+       __u8 compr;       /* Compression algorithm used */
+       __u8 usercompr;   /* Compression algorithm requested by the user */
        jint16_t flags;      /* See JFFS2_INO_FLAG_* */
        jint32_t data_crc;   /* CRC for the (compressed) data.  */
        jint32_t node_crc;   /* CRC for the raw inode (excluding data)  */
-       uint8_t data[0];
+       __u8 data[0];
+};
+
+struct jffs2_raw_xattr {
+       jint16_t magic;
+       jint16_t nodetype;      /* = JFFS2_NODETYPE_XATTR */
+       jint32_t totlen;
+       jint32_t hdr_crc;
+       jint32_t xid;           /* XATTR identifier number */
+       jint32_t version;
+       __u8 xprefix;
+       __u8 name_len;
+       jint16_t value_len;
+       jint32_t data_crc;
+       jint32_t node_crc;
+       __u8 data[0];
 } __attribute__((packed));
 
-struct jffs2_summary_node{
+struct jffs2_raw_xref
+{
        jint16_t magic;
-       jint16_t nodetype;      /* = JFFS2_NODETYPE_INODE_SUM */
+       jint16_t nodetype;      /* = JFFS2_NODETYPE_XREF */
+       jint32_t totlen;
+       jint32_t hdr_crc;
+       jint32_t ino;           /* inode number */
+       jint32_t xid;           /* XATTR identifier number */
+       jint32_t xseqno;        /* xref sequencial number */
+       jint32_t node_crc;
+} __attribute__((packed));
+
+struct jffs2_raw_summary
+{
+       jint16_t magic;
+       jint16_t nodetype;      /* = JFFS2_NODETYPE_SUMMARY */
        jint32_t totlen;
        jint32_t hdr_crc;
        jint32_t sum_num;       /* number of sum entries*/
@@ -162,13 +201,22 @@ struct jffs2_summary_node{
        jint32_t sum_crc;       /* summary information crc */
        jint32_t node_crc;      /* node crc */
        jint32_t sum[0];        /* inode summary info */
-} __attribute__((packed));
+};
 
-union jffs2_node_union {
+union jffs2_node_union
+{
        struct jffs2_raw_inode i;
        struct jffs2_raw_dirent d;
+       struct jffs2_raw_xattr x;
+       struct jffs2_raw_xref r;
+       struct jffs2_raw_summary s;
        struct jffs2_unknown_node u;
-       struct jffs2_summary_node s;
+};
+
+/* Data payload for device nodes. */
+union jffs2_device_node {
+       jint16_t old_id;
+       jint32_t new_id;
 };
 
 #endif /* __LINUX_JFFS2_H__ */