Skip to content

fscrypt: add some higher-level helper functions

Eric Biggers linux-ext4 linux-f2fs-devel linux-fscrypt linux-fsdevel linux-mtd 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 1 replyIn review
  2. v125 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Added Dave Chinner's patch to make fscrypt.h include fscrypt_supp.h or fscrypt_notsupp.h, then reorganized the helpers so that most are defined in fscrypt.h.
- As noted above, for now omitted the patches to switch the individual filesystems over to the new helpers.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11fscrypt: clean up include file messfs/crypto/fscrypt_private.h fs/ext4/ext4.h fs/f2fs/f2fs.h +4 more+49 -340 replies
2/11fs, fscrypt: add an S_ENCRYPTED inode flagfs/ext4/inode.c fs/ext4/super.c fs/f2fs/f2fs.h +4 more+23 -60 replies
3/11fscrypt: switch from ->is_encrypted() to IS_ENCRYPTED()fs/crypto/crypto.c fs/crypto/fname.c fs/crypto/keyinfo.c +2 more+7 -80 replies
4/11fscrypt: remove ->is_encrypted()fs/ext4/super.c fs/f2fs/super.c fs/ubifs/crypto.c +3 more+2 -140 replies
5/11fscrypt: remove unneeded empty fscrypt_operations structsfs/ext4/super.c fs/f2fs/super.c fs/ubifs/super.c+6 -110 replies
6/11fscrypt: new helper function - fscrypt_require_key()include/linux/fscrypt.h+25 -00 replies
7/11fscrypt: new helper function - fscrypt_file_open()fs/crypto/Makefile fs/crypto/hooks.c include/linux/fscrypt_notsupp.h +1 more+62 -10 replies
8/11fscrypt: new helper function - fscrypt_prepare_link()fs/crypto/hooks.c include/linux/fscrypt.h include/linux/fscrypt_notsupp.h +1 more+49 -00 replies
9/11fscrypt: new helper function - fscrypt_prepare_rename()fs/crypto/hooks.c include/linux/fscrypt.h include/linux/fscrypt_notsupp.h +1 more+77 -00 replies
10/11fscrypt: new helper function - fscrypt_prepare_lookup()fs/crypto/hooks.c include/linux/fscrypt.h include/linux/fscrypt_notsupp.h +1 more+53 -00 replies
11/11fscrypt: new helper function - fscrypt_prepare_setattr()include/linux/fscrypt.h+25 -00 replies

Reviews trailers per patch

10 of 11 patches have a Reviewed-by or Acked-by.

PatchChao YuDave Chinner
1/11
2/11R-b A-b
3/11A-b
4/11R-b A-b
5/11R-b A-b
6/11A-b
7/11A-b
8/11A-b
9/11A-b
10/11A-b
11/11A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] fscrypt: add some higher-level helper functions

From: Eric Biggers <[email protected]>

This series prepares to reduce code duplication among ext4, f2fs, and ubifs by introducing a S_ENCRYPTED inode flag (so we don't have to call back into the filesystem to test the filesystem-specific inode flag), then introducing new helper functions that are called at the beginning of the open, link, rename, lookup, and setattr operations.

In the future we maybe should even call these new helpers from the VFS so that each individual filesystem doesn't have to do it. But that's not possible currently because fs/crypto/ can be built as a module.

The patches to switch the filesystems over to use the helper functions were included in v1 of this patchset. They are not included now since I'm planning to get them picked up by the individual filesystem maintainers after this goes in.

Changes since v1:
- Added Dave Chinner's patch to make fscrypt.h include fscrypt_supp.h or fscrypt_notsupp.h, then reorganized the helpers so that most are defined in fscrypt.h.
- As noted above, for now omitted the patches to switch the individual filesystems over to the new helpers.

Dave Chinner (1):
fscrypt: clean up include file mess

Eric Biggers (10):
fs, fscrypt: add an S_ENCRYPTED inode flag
fscrypt: switch from ->is_encrypted() to IS_ENCRYPTED()
fscrypt: remove ->is_encrypted()
fscrypt: remove unneeded empty fscrypt_operations structs
fscrypt: new helper function - fscrypt_require_key()
fscrypt: new helper function - fscrypt_file_open()
fscrypt: new helper function - fscrypt_prepare_link()
fscrypt: new helper function - fscrypt_prepare_rename()
fscrypt: new helper function - fscrypt_prepare_lookup()
fscrypt: new helper function - fscrypt_prepare_setattr()

 fs/crypto/Makefile              |   2 +-
 fs/crypto/crypto.c              |   2 +-
 fs/crypto/fname.c               |   3 +-
 fs/crypto/fscrypt_private.h     |   3 +-
 fs/crypto/hooks.c               | 112 +++++++++++++++
 fs/crypto/keyinfo.c             |   2 +-
 fs/crypto/policy.c              |   6 +-
 fs/ext4/ext4.h                  |   8 +-
 fs/ext4/inode.c                 |   7 +-
 fs/ext4/super.c                 |  15 +-
 fs/f2fs/f2fs.h                  |   9 +-
 fs/f2fs/inode.c                 |   5 +-
 fs/f2fs/super.c                 |   7 +-
 fs/ubifs/crypto.c               |   1 -
 fs/ubifs/ioctl.c                |   5 +-
 fs/ubifs/super.c                |   8 +-
 fs/ubifs/ubifs.h                |  18 +--
 fs/ubifs/xattr.c                |   1 +
 include/linux/fs.h              |   2 +
 include/linux/fscrypt.h         | 293 ++++++++++++++++++++++++++++++++++++++++
 include/linux/fscrypt_common.h  | 141 -------------------
 include/linux/fscrypt_notsupp.h |  39 +++++-
 include/linux/fscrypt_supp.h    |  17 ++-
 23 files changed, 505 insertions(+), 201 deletions(-)
 create mode 100644 fs/crypto/hooks.c
 create mode 100644 include/linux/fscrypt.h
 delete mode 100644 include/linux/fscrypt_common.h
Signature · 1 line
2.14.2.920.gcf0c67979c-goog