ubifs: Add full hash lookup support
[linux-2.6-block.git] / fs / ubifs / ubifs-media.h
index e24380cf46ed4b0506dcc2f2e9258f04e4367a28..249124d9a801c91a533c6c35c106321f4a0bc83d 100644 (file)
@@ -300,6 +300,13 @@ enum {
 /* The largest UBIFS node */
 #define UBIFS_MAX_NODE_SZ UBIFS_MAX_INO_NODE_SZ
 
+/*
+ * xattr name of UBIFS encryption context, we don't use a prefix
+ * nor a long name to not waste space on the flash.
+ */
+#define UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT "c"
+
+
 /*
  * On-flash inode flags.
  *
@@ -309,6 +316,7 @@ enum {
  * UBIFS_APPEND_FL: writes to the inode may only append data
  * UBIFS_DIRSYNC_FL: I/O on this directory inode has to be synchronous
  * UBIFS_XATTR_FL: this inode is the inode for an extended attribute value
+ * UBIFS_CRYPT_FL: use encryption for this inode
  *
  * Note, these are on-flash flags which correspond to ioctl flags
  * (@FS_COMPR_FL, etc). They have the same values now, but generally, do not
@@ -321,6 +329,7 @@ enum {
        UBIFS_APPEND_FL    = 0x08,
        UBIFS_DIRSYNC_FL   = 0x10,
        UBIFS_XATTR_FL     = 0x20,
+       UBIFS_CRYPT_FL     = 0x40,
 };
 
 /* Inode flag bits used by UBIFS */
@@ -521,7 +530,8 @@ struct ubifs_ino_node {
  * @padding1: reserved for future, zeroes
  * @type: type of the target inode (%UBIFS_ITYPE_REG, %UBIFS_ITYPE_DIR, etc)
  * @nlen: name length
- * @padding2: reserved for future, zeroes
+ * @cookie: A 32bits random number, used to construct a 64bits
+ *          identifier.
  * @name: zero-terminated name
  *
  * Note, do not forget to amend 'zero_dent_node_unused()' function when
@@ -534,7 +544,7 @@ struct ubifs_dent_node {
        __u8 padding1;
        __u8 type;
        __le16 nlen;
-       __u8 padding2[4]; /* Watch 'zero_dent_node_unused()' if changing! */
+       __le32 cookie;
        __u8 name[];
 } __packed;
 
@@ -544,18 +554,16 @@ struct ubifs_dent_node {
  * @key: node key
  * @size: uncompressed data size in bytes
  * @compr_type: compression type (%UBIFS_COMPR_NONE, %UBIFS_COMPR_LZO, etc)
- * @padding: reserved for future, zeroes
+ * @compr_size: compressed data size in bytes, only valid when data is encrypted
  * @data: data
  *
- * Note, do not forget to amend 'zero_data_node_unused()' function when
- * changing the padding fields.
  */
 struct ubifs_data_node {
        struct ubifs_ch ch;
        __u8 key[UBIFS_MAX_KEY_LEN];
        __le32 size;
        __le16 compr_type;
-       __u8 padding[2]; /* Watch 'zero_data_node_unused()' if changing! */
+       __le16 compr_size;
        __u8 data[];
 } __packed;