LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Mark Fasheh <mfasheh@suse.de> To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, Mark Fasheh <mfasheh@suse.de> Subject: [PATCH 24/76] fs/crypto: Use inode_sb() helper instead of inode->i_sb Date: Tue, 8 May 2018 11:03:44 -0700 [thread overview] Message-ID: <20180508180436.716-25-mfasheh@suse.de> (raw) In-Reply-To: <20180508180436.716-1-mfasheh@suse.de> Signed-off-by: Mark Fasheh <mfasheh@suse.de> --- fs/crypto/bio.c | 10 +++++----- fs/crypto/crypto.c | 4 ++-- fs/crypto/fname.c | 4 ++-- fs/crypto/keyinfo.c | 8 ++++---- fs/crypto/policy.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c index 0d5e6a569d58..0f7daacfa3de 100644 --- a/fs/crypto/bio.c +++ b/fs/crypto/bio.c @@ -92,7 +92,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, struct bio *bio; int ret, err = 0; - BUG_ON(inode->i_sb->s_blocksize != PAGE_SIZE); + BUG_ON(inode_sb(inode)->s_blocksize != PAGE_SIZE); ctx = fscrypt_get_ctx(inode, GFP_NOFS); if (IS_ERR(ctx)) @@ -116,13 +116,13 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, err = -ENOMEM; goto errout; } - bio_set_dev(bio, inode->i_sb->s_bdev); + bio_set_dev(bio, inode_sb(inode)->s_bdev); bio->bi_iter.bi_sector = - pblk << (inode->i_sb->s_blocksize_bits - 9); + pblk << (inode_sb(inode)->s_blocksize_bits - 9); bio_set_op_attrs(bio, REQ_OP_WRITE, 0); ret = bio_add_page(bio, ciphertext_page, - inode->i_sb->s_blocksize, 0); - if (ret != inode->i_sb->s_blocksize) { + inode_sb(inode)->s_blocksize, 0); + if (ret != inode_sb(inode)->s_blocksize) { /* should never happen! */ WARN_ON(1); bio_put(bio); diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index ce654526c0fb..94b88687fe3f 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -240,7 +240,7 @@ struct page *fscrypt_encrypt_page(const struct inode *inode, BUG_ON(len % FS_CRYPTO_BLOCK_SIZE != 0); - if (inode->i_sb->s_cop->flags & FS_CFLG_OWN_PAGES) { + if (inode_sb(inode)->s_cop->flags & FS_CFLG_OWN_PAGES) { /* with inplace-encryption we just encrypt the page */ err = fscrypt_do_page_crypto(inode, FS_ENCRYPT, lblk_num, page, ciphertext_page, len, offs, @@ -299,7 +299,7 @@ EXPORT_SYMBOL(fscrypt_encrypt_page); int fscrypt_decrypt_page(const struct inode *inode, struct page *page, unsigned int len, unsigned int offs, u64 lblk_num) { - if (!(inode->i_sb->s_cop->flags & FS_CFLG_OWN_PAGES)) + if (!(inode_sb(inode)->s_cop->flags & FS_CFLG_OWN_PAGES)) BUG_ON(!PageLocked(page)); return fscrypt_do_page_crypto(inode, FS_DECRYPT, lblk_num, page, page, diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index e33f3d3c5ade..cc0e7632e2d6 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -102,7 +102,7 @@ static int fname_decrypt(struct inode *inode, char iv[FS_CRYPTO_BLOCK_SIZE]; unsigned lim; - lim = inode->i_sb->s_cop->max_namelen(inode); + lim = inode_sb(inode)->s_cop->max_namelen(inode); if (iname->len <= 0 || iname->len > lim) return -EIO; @@ -346,7 +346,7 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, if (dir->i_crypt_info) { if (!fscrypt_fname_encrypted_size(dir, iname->len, - dir->i_sb->s_cop->max_namelen(dir), + inode_sb(dir)->s_cop->max_namelen(dir), &fname->crypto_buf.len)) return -ENAMETOOLONG; fname->crypto_buf.name = kmalloc(fname->crypto_buf.len, diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 05f5ee1f0705..13beafec4355 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -253,11 +253,11 @@ int fscrypt_get_encryption_info(struct inode *inode) if (inode->i_crypt_info) return 0; - res = fscrypt_initialize(inode->i_sb->s_cop->flags); + res = fscrypt_initialize(inode_sb(inode)->s_cop->flags); if (res) return res; - res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); + res = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx)); if (res < 0) { if (!fscrypt_dummy_context_enabled(inode) || IS_ENCRYPTED(inode)) @@ -305,9 +305,9 @@ int fscrypt_get_encryption_info(struct inode *inode) res = validate_user_key(crypt_info, &ctx, raw_key, FS_KEY_DESC_PREFIX, keysize); - if (res && inode->i_sb->s_cop->key_prefix) { + if (res && inode_sb(inode)->s_cop->key_prefix) { int res2 = validate_user_key(crypt_info, &ctx, raw_key, - inode->i_sb->s_cop->key_prefix, + inode_sb(inode)->s_cop->key_prefix, keysize); if (res2) { if (res2 == -ENOKEY) diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index c6d431a5cce9..76d99e0af39a 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -52,7 +52,7 @@ static int create_encryption_context_from_policy(struct inode *inode, BUILD_BUG_ON(sizeof(ctx.nonce) != FS_KEY_DERIVATION_NONCE_SIZE); get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE); - return inode->i_sb->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL); + return inode_sb(inode)->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL); } int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg) @@ -77,11 +77,11 @@ int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg) inode_lock(inode); - ret = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); + ret = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx)); if (ret == -ENODATA) { if (!S_ISDIR(inode->i_mode)) ret = -ENOTDIR; - else if (!inode->i_sb->s_cop->empty_dir(inode)) + else if (!inode_sb(inode)->s_cop->empty_dir(inode)) ret = -ENOTEMPTY; else ret = create_encryption_context_from_policy(inode, @@ -113,7 +113,7 @@ int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg) if (!IS_ENCRYPTED(inode)) return -ENODATA; - res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); + res = inode_sb(inode)->s_cop->get_context(inode, &ctx, sizeof(ctx)); if (res < 0 && res != -ERANGE) return res; if (res != sizeof(ctx)) @@ -156,7 +156,7 @@ EXPORT_SYMBOL(fscrypt_ioctl_get_policy); */ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child) { - const struct fscrypt_operations *cops = parent->i_sb->s_cop; + const struct fscrypt_operations *cops = inode_sb(parent)->s_cop; const struct fscrypt_info *parent_ci, *child_ci; struct fscrypt_context parent_ctx, child_ctx; int res; @@ -258,7 +258,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child, FS_KEY_DESCRIPTOR_SIZE); get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE); BUILD_BUG_ON(sizeof(ctx) != FSCRYPT_SET_CONTEXT_MAX_SIZE); - res = parent->i_sb->s_cop->set_context(child, &ctx, + res = inode_sb(parent)->s_cop->set_context(child, &ctx, sizeof(ctx), fs_data); if (res) return res; -- 2.15.1
next prev parent reply other threads:[~2018-05-08 18:34 UTC|newest] Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-08 18:03 [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Mark Fasheh 2018-05-08 18:03 ` [PATCH 01/76] vfs: Introduce struct fs_view Mark Fasheh 2018-05-08 18:03 ` [PATCH 02/76] arch: Use inode_sb() helper instead of inode->i_sb Mark Fasheh 2018-05-08 18:03 ` [PATCH 03/76] drivers: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 04/76] fs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 05/76] include: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 06/76] ipc: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 07/76] kernel: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 08/76] mm: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 09/76] net: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 10/76] security: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 11/76] fs/9p: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 12/76] fs/adfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 13/76] fs/affs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 14/76] fs/afs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 15/76] fs/autofs4: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 16/76] fs/befs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 17/76] fs/bfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 18/76] fs/btrfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 19/76] fs/ceph: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 20/76] fs/cifs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 21/76] fs/coda: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 22/76] fs/configfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 23/76] fs/cramfs: " Mark Fasheh 2018-05-08 18:03 ` Mark Fasheh [this message] 2018-05-08 18:03 ` [PATCH 25/76] fs/ecryptfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 26/76] fs/efivarfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 27/76] fs/efs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 28/76] fs/exofs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 29/76] fs/exportfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 30/76] fs/ext2: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 31/76] fs/ext4: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 32/76] fs/f2fs: " Mark Fasheh 2018-05-10 10:10 ` Chao Yu 2018-05-08 18:03 ` [PATCH 33/76] fs/fat: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 34/76] fs/freevxfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 35/76] fs/fuse: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 36/76] fs/gfs2: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 37/76] fs/hfs: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 38/76] fs/hfsplus: " Mark Fasheh 2018-05-08 18:03 ` [PATCH 39/76] fs/hostfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 40/76] fs/hpfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 41/76] fs/hugetlbfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 42/76] fs/isofs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 43/76] fs/jbd2: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 44/76] fs/jffs2: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 45/76] fs/jfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 46/76] fs/kernfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 47/76] fs/lockd: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 48/76] fs/minix: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 49/76] fs/nfsd: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 50/76] fs/nfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 51/76] fs/nilfs2: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 52/76] fs/notify: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 53/76] fs/ntfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 54/76] fs/ocfs2: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 55/76] fs/omfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 56/76] fs/openpromfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 57/76] fs/orangefs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 58/76] fs/overlayfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 59/76] fs/proc: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 60/76] fs/qnx4: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 61/76] fs/qnx6: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 62/76] fs/quota: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 63/76] fs/ramfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 64/76] fs/read: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 65/76] fs/reiserfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 66/76] fs/romfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 67/76] fs/squashfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 68/76] fs/sysv: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 69/76] fs/ubifs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 70/76] fs/udf: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 71/76] fs/ufs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 72/76] fs/xfs: " Mark Fasheh 2018-05-08 18:04 ` [PATCH 73/76] vfs: Move s_dev to to struct fs_view Mark Fasheh 2018-05-08 18:04 ` [PATCH 74/76] fs: Use fs_view device from struct inode Mark Fasheh 2018-05-08 18:04 ` [PATCH 75/76] fs: Use fs view device from struct super_block Mark Fasheh 2018-05-08 18:04 ` [PATCH 76/76] btrfs: Use fs_view in roots, point inodes to it Mark Fasheh 2018-05-08 23:38 ` [RFC][PATCH 0/76] vfs: 'views' for filesystems with more than one root Dave Chinner 2018-05-09 2:06 ` Jeff Mahoney 2018-05-09 6:41 ` Dave Chinner 2018-06-05 20:17 ` Jeff Mahoney 2018-06-06 9:49 ` Amir Goldstein 2018-06-06 20:42 ` Mark Fasheh 2018-06-07 6:06 ` Amir Goldstein 2018-06-07 20:44 ` Mark Fasheh 2018-06-06 21:19 ` Jeff Mahoney 2018-06-07 6:17 ` Amir Goldstein
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180508180436.716-25-mfasheh@suse.de \ --to=mfasheh@suse.de \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).