From patchwork Thu Aug 20 18:19:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Gr=C3=BCnbacher?= X-Patchwork-Id: 7046481 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC053C05AC for ; Thu, 20 Aug 2015 18:24:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EAC42044C for ; Thu, 20 Aug 2015 18:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85E8C205C1 for ; Thu, 20 Aug 2015 18:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484AbbHTSXx (ORCPT ); Thu, 20 Aug 2015 14:23:53 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37797 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbbHTSXw (ORCPT ); Thu, 20 Aug 2015 14:23:52 -0400 Received: by widdq5 with SMTP id dq5so13424764wid.0; Thu, 20 Aug 2015 11:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bMYA+QnzK08fPrcaxKe3fX6QBpY+uciJnpUqAXAM+BM=; b=Zp1fV6oq37hq447FBxNmi6pZnKQrocj3d+wtctikjmWGC1n8zUKTmooLWDRqS89ZSG NUAmvx1l/Bj2SumOstBW0mTvEQVAGIYjCGPEptCSD/E7M2X5KwlYvUIlBTmWBfXyiAZm DbtZj25Yo1Cy6UzLAd5+53HxFMXWEvnHqWjekaF8hrDIJrLiCbYORI0sp1SmyPGJ2ds9 MzMP4AWBfLUgCj3QJEQcvslPMsMkqEI1UXDAWyxc2A9+QiBISq1fZrmHLx6qoT0/OEZd iZ+xgFYHHjXWXas0KuYNrDDheT5D/TlQV7nCrlwd70YjN34bNKKps5wl2QyV1I6B5trS Yenw== X-Received: by 10.180.98.134 with SMTP id ei6mr63837018wib.49.1440095030114; Thu, 20 Aug 2015 11:23:50 -0700 (PDT) Received: from nuc.home.com (p549817FE.dip0.t-ipconnect.de. [84.152.23.254]) by smtp.gmail.com with ESMTPSA id ma4sm6598334wjb.38.2015.08.20.11.23.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2015 11:23:48 -0700 (PDT) From: Andreas Gruenbacher X-Google-Original-From: Andreas Gruenbacher To: Alexander Viro , Christoph Hellwig , Eric Paris , "Aneesh Kumar K.V" , linux-fsdevel@vger.kernel.org, David Quigley , "J. Bruce Fields" Cc: linux-security-module@vger.kernel.org, cluster-devel@redhat.com Subject: [RFC 08/11] xattr: Pass inodes to xattr handlers instead of dentries Date: Thu, 20 Aug 2015 20:19:55 +0200 Message-Id: <1440094798-1411-9-git-send-email-agruenba@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1440094798-1411-1-git-send-email-agruenba@redhat.com> References: <1440094798-1411-1-git-send-email-agruenba@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All remaining file systems that use the generic xattr_handler infrastructure only access dentry->d_inode and do nothing else with the dentry, so pass down the inode instead of the dentry to the xattr_handler operations. Signed-off-by: Andreas Gruenbacher --- fs/ext2/xattr.c | 2 +- fs/ext2/xattr_security.c | 10 +++++----- fs/ext2/xattr_trusted.c | 10 +++++----- fs/ext2/xattr_user.c | 16 ++++++++-------- fs/ext3/xattr.c | 3 ++- fs/ext3/xattr_security.c | 10 +++++----- fs/ext3/xattr_trusted.c | 10 +++++----- fs/ext3/xattr_user.c | 16 ++++++++-------- fs/ext4/xattr.c | 3 ++- fs/ext4/xattr_security.c | 10 +++++----- fs/ext4/xattr_trusted.c | 10 +++++----- fs/ext4/xattr_user.c | 16 ++++++++-------- fs/f2fs/xattr.c | 31 +++++++++++++------------------ fs/gfs2/xattr.c | 8 ++++---- fs/hfsplus/xattr.c | 16 ++++++++-------- fs/hfsplus/xattr.h | 4 ++-- fs/hfsplus/xattr_security.c | 8 ++++---- fs/hfsplus/xattr_trusted.c | 8 ++++---- fs/hfsplus/xattr_user.c | 8 ++++---- fs/jffs2/security.c | 10 +++++----- fs/jffs2/xattr.c | 4 ++-- fs/jffs2/xattr_trusted.c | 10 +++++----- fs/jffs2/xattr_user.c | 10 +++++----- fs/nfs/nfs4proc.c | 31 +++++++++++++++---------------- fs/ocfs2/xattr.c | 36 ++++++++++++++++++------------------ fs/posix_acl.c | 17 ++++++++--------- fs/reiserfs/xattr.c | 28 ++++++++++++++++------------ fs/reiserfs/xattr_security.c | 16 ++++++++-------- fs/reiserfs/xattr_trusted.c | 16 ++++++++-------- fs/reiserfs/xattr_user.c | 16 ++++++++-------- fs/squashfs/xattr.c | 12 ++++++------ fs/xattr.c | 12 ++++++------ fs/xfs/xfs_xattr.c | 8 ++++---- include/linux/xattr.h | 6 +++--- 34 files changed, 215 insertions(+), 216 deletions(-) diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index f786688..b42d1cd 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c @@ -293,7 +293,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list", ext2_xattr_handler(entry->e_name_index); if (handler) { - size_t size = handler->list(dentry, buffer, rest, + size_t size = handler->list(inode, buffer, rest, entry->e_name, entry->e_name_len, handler); diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c index ed9f7a32..94fe3a9 100644 --- a/fs/ext2/xattr_security.c +++ b/fs/ext2/xattr_security.c @@ -8,7 +8,7 @@ #include "xattr.h" static size_t -ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, +ext2_xattr_security_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -24,24 +24,24 @@ ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext2_xattr_security_get(struct dentry *dentry, const char *name, +ext2_xattr_security_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, + return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name, buffer, size); } static int -ext2_xattr_security_set(struct dentry *dentry, const char *name, +ext2_xattr_security_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, + return ext2_xattr_set(inode, EXT2_XATTR_INDEX_SECURITY, name, value, size, flags); } diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 991676b..ce5e33f 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c @@ -9,7 +9,7 @@ #include "xattr.h" static size_t -ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, +ext2_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -28,24 +28,24 @@ ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext2_xattr_trusted_get(struct dentry *dentry, const char *name, +ext2_xattr_trusted_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, + return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, buffer, size); } static int -ext2_xattr_trusted_set(struct dentry *dentry, const char *name, +ext2_xattr_trusted_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, + return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, value, size, flags); } diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c index b8f7c02..06adb5b 100644 --- a/fs/ext2/xattr_user.c +++ b/fs/ext2/xattr_user.c @@ -11,14 +11,14 @@ #include "xattr.h" static size_t -ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, +ext2_xattr_user_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t prefix_len = XATTR_USER_PREFIX_LEN; const size_t total_len = prefix_len + name_len + 1; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return 0; if (list && total_len <= list_size) { @@ -30,29 +30,29 @@ ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext2_xattr_user_get(struct dentry *dentry, const char *name, +ext2_xattr_user_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER, + return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size); } static int -ext2_xattr_user_set(struct dentry *dentry, const char *name, +ext2_xattr_user_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER, + return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, value, size, flags); } diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 4c35ac4..392ef8b 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c @@ -330,6 +330,7 @@ static int ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry, char *buffer, size_t buffer_size) { + struct inode *inode = d_inode(dentry); size_t rest = buffer_size; for (; !IS_LAST_ENTRY(entry); entry = EXT3_XATTR_NEXT(entry)) { @@ -337,7 +338,7 @@ ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry, ext3_xattr_handler(entry->e_name_index); if (handler) { - size_t size = handler->list(dentry, buffer, rest, + size_t size = handler->list(inode, buffer, rest, entry->e_name, entry->e_name_len, handler); diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index c26ebe0..05fa7e7 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c @@ -8,7 +8,7 @@ #include "xattr.h" static size_t -ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, +ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -25,24 +25,24 @@ ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext3_xattr_security_get(struct dentry *dentry, const char *name, +ext3_xattr_security_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, + return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY, name, buffer, size); } static int -ext3_xattr_security_set(struct dentry *dentry, const char *name, +ext3_xattr_security_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, + return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY, name, value, size, flags); } diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index ba3ea56..1b25c3d 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c @@ -9,7 +9,7 @@ #include "xattr.h" static size_t -ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, +ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -28,24 +28,24 @@ ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext3_xattr_trusted_get(struct dentry *dentry, const char *name, +ext3_xattr_trusted_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, + return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, buffer, size); } static int -ext3_xattr_trusted_set(struct dentry *dentry, const char *name, +ext3_xattr_trusted_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, name, + return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, value, size, flags); } diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index 9a5ff25..437b489 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c @@ -9,14 +9,14 @@ #include "xattr.h" static size_t -ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, +ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t prefix_len = XATTR_USER_PREFIX_LEN; const size_t total_len = prefix_len + name_len + 1; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return 0; if (list && total_len <= list_size) { @@ -28,28 +28,28 @@ ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer, +ext3_xattr_user_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_USER, + return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); } static int -ext3_xattr_user_set(struct dentry *dentry, const char *name, +ext3_xattr_user_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_USER, + return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, value, size, flags); } diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index f5158d9..89a0938 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -398,6 +398,7 @@ static int ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry, char *buffer, size_t buffer_size) { + struct inode *inode = d_inode(dentry); size_t rest = buffer_size; for (; !IS_LAST_ENTRY(entry); entry = EXT4_XATTR_NEXT(entry)) { @@ -405,7 +406,7 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry, ext4_xattr_handler(entry->e_name_index); if (handler) { - size_t size = handler->list(dentry, buffer, rest, + size_t size = handler->list(inode, buffer, rest, entry->e_name, entry->e_name_len, handler); diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c index 5e5b4e0..eabcafb 100644 --- a/fs/ext4/xattr_security.c +++ b/fs/ext4/xattr_security.c @@ -12,7 +12,7 @@ #include "xattr.h" static size_t -ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, +ext4_xattr_security_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -29,24 +29,24 @@ ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext4_xattr_security_get(struct dentry *dentry, const char *name, +ext4_xattr_security_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, + return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY, name, buffer, size); } static int -ext4_xattr_security_set(struct dentry *dentry, const char *name, +ext4_xattr_security_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, + return ext4_xattr_set(inode, EXT4_XATTR_INDEX_SECURITY, name, value, size, flags); } diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c index b298d01..3e0590a 100644 --- a/fs/ext4/xattr_trusted.c +++ b/fs/ext4/xattr_trusted.c @@ -13,7 +13,7 @@ #include "xattr.h" static size_t -ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, +ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -32,24 +32,24 @@ ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer, +ext4_xattr_trusted_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, + return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED, name, buffer, size); } static int -ext4_xattr_trusted_set(struct dentry *dentry, const char *name, +ext4_xattr_trusted_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, + return ext4_xattr_set(inode, EXT4_XATTR_INDEX_TRUSTED, name, value, size, flags); } diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c index 62085d1..77d329d 100644 --- a/fs/ext4/xattr_user.c +++ b/fs/ext4/xattr_user.c @@ -12,14 +12,14 @@ #include "xattr.h" static size_t -ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, +ext4_xattr_user_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t prefix_len = XATTR_USER_PREFIX_LEN; const size_t total_len = prefix_len + name_len + 1; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return 0; if (list && total_len <= list_size) { @@ -31,28 +31,28 @@ ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, } static int -ext4_xattr_user_get(struct dentry *dentry, const char *name, +ext4_xattr_user_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER, + return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER, name, buffer, size); } static int -ext4_xattr_user_set(struct dentry *dentry, const char *name, +ext4_xattr_user_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - if (!test_opt(dentry->d_sb, XATTR_USER)) + if (!test_opt(inode->i_sb, XATTR_USER)) return -EOPNOTSUPP; - return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, + return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER, name, value, size, flags); } diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 1c3e5e7..3659a3d 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -25,11 +25,11 @@ #include "f2fs.h" #include "xattr.h" -static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list, +static size_t f2fs_xattr_generic_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t len, const struct xattr_handler *handler) { - struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); int total_len, prefix_len; switch (handler->flags) { @@ -57,11 +57,11 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list, return total_len; } -static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, +static int f2fs_xattr_generic_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); switch (handler->flags) { case F2FS_XATTR_INDEX_USER: @@ -79,15 +79,14 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, } if (strcmp(name, "") == 0) return -EINVAL; - return f2fs_getxattr(d_inode(dentry), handler->flags, name, - buffer, size, NULL); + return f2fs_getxattr(inode, handler->flags, name, buffer, size, NULL); } -static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, +static int f2fs_xattr_generic_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { - struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); switch (handler->flags) { case F2FS_XATTR_INDEX_USER: @@ -106,11 +105,11 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, if (strcmp(name, "") == 0) return -EINVAL; - return f2fs_setxattr(d_inode(dentry), handler->flags, name, - value, size, NULL, flags); + return f2fs_setxattr(inode, handler->flags, name, value, size, NULL, + flags); } -static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, +static size_t f2fs_xattr_advise_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t len, const struct xattr_handler *handler) { @@ -123,12 +122,10 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, return size; } -static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, +static int f2fs_xattr_advise_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - struct inode *inode = d_inode(dentry); - if (strcmp(name, "") != 0) return -EINVAL; @@ -137,12 +134,10 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, return sizeof(char); } -static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, +static int f2fs_xattr_advise_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { - struct inode *inode = d_inode(dentry); - if (strcmp(name, "") != 0) return -EINVAL; if (!inode_owner_or_capable(inode)) @@ -460,7 +455,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) if (!handler) continue; - size = handler->list(dentry, buffer, rest, entry->e_name, + size = handler->list(inode, buffer, rest, entry->e_name, entry->e_name_len, handler); if (buffer && size > rest) { error = -ERANGE; diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 3979c608..71e0495 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c @@ -583,11 +583,11 @@ out: * * Returns: actual size of data on success, -errno on error */ -static int gfs2_xattr_get(struct dentry *dentry, const char *name, +static int gfs2_xattr_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); + struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_ea_location el; int type = handler->flags; int error; @@ -1229,11 +1229,11 @@ int __gfs2_xattr_set(struct inode *inode, const char *name, return error; } -static int gfs2_xattr_set(struct dentry *dentry, const char *name, +static int gfs2_xattr_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { - return __gfs2_xattr_set(d_inode(dentry), name, value, + return __gfs2_xattr_set(inode, name, value, size, flags, handler->flags); } diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index 65914db..2ba308c 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c @@ -424,7 +424,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) return len; } -int hfsplus_setxattr(struct dentry *dentry, const char *name, +int hfsplus_setxattr(struct inode *inode, const char *name, const void *value, size_t size, int flags, const char *prefix, size_t prefixlen) { @@ -440,7 +440,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name, return -ENOMEM; strcpy(xattr_name, prefix); strcpy(xattr_name + prefixlen, name); - res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size, + res = __hfsplus_setxattr(inode, xattr_name, value, size, flags); kfree(xattr_name); return res; @@ -582,7 +582,7 @@ failed_getxattr_init: return res; } -ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, +ssize_t hfsplus_getxattr(struct inode *inode, const char *name, void *value, size_t size, const char *prefix, size_t prefixlen) { @@ -600,7 +600,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, strcpy(xattr_name, prefix); strcpy(xattr_name + prefixlen, name); - res = __hfsplus_getxattr(d_inode(dentry), xattr_name, value, size); + res = __hfsplus_getxattr(inode, xattr_name, value, size); kfree(xattr_name); return res; @@ -849,7 +849,7 @@ end_removexattr: return err; } -static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, +static int hfsplus_osx_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { @@ -869,10 +869,10 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, * creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ - return __hfsplus_getxattr(d_inode(dentry), name, buffer, size); + return __hfsplus_getxattr(inode, name, buffer, size); } -static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, +static int hfsplus_osx_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { @@ -892,7 +892,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, * creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ - return __hfsplus_setxattr(d_inode(dentry), name, buffer, size, flags); + return __hfsplus_setxattr(inode, name, buffer, size, flags); } const struct xattr_handler hfsplus_xattr_osx_handler = { diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h index f9b0955..68f6b53 100644 --- a/fs/hfsplus/xattr.h +++ b/fs/hfsplus/xattr.h @@ -21,14 +21,14 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[]; int __hfsplus_setxattr(struct inode *inode, const char *name, const void *value, size_t size, int flags); -int hfsplus_setxattr(struct dentry *dentry, const char *name, +int hfsplus_setxattr(struct inode *inode, const char *name, const void *value, size_t size, int flags, const char *prefix, size_t prefixlen); ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, void *value, size_t size); -ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, +ssize_t hfsplus_getxattr(struct inode *inode, const char *name, void *value, size_t size, const char *prefix, size_t prefixlen); diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c index 3601ecc..aefd82f 100644 --- a/fs/hfsplus/xattr_security.c +++ b/fs/hfsplus/xattr_security.c @@ -13,20 +13,20 @@ #include "xattr.h" #include "acl.h" -static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, +static int hfsplus_security_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - return hfsplus_getxattr(dentry, name, buffer, size, + return hfsplus_getxattr(inode, name, buffer, size, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); } -static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, +static int hfsplus_security_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { - return hfsplus_setxattr(dentry, name, buffer, size, flags, + return hfsplus_setxattr(inode, name, buffer, size, flags, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); } diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c index 123cd8e..077e26c 100644 --- a/fs/hfsplus/xattr_trusted.c +++ b/fs/hfsplus/xattr_trusted.c @@ -11,20 +11,20 @@ #include "hfsplus_fs.h" #include "xattr.h" -static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, +static int hfsplus_trusted_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - return hfsplus_getxattr(dentry, name, buffer, size, + return hfsplus_getxattr(inode, name, buffer, size, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); } -static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, +static int hfsplus_trusted_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { - return hfsplus_setxattr(dentry, name, buffer, size, flags, + return hfsplus_setxattr(inode, name, buffer, size, flags, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); } diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c index 2272557..1554304 100644 --- a/fs/hfsplus/xattr_user.c +++ b/fs/hfsplus/xattr_user.c @@ -11,20 +11,20 @@ #include "hfsplus_fs.h" #include "xattr.h" -static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, +static int hfsplus_user_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - return hfsplus_getxattr(dentry, name, buffer, size, + return hfsplus_getxattr(inode, name, buffer, size, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); } -static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, +static int hfsplus_user_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { - return hfsplus_setxattr(dentry, name, buffer, size, flags, + return hfsplus_setxattr(inode, name, buffer, size, flags, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); } diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c index 8f609e8..8496955 100644 --- a/fs/jffs2/security.c +++ b/fs/jffs2/security.c @@ -48,29 +48,29 @@ int jffs2_init_security(struct inode *inode, struct inode *dir, } /* ---- XATTR Handler for "security.*" ----------------- */ -static int jffs2_security_getxattr(struct dentry *dentry, const char *name, +static int jffs2_security_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, + return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY, name, buffer, size); } -static int jffs2_security_setxattr(struct dentry *dentry, const char *name, +static int jffs2_security_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, + return do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY, name, buffer, size, flags); } -static size_t jffs2_security_listxattr(struct dentry *dentry, char *list, +static size_t jffs2_security_listxattr(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 8b2305c..67db313 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c @@ -1001,10 +1001,10 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size) if (!xhandle) continue; if (buffer) { - rc = xhandle->list(dentry, buffer+len, size-len, + rc = xhandle->list(inode, buffer+len, size-len, xd->xname, xd->name_len, xhandle); } else { - rc = xhandle->list(dentry, NULL, 0, xd->xname, + rc = xhandle->list(inode, NULL, 0, xd->xname, xd->name_len, xhandle); } if (rc < 0) diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c index afa0e4d..fab079d 100644 --- a/fs/jffs2/xattr_trusted.c +++ b/fs/jffs2/xattr_trusted.c @@ -16,26 +16,26 @@ #include #include "nodelist.h" -static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, +static int jffs2_trusted_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, + return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED, name, buffer, size); } -static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, +static int jffs2_trusted_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, + return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED, name, buffer, size, flags); } -static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, +static size_t jffs2_trusted_listxattr(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c index 4c45567..33dab9b 100644 --- a/fs/jffs2/xattr_user.c +++ b/fs/jffs2/xattr_user.c @@ -16,27 +16,27 @@ #include #include "nodelist.h" -static int jffs2_user_getxattr(struct dentry *dentry, const char *name, +static int jffs2_user_getxattr(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER, + return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER, name, buffer, size); } -static int jffs2_user_setxattr(struct dentry *dentry, const char *name, +static int jffs2_user_setxattr(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (!strcmp(name, "")) return -EINVAL; - return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER, + return do_jffs2_setxattr(inode, JFFS2_XPREFIX_USER, name, buffer, size, flags); } -static size_t jffs2_user_listxattr(struct dentry *dentry, char *list, +static size_t jffs2_user_listxattr(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 977165e..9c5a015 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4841,12 +4841,11 @@ static int nfs4_do_set_security_label(struct inode *inode, } static int -nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen) +nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen) { struct nfs4_label ilabel, *olabel = NULL; struct nfs_fattr fattr; struct rpc_cred *cred; - struct inode *inode = d_inode(dentry); int status; if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) @@ -6201,7 +6200,7 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp) #define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" -static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key, +static int nfs4_xattr_set_nfs4_acl(struct inode *inode, const char *key, const void *buf, size_t buflen, int flags, const struct xattr_handler *handler) @@ -6209,27 +6208,27 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key, if (strcmp(key, "") != 0) return -EINVAL; - return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); + return nfs4_proc_set_acl(inode, buf, buflen); } -static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, +static int nfs4_xattr_get_nfs4_acl(struct inode *inode, const char *key, void *buf, size_t buflen, const struct xattr_handler *handler) { if (strcmp(key, "") != 0) return -EINVAL; - return nfs4_proc_get_acl(d_inode(dentry), buf, buflen); + return nfs4_proc_get_acl(inode, buf, buflen); } -static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, +static size_t nfs4_xattr_list_nfs4_acl(struct inode *inode, char *list, size_t list_len, const char *name, size_t name_len, const struct xattr_handler *handler) { size_t len = sizeof(XATTR_NAME_NFSV4_ACL); - if (!nfs4_server_supports_acls(NFS_SERVER(d_inode(dentry)))) + if (!nfs4_server_supports_acls(NFS_SERVER(inode))) return 0; if (list && len <= list_len) @@ -6243,37 +6242,37 @@ static inline int nfs4_server_supports_labels(struct nfs_server *server) return server->caps & NFS_CAP_SECURITY_LABEL; } -static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key, +static int nfs4_xattr_set_nfs4_label(struct inode *inode, const char *key, const void *buf, size_t buflen, int flags, const struct xattr_handler *handler) { if (security_ismaclabel(key)) - return nfs4_set_security_label(dentry, buf, buflen); + return nfs4_set_security_label(inode, buf, buflen); return -EOPNOTSUPP; } -static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key, +static int nfs4_xattr_get_nfs4_label(struct inode *inode, const char *key, void *buf, size_t buflen, const struct xattr_handler *handler) { if (security_ismaclabel(key)) - return nfs4_get_security_label(d_inode(dentry), buf, buflen); + return nfs4_get_security_label(inode, buf, buflen); return -EOPNOTSUPP; } -static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list, +static size_t nfs4_xattr_list_nfs4_label(struct inode *inode, char *list, size_t list_len, const char *name, size_t name_len, const struct xattr_handler *handler) { size_t len = 0; - if (nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) { - len = security_inode_listsecurity(d_inode(dentry), NULL, 0); + if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { + len = security_inode_listsecurity(inode, NULL, 0); if (list && len <= list_len) - security_inode_listsecurity(d_inode(dentry), list, len); + security_inode_listsecurity(inode, list, len); } return len; } diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index f5ce434..6cdbd35 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -7237,7 +7237,7 @@ leave: /* * 'security' attributes support */ -static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list, +static size_t ocfs2_xattr_security_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) @@ -7253,24 +7253,24 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list, return total_len; } -static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name, +static int ocfs2_xattr_security_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, + return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY, name, buffer, size); } -static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name, +static int ocfs2_xattr_security_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, + return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY, name, value, size, flags); } @@ -7330,7 +7330,7 @@ const struct xattr_handler ocfs2_xattr_security_handler = { /* * 'trusted' attributes support */ -static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list, +static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) @@ -7346,24 +7346,24 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list, return total_len; } -static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name, +static int ocfs2_xattr_trusted_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, + return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED, name, buffer, size); } -static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name, +static int ocfs2_xattr_trusted_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { if (strcmp(name, "") == 0) return -EINVAL; - return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, + return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_TRUSTED, name, value, size, flags); } @@ -7377,14 +7377,14 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = { /* * 'user' attributes support */ -static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list, +static size_t ocfs2_xattr_user_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t prefix_len = XATTR_USER_PREFIX_LEN; const size_t total_len = prefix_len + name_len + 1; - struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) return 0; @@ -7397,32 +7397,32 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list, return total_len; } -static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name, +static int ocfs2_xattr_user_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { - struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); if (strcmp(name, "") == 0) return -EINVAL; if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) return -EOPNOTSUPP; - return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name, + return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_USER, name, buffer, size); } -static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name, +static int ocfs2_xattr_user_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { - struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); if (strcmp(name, "") == 0) return -EINVAL; if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) return -EOPNOTSUPP; - return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER, + return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_USER, name, value, size, flags); } diff --git a/fs/posix_acl.c b/fs/posix_acl.c index cea22e6..8d9b8d8 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -762,19 +762,19 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, EXPORT_SYMBOL (posix_acl_to_xattr); static int -posix_acl_xattr_get(struct dentry *dentry, const char *name, +posix_acl_xattr_get(struct inode *inode, const char *name, void *value, size_t size, const struct xattr_handler *handler) { struct posix_acl *acl; int error; - if (!IS_POSIXACL(d_backing_inode(dentry))) + if (!IS_POSIXACL(inode)) return -EOPNOTSUPP; - if (d_is_symlink(dentry)) + if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; - acl = get_acl(d_backing_inode(dentry), handler->flags); + acl = get_acl(inode, handler->flags); if (IS_ERR(acl)) return PTR_ERR(acl); if (acl == NULL) @@ -787,11 +787,10 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name, } static int -posix_acl_xattr_set(struct dentry *dentry, const char *name, +posix_acl_xattr_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { - struct inode *inode = d_backing_inode(dentry); struct posix_acl *acl = NULL; int ret; @@ -824,16 +823,16 @@ out: } static size_t -posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size, +posix_acl_xattr_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const char *xname = handler->prefix; size_t size; - if (!IS_POSIXACL(d_backing_inode(dentry))) + if (!IS_POSIXACL(inode)) return -EOPNOTSUPP; - if (d_is_symlink(dentry)) + if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; size = strlen(xname) + 1; diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index ad6e4bb..5b58dea 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -771,50 +771,53 @@ ssize_t reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, size_t size) { + struct inode *inode = d_inode(dentry); const struct xattr_handler *handler; handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) + if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) return -EOPNOTSUPP; - return handler->get(dentry, name, buffer, size, handler); + return handler->get(inode, name, buffer, size, handler); } /* * Inode operation setxattr() * - * d_inode(dentry)->i_mutex down + * inode->i_mutex down */ int reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { + struct inode *inode = d_inode(dentry); const struct xattr_handler *handler; handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) + if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) return -EOPNOTSUPP; - return handler->set(dentry, name, value, size, flags, handler); + return handler->set(inode, name, value, size, flags, handler); } /* * Inode operation removexattr() * - * d_inode(dentry)->i_mutex down + * inode->i_mutex down */ int reiserfs_removexattr(struct dentry *dentry, const char *name) { + struct inode *inode = d_inode(dentry); const struct xattr_handler *handler; handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); - if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) + if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) return -EOPNOTSUPP; - return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler); + return handler->set(inode, name, NULL, 0, XATTR_REPLACE, handler); } struct listxattr_buf { @@ -835,6 +838,7 @@ static int listxattr_filler(struct dir_context *ctx, const char *name, if (name[0] != '.' || (namelen != 1 && (name[1] != '.' || namelen != 2))) { + struct inode *inode = d_inode(b->dentry); const struct xattr_handler *handler; handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr, @@ -842,13 +846,13 @@ static int listxattr_filler(struct dir_context *ctx, const char *name, if (!handler) /* Unsupported xattr name */ return 0; if (b->buf) { - size = handler->list(b->dentry, b->buf + b->pos, - b->size, name, namelen, handler); + size = handler->list(inode, b->buf + b->pos, b->size, + name, namelen, handler); if (size > b->size) return -ERANGE; } else { - size = handler->list(b->dentry, NULL, 0, name, - namelen, handler); + size = handler->list(inode, NULL, 0, + name, namelen, handler); } b->pos += size; diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 08074f5..579c3b2 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c @@ -9,39 +9,39 @@ #include static int -security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, +security_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) return -EINVAL; - if (IS_PRIVATE(d_inode(dentry))) + if (IS_PRIVATE(inode)) return -EPERM; - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); + return reiserfs_xattr_get(inode, name, buffer, size); } static int -security_set(struct dentry *dentry, const char *name, const void *buffer, +security_set(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) return -EINVAL; - if (IS_PRIVATE(d_inode(dentry))) + if (IS_PRIVATE(inode)) return -EPERM; - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); + return reiserfs_xattr_set(inode, name, buffer, size, flags); } -static size_t security_list(struct dentry *dentry, char *list, size_t list_len, +static size_t security_list(struct inode *inode, char *list, size_t list_len, const char *name, size_t namelen, const struct xattr_handler *handler) { const size_t len = namelen + 1; - if (IS_PRIVATE(d_inode(dentry))) + if (IS_PRIVATE(inode)) return 0; if (list && len <= list_len) { diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index e3ab346..ac2c9ae 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c @@ -8,39 +8,39 @@ #include static int -trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, +trusted_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) return -EINVAL; - if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) + if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode)) return -EPERM; - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); + return reiserfs_xattr_get(inode, name, buffer, size); } static int -trusted_set(struct dentry *dentry, const char *name, const void *buffer, +trusted_set(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) return -EINVAL; - if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) + if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode)) return -EPERM; - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); + return reiserfs_xattr_set(inode, name, buffer, size, flags); } -static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, +static size_t trusted_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t len = name_len + 1; - if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) + if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode)) return 0; if (list && len <= list_size) { diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index 2c8d466..712fdeb 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c @@ -7,37 +7,37 @@ #include static int -user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, +user_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_USER_PREFIX)) return -EINVAL; - if (!reiserfs_xattrs_user(dentry->d_sb)) + if (!reiserfs_xattrs_user(inode->i_sb)) return -EOPNOTSUPP; - return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); + return reiserfs_xattr_get(inode, name, buffer, size); } static int -user_set(struct dentry *dentry, const char *name, const void *buffer, +user_set(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *handler) { if (strlen(name) < sizeof(XATTR_USER_PREFIX)) return -EINVAL; - if (!reiserfs_xattrs_user(dentry->d_sb)) + if (!reiserfs_xattrs_user(inode->i_sb)) return -EOPNOTSUPP; - return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); + return reiserfs_xattr_set(inode, name, buffer, size, flags); } -static size_t user_list(struct dentry *dentry, char *list, size_t list_size, +static size_t user_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { const size_t len = name_len + 1; - if (!reiserfs_xattrs_user(dentry->d_sb)) + if (!reiserfs_xattrs_user(inode->i_sb)) return 0; if (list && len <= list_size) { memcpy(list, name, name_len); diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c index 268e25b..38d1b13 100644 --- a/fs/squashfs/xattr.c +++ b/fs/squashfs/xattr.c @@ -68,7 +68,7 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer, name_size = le16_to_cpu(entry.size); handler = squashfs_xattr_handler(le16_to_cpu(entry.type)); if (handler) - prefix_size = handler->list(d, buffer, rest, NULL, + prefix_size = handler->list(inode, buffer, rest, NULL, name_size, handler); if (prefix_size) { if (buffer) { @@ -212,7 +212,7 @@ failed: } -static size_t squashfs_xattr_handler_list(struct dentry *d, char *list, +static size_t squashfs_xattr_handler_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { @@ -223,13 +223,13 @@ static size_t squashfs_xattr_handler_list(struct dentry *d, char *list, return len; } -static int squashfs_xattr_handler_get(struct dentry *d, const char *name, +static int squashfs_xattr_handler_get(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *handler) { if (name[0] == '\0') return -EINVAL; - return squashfs_xattr_get(d_inode(d), handler->flags, name, + return squashfs_xattr_get(inode, handler->flags, name, buffer, size); } @@ -246,13 +246,13 @@ static const struct xattr_handler squashfs_xattr_user_handler = { /* * Trusted namespace support */ -static size_t squashfs_trusted_xattr_handler_list(struct dentry *d, char *list, +static size_t squashfs_trusted_xattr_handler_list(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *handler) { if (!capable(CAP_SYS_ADMIN)) return 0; - return squashfs_xattr_handler_list(d, list, list_size, name, name_len, + return squashfs_xattr_handler_list(inode, list, list_size, name, name_len, handler); } diff --git a/fs/xattr.c b/fs/xattr.c index 9584808..c45db57 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -709,7 +709,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; - return handler->get(dentry, name, buffer, size, handler); + return handler->get(dentry->d_inode, name, buffer, size, handler); } /* @@ -720,18 +720,18 @@ ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) { const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; + struct inode *inode = dentry->d_inode; unsigned int size = 0; if (!buffer) { for_each_xattr_handler(handlers, handler) { - size += handler->list(dentry, NULL, 0, NULL, 0, - handler); + size += handler->list(inode, NULL, 0, NULL, 0, handler); } } else { char *buf = buffer; for_each_xattr_handler(handlers, handler) { - size = handler->list(dentry, buf, buffer_size, + size = handler->list(inode, buf, buffer_size, NULL, 0, handler); if (size > buffer_size) return -ERANGE; @@ -756,7 +756,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; - return handler->set(dentry, name, value, size, flags, handler); + return handler->set(dentry->d_inode, name, value, size, flags, handler); } /* @@ -771,7 +771,7 @@ generic_removexattr(struct dentry *dentry, const char *name) handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; - return handler->set(dentry, name, NULL, 0, + return handler->set(dentry->d_inode, name, NULL, 0, XATTR_REPLACE, handler); } diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 9dace13..1fd52f9 100644 --- a/fs/xfs/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c @@ -32,12 +32,12 @@ static int -xfs_xattr_get(struct dentry *dentry, const char *name, +xfs_xattr_get(struct inode *inode, const char *name, void *value, size_t size, const struct xattr_handler *handler) { int xflags = handler->flags; - struct xfs_inode *ip = XFS_I(d_inode(dentry)); + struct xfs_inode *ip = XFS_I(inode); int error, asize = size; if (strcmp(name, "") == 0) @@ -56,12 +56,12 @@ xfs_xattr_get(struct dentry *dentry, const char *name, } static int -xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, +xfs_xattr_set(struct inode *inode, const char *name, const void *value, size_t size, int flags, const struct xattr_handler *handler) { int xflags = handler->flags; - struct xfs_inode *ip = XFS_I(d_inode(dentry)); + struct xfs_inode *ip = XFS_I(inode); if (strcmp(name, "") == 0) return -EINVAL; diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 8fd287d..0a0539e 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -22,12 +22,12 @@ struct dentry; struct xattr_handler { const char *prefix; int flags; /* fs private flags */ - size_t (*list)(struct dentry *dentry, char *list, size_t list_size, + size_t (*list)(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len, const struct xattr_handler *); - int (*get)(struct dentry *dentry, const char *name, void *buffer, + int (*get)(struct inode *inode, const char *name, void *buffer, size_t size, const struct xattr_handler *); - int (*set)(struct dentry *dentry, const char *name, const void *buffer, + int (*set)(struct inode *inode, const char *name, const void *buffer, size_t size, int flags, const struct xattr_handler *); };