summaryrefslogtreecommitdiff
path: root/include/uapi/linux/btrfs_tree.h
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2022-10-20 19:58:28 +0300
committerDavid Sterba <dsterba@suse.com>2022-12-05 20:00:43 +0300
commit94a48aef49f235cc1efc74dc18e7708ca3b8d698 (patch)
tree97f42930ae3129faf49614294d19951672a871c0 /include/uapi/linux/btrfs_tree.h
parent6db75318823a169e836a478ca57d6a7c0a156b77 (diff)
downloadlinux-94a48aef49f235cc1efc74dc18e7708ca3b8d698.tar.xz
btrfs: extend btrfs_dir_item type to store encryption status
For directories with encrypted files/filenames, we need to store a flag indicating this fact. There's no room in other fields, so we'll need to borrow a bit from dir_type. Since it's now a combination of type and flags, we rename it to dir_flags to reflect its new usage. The new flag, FT_ENCRYPTED, indicates a directory containing encrypted data, which is orthogonal to file type; therefore, add the new flag, and make conversion from directory type to file type strip the flag. As the file types almost never change we can afford to use the bits. Actual usage will be guarded behind an incompat bit, this patch only adds the support for later use by fscrypt. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/uapi/linux/btrfs_tree.h')
-rw-r--r--include/uapi/linux/btrfs_tree.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 4809272f5063..29895ffa470d 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -376,6 +376,13 @@ enum btrfs_csum_type {
#define BTRFS_FT_SYMLINK 7
#define BTRFS_FT_XATTR 8
#define BTRFS_FT_MAX 9
+/* Directory contains encrypted data */
+#define BTRFS_FT_ENCRYPTED 0x80
+
+static inline __u8 btrfs_dir_flags_to_ftype(__u8 flags)
+{
+ return flags & ~BTRFS_FT_ENCRYPTED;
+}
/*
* Inode flags