~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to fs/9p/acl.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <linux/posix_acl_xattr.h>
22
22
#include "xattr.h"
23
23
#include "acl.h"
 
24
#include "v9fs.h"
24
25
#include "v9fs_vfs.h"
25
 
#include "v9fs.h"
26
26
 
27
27
static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
28
28
{
59
59
        struct v9fs_session_info *v9ses;
60
60
 
61
61
        v9ses = v9fs_inode2v9ses(inode);
62
 
        if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) {
 
62
        if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
 
63
                        ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
63
64
                set_cached_acl(inode, ACL_TYPE_DEFAULT, NULL);
64
65
                set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
65
66
                return 0;
71
72
        if (!IS_ERR(dacl) && !IS_ERR(pacl)) {
72
73
                set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
73
74
                set_cached_acl(inode, ACL_TYPE_ACCESS, pacl);
 
75
        } else
 
76
                retval = -EIO;
 
77
 
 
78
        if (!IS_ERR(dacl))
74
79
                posix_acl_release(dacl);
 
80
 
 
81
        if (!IS_ERR(pacl))
75
82
                posix_acl_release(pacl);
76
 
        } else
77
 
                retval = -EIO;
78
83
 
79
84
        return retval;
80
85
}
100
105
                return -ECHILD;
101
106
 
102
107
        v9ses = v9fs_inode2v9ses(inode);
103
 
        if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) {
 
108
        if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
 
109
                        ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {
104
110
                /*
105
 
                 * On access = client mode get the acl
 
111
                 * On access = client  and acl = on mode get the acl
106
112
                 * values from the server
107
113
                 */
108
114
                return 0;
128
134
        struct inode *inode = dentry->d_inode;
129
135
 
130
136
        set_cached_acl(inode, type, acl);
 
137
 
 
138
        if (!acl)
 
139
                return 0;
 
140
 
131
141
        /* Set a setxattr request to server */
132
142
        size = posix_acl_xattr_size(acl->a_count);
133
143
        buffer = kmalloc(size, GFP_KERNEL);
177
187
int v9fs_set_create_acl(struct dentry *dentry,
178
188
                        struct posix_acl *dpacl, struct posix_acl *pacl)
179
189
{
180
 
        if (dpacl)
181
 
                v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, dpacl);
182
 
        if (pacl)
183
 
                v9fs_set_acl(dentry, ACL_TYPE_ACCESS, pacl);
 
190
        v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, dpacl);
 
191
        v9fs_set_acl(dentry, ACL_TYPE_ACCESS, pacl);
184
192
        posix_acl_release(dpacl);
185
193
        posix_acl_release(pacl);
186
194
        return 0;
254
262
        if (strcmp(name, "") != 0)
255
263
                return -EINVAL;
256
264
 
257
 
        v9ses = v9fs_inode2v9ses(dentry->d_inode);
 
265
        v9ses = v9fs_dentry2v9ses(dentry);
258
266
        /*
259
267
         * We allow set/get/list of acl when access=client is not specified
260
268
         */
304
312
        if (strcmp(name, "") != 0)
305
313
                return -EINVAL;
306
314
 
307
 
        v9ses = v9fs_inode2v9ses(dentry->d_inode);
 
315
        v9ses = v9fs_dentry2v9ses(dentry);
308
316
        /*
309
317
         * set the attribute on the remote. Without even looking at the
310
318
         * xattr value. We leave it to the server to validate
315
323
 
316
324
        if (S_ISLNK(inode->i_mode))
317
325
                return -EOPNOTSUPP;
318
 
        if (!is_owner_or_cap(inode))
 
326
        if (!inode_owner_or_capable(inode))
319
327
                return -EPERM;
320
328
        if (value) {
321
329
                /* update the cached acl value */