summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/key.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-11-12 10:31:27 +0100
committerRichard Weinberger <richard@nod.at>2015-11-12 10:50:04 +0100
commit50044efbd6e713e86f705a60eddab0c034dffeba (patch)
treeab36a5fda13e1bae857a7b1f6b2ab37127a4cdf8 /ubifs-utils/mkfs.ubifs/key.h
parent978494f76e110154a3035cb1cdbe92965c5552ce (diff)
mkfs.ubifs: Add extended attribute support
This adds extended attribute support to mkfs.ubifs. When creating an image from a directory tree the existing extended attributes are added to the UBIFS image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/key.h')
-rw-r--r--ubifs-utils/mkfs.ubifs/key.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/ubifs-utils/mkfs.ubifs/key.h b/ubifs-utils/mkfs.ubifs/key.h
index d3a02d4..39379fd 100644
--- a/ubifs-utils/mkfs.ubifs/key.h
+++ b/ubifs-utils/mkfs.ubifs/key.h
@@ -119,6 +119,24 @@ static inline void dent_key_init(const struct ubifs_info *c,
}
/**
+ * xent_key_init - initialize extended attribute entry key.
+ * @c: UBIFS file-system description object
+ * @key: key to initialize
+ * @inum: host inode number
+ * @nm: extended attribute entry name and length
+ */
+static inline void xent_key_init(const struct ubifs_info *c,
+ union ubifs_key *key, ino_t inum,
+ const struct qstr *nm)
+{
+ uint32_t hash = c->key_hash(nm->name, nm->len);
+
+ ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
+ key->u32[0] = inum;
+ key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS);
+}
+
+/**
* data_key_init - initialize data key.
* @c: UBIFS file-system description object
* @key: key to initialize