From patchwork Wed Jun 9 00:22:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 105056 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o590L6Ju001141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 Jun 2010 00:21:42 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OM92R-0005So-83; Wed, 09 Jun 2010 00:20:59 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1OM92P-0005Sj-HT for v9fs-developer@lists.sourceforge.net; Wed, 09 Jun 2010 00:20:57 +0000 X-ACL-Warn: Received: from e36.co.us.ibm.com ([32.97.110.154]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1OM92M-0002b9-6t for v9fs-developer@lists.sourceforge.net; Wed, 09 Jun 2010 00:20:56 +0000 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e36.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o590FSMH001688 for ; Tue, 8 Jun 2010 18:15:28 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o590Ii7Z137842 for ; Tue, 8 Jun 2010 18:18:44 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o590Ii0D032530 for ; Tue, 8 Jun 2010 18:18:44 -0600 Received: from localhost.localdomain (elm9m80.beaverton.ibm.com [9.47.81.80]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o590IhZk032521; Tue, 8 Jun 2010 18:18:43 -0600 From: "Venkateswararao Jujjuri (JV)" To: v9fs-developer@lists.sourceforge.net Date: Tue, 8 Jun 2010 17:22:27 -0700 Message-Id: <1276042948-19257-1-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 X-Spam-Score: -0.3 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.3 AWL AWL: From: address is in the auto white-list X-Headers-End: 1OM92M-0002b9-6t Cc: linux-fsdevel@vger.kernel.org Subject: [V9fs-developer] [RFC 1/2] [9P] Add a new access mode, V9FS_ACCESS_USER. 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 (demeter.kernel.org [140.211.167.41]); Wed, 09 Jun 2010 00:21:42 +0000 (UTC) diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 5d6cfcb..6e9bb6b 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -121,6 +121,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) switch (access) { case V9FS_ACCESS_SINGLE: case V9FS_ACCESS_USER: + case V9FS_ACCESS_CLIENT: uid = current_fsuid(); any = 0; break; diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 3c49201..aac818d 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -193,6 +193,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) v9ses->flags |= V9FS_ACCESS_USER; else if (strcmp(s, "any") == 0) v9ses->flags |= V9FS_ACCESS_ANY; + else if (strcmp(s, "client") == 0) + v9ses->flags |= V9FS_ACCESS_CLIENT; else { v9ses->flags |= V9FS_ACCESS_SINGLE; v9ses->uid = simple_strtoul(s, &e, 10); @@ -279,7 +281,8 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, /* for legacy mode, fall back to V9FS_ACCESS_ANY */ if (!(v9fs_proto_dotu(v9ses) || v9fs_proto_dotl(v9ses)) && - ((v9ses->flags&V9FS_ACCESS_MASK) == V9FS_ACCESS_USER)) { + (((v9ses->flags&V9FS_ACCESS_MASK) == V9FS_ACCESS_USER) || + ((v9ses->flags&V9FS_ACCESS_MASK) == V9FS_ACCESS_CLIENT))) { v9ses->flags &= ~V9FS_ACCESS_MASK; v9ses->flags |= V9FS_ACCESS_ANY; diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index bec4d0b..58ffdcf 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -29,6 +29,7 @@ * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) * @V9FS_ACCESS_ANY: use a single attach for all users + * @V9FS_ACCESS_CLIENT: Like V9FS_ACCESS_USER, but access check on client. * @V9FS_ACCESS_MASK: bit mask of different ACCESS options * * Session flags reflect options selected by users at mount time @@ -39,7 +40,8 @@ enum p9_session_flags { V9FS_ACCESS_SINGLE = 0x04, V9FS_ACCESS_USER = 0x08, V9FS_ACCESS_ANY = 0x0C, - V9FS_ACCESS_MASK = 0x0C, + V9FS_ACCESS_CLIENT = 0x1C, + V9FS_ACCESS_MASK = 0x1C, }; /* possible values of ->cache */