ubifs: Implement encrypted filenames
[linux-2.6-microblaze.git] / fs / ubifs / key.h
index ca4371f..7547be5 100644 (file)
@@ -153,13 +153,13 @@ static inline void highest_ino_key(const struct ubifs_info *c,
  * @c: UBIFS file-system description object
  * @key: key to initialize
  * @inum: parent inode number
- * @nm: direntry name and length
+ * @nm: direntry name and length. Not a string when encrypted!
  */
 static inline void dent_key_init(const struct ubifs_info *c,
                                 union ubifs_key *key, ino_t inum,
-                                const struct qstr *nm)
+                                const struct fscrypt_name *nm)
 {
-       uint32_t hash = c->key_hash(nm->name, nm->len);
+       uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm));
 
        ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
        key->u32[0] = inum;
@@ -191,10 +191,11 @@ static inline void dent_key_init_hash(const struct ubifs_info *c,
  * @nm: direntry name and length
  */
 static inline void dent_key_init_flash(const struct ubifs_info *c, void *k,
-                                      ino_t inum, const struct qstr *nm)
+                                      ino_t inum,
+                                      const struct fscrypt_name *nm)
 {
        union ubifs_key *key = k;
-       uint32_t hash = c->key_hash(nm->name, nm->len);
+       uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm));
 
        ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
        key->j32[0] = cpu_to_le32(inum);
@@ -225,9 +226,9 @@ static inline void lowest_dent_key(const struct ubifs_info *c,
  */
 static inline void xent_key_init(const struct ubifs_info *c,
                                 union ubifs_key *key, ino_t inum,
-                                const struct qstr *nm)
+                                const struct fscrypt_name *nm)
 {
-       uint32_t hash = c->key_hash(nm->name, nm->len);
+       uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm));
 
        ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
        key->u32[0] = inum;
@@ -242,10 +243,10 @@ static inline void xent_key_init(const struct ubifs_info *c,
  * @nm: extended attribute entry name and length
  */
 static inline void xent_key_init_flash(const struct ubifs_info *c, void *k,
-                                      ino_t inum, const struct qstr *nm)
+                                      ino_t inum, const struct fscrypt_name *nm)
 {
        union ubifs_key *key = k;
-       uint32_t hash = c->key_hash(nm->name, nm->len);
+       uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm));
 
        ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
        key->j32[0] = cpu_to_le32(inum);