From patchwork Tue Sep 7 10:28:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 160231 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o87ATBmI028393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Sep 2010 10:29:47 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OsvQ7-00022N-OP; Tue, 07 Sep 2010 10:28:55 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OsvQ5-00021u-Np for v9fs-developer@lists.sourceforge.net; Tue, 07 Sep 2010 10:28:53 +0000 X-ACL-Warn: Received: from e28smtp08.in.ibm.com ([122.248.162.8]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1OsvQ2-0005C8-Ll for v9fs-developer@lists.sourceforge.net; Tue, 07 Sep 2010 10:28:53 +0000 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp08.in.ibm.com (8.14.4/8.13.1) with ESMTP id o87ABOpq015392 for ; Tue, 7 Sep 2010 15:41:24 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o87ASbWe2994328 for ; Tue, 7 Sep 2010 15:58:37 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o87ASbgv019703 for ; Tue, 7 Sep 2010 15:58:37 +0530 Received: from localhost.localdomain ([9.77.212.73]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o87ASWNj019198; Tue, 7 Sep 2010 15:58:34 +0530 From: "Aneesh Kumar K.V" To: v9fs-developer@lists.sourceforge.net Date: Tue, 7 Sep 2010 15:58:20 +0530 Message-Id: <1283855304-22472-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1283855304-22472-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1283855304-22472-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Spam-Score: -0.4 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.4 AWL AWL: From: address is in the auto white-list X-Headers-End: 1OsvQ2-0005C8-Ll Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [V9fs-developer] [PATCH -V3 2/6] fs/9p: Add xattr callbacks for POSIX ACL X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Sep 2010 10:29:47 +0000 (UTC) diff --git a/fs/9p/acl.c b/fs/9p/acl.c index a8c0136..4293b45 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c @@ -94,3 +94,44 @@ int v9fs_check_acl(struct inode *inode, int mask) } return -EAGAIN; } + +static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, + void *buffer, size_t size, int type) +{ + struct posix_acl *acl; + int error; + + if (strcmp(name, "") != 0) + return -EINVAL; + + acl = v9fs_get_cached_acl(dentry->d_inode, type); + if (IS_ERR(acl)) + return PTR_ERR(acl); + if (acl == NULL) + return -ENODATA; + error = posix_acl_to_xattr(acl, buffer, size); + posix_acl_release(acl); + + return error; +} + +static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, + const void *value, size_t size, + int flags, int type) +{ + return 0; +} + +const struct xattr_handler v9fs_xattr_acl_access_handler = { + .prefix = POSIX_ACL_XATTR_ACCESS, + .flags = ACL_TYPE_ACCESS, + .get = v9fs_xattr_get_acl, + .set = v9fs_xattr_set_acl, +}; + +const struct xattr_handler v9fs_xattr_acl_default_handler = { + .prefix = POSIX_ACL_XATTR_DEFAULT, + .flags = ACL_TYPE_DEFAULT, + .get = v9fs_xattr_get_acl, + .set = v9fs_xattr_set_acl, +}; diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index 67ac6cf..43ec7df 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c @@ -164,5 +164,9 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) const struct xattr_handler *v9fs_xattr_handlers[] = { &v9fs_xattr_user_handler, +#ifdef CONFIG_9P_FS_POSIX_ACL + &v9fs_xattr_acl_access_handler, + &v9fs_xattr_acl_default_handler, +#endif NULL }; diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h index ec908c6..eaa837c 100644 --- a/fs/9p/xattr.h +++ b/fs/9p/xattr.h @@ -20,6 +20,8 @@ extern const struct xattr_handler *v9fs_xattr_handlers[]; extern struct xattr_handler v9fs_xattr_user_handler; +extern const struct xattr_handler v9fs_xattr_acl_access_handler; +extern const struct xattr_handler v9fs_xattr_acl_default_handler; extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *, void *, size_t);