Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[sfrench/cifs-2.6.git] / include / linux / jffs2.h
index 419fc953ac16ee0d52e67ebaa258efd578bfb7b9..c9c760700bc3415046d6243a0b7143d1ec173b5c 100644 (file)
@@ -5,10 +5,10 @@
  *
  * 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.34 2004/11/16 20:36:14 dwmw2 Exp $
+ * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $
  *
  */
 
@@ -28,6 +28,9 @@
 #define JFFS2_EMPTY_BITMASK 0xffff
 #define JFFS2_DIRTY_BITMASK 0x0000
 
+/* Summary node MAGIC marker */
+#define JFFS2_SUM_MAGIC        0x02851885
+
 /* We only allow a single char for length, and 0xFF is empty flash so
    we don't want it confused with a real length. Hence max 254.
 */
@@ -43,8 +46,6 @@
 #define JFFS2_COMPR_COPY       0x04
 #define JFFS2_COMPR_DYNRUBIN   0x05
 #define JFFS2_COMPR_ZLIB       0x06
-#define JFFS2_COMPR_LZO         0x07
-#define JFFS2_COMPR_LZARI       0x08
 /* Compatibility flags. */
 #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
 #define JFFS2_NODE_ACCURATE 0x2000
 #define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
 #define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4)
 
+#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 */
 
 
 
 typedef struct {
        uint32_t v32;
-} __attribute__((packed))  jint32_t;
+} __attribute__((packed)) jint32_t;
 
 typedef struct {
        uint32_t m;
-} __attribute__((packed))  jmode_t;
+} __attribute__((packed)) jmode_t;
 
 typedef struct {
        uint16_t v16;
@@ -96,12 +111,12 @@ 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
 {
        jint16_t magic;
-       jint16_t nodetype;      /* == JFFS_NODETYPE_DIRENT */
+       jint16_t nodetype;      /* == JFFS2_NODETYPE_DIRENT */
        jint32_t totlen;
        jint32_t hdr_crc;
        jint32_t pino;
@@ -114,10 +129,10 @@ struct jffs2_raw_dirent
        jint32_t node_crc;
        jint32_t name_crc;
        uint8_t name[0];
-} __attribute__((packed));
+};
 
 /* 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.
@@ -125,7 +140,7 @@ struct jffs2_raw_dirent
 struct jffs2_raw_inode
 {
        jint16_t magic;      /* A constant magic number.  */
-       jint16_t nodetype;   /* == JFFS_NODETYPE_INODE */
+       jint16_t nodetype;   /* == JFFS2_NODETYPE_INODE */
        jint32_t totlen;     /* Total length of this node (inc data, etc.) */
        jint32_t hdr_crc;
        jint32_t ino;        /* Inode number.  */
@@ -146,12 +161,63 @@ struct jffs2_raw_inode
        jint32_t data_crc;   /* CRC for the (compressed) data.  */
        jint32_t node_crc;   /* CRC for the raw inode (excluding data)  */
        uint8_t 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;
+       uint8_t xprefix;
+       uint8_t name_len;
+       jint16_t value_len;
+       jint32_t data_crc;
+       jint32_t node_crc;
+       uint8_t data[0];
 } __attribute__((packed));
 
-union jffs2_node_union {
+struct jffs2_raw_xref
+{
+       jint16_t magic;
+       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*/
+       jint32_t cln_mkr;       /* clean marker size, 0 = no cleanmarker */
+       jint32_t padded;        /* sum of the size of padding nodes */
+       jint32_t sum_crc;       /* summary information crc */
+       jint32_t node_crc;      /* node crc */
+       jint32_t sum[0];        /* inode summary info */
+};
+
+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;
 };
 
+/* Data payload for device nodes. */
+union jffs2_device_node {
+       jint16_t old;
+       jint32_t new;
+};
+
 #endif /* __LINUX_JFFS2_H__ */