acl.c (6e8dc55550273084b7fb5846df2f44439f5d03d9) acl.c (ad77dbce567128d59b37a14c9562c8af6f63aeca)
1/*
2 * Copyright IBM Corporation, 2010
3 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2.1 of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
8 *

--- 138 unchanged lines hidden (view full) ---

147 retval = posix_acl_chmod_masq(clone, inode->i_mode);
148 if (!retval)
149 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, clone);
150 posix_acl_release(clone);
151 }
152 return retval;
153}
154
1/*
2 * Copyright IBM Corporation, 2010
3 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2.1 of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
8 *

--- 138 unchanged lines hidden (view full) ---

147 retval = posix_acl_chmod_masq(clone, inode->i_mode);
148 if (!retval)
149 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, clone);
150 posix_acl_release(clone);
151 }
152 return retval;
153}
154
155int v9fs_set_create_acl(struct dentry *dentry,
156 struct posix_acl *dpacl, struct posix_acl *pacl)
157{
158 if (dpacl)
159 v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, dpacl);
160 if (pacl)
161 v9fs_set_acl(dentry, ACL_TYPE_ACCESS, pacl);
162 posix_acl_release(dpacl);
163 posix_acl_release(pacl);
164 return 0;
165}
166
167int v9fs_acl_mode(struct inode *dir, mode_t *modep,
168 struct posix_acl **dpacl, struct posix_acl **pacl)
169{
170 int retval = 0;
171 mode_t mode = *modep;
172 struct posix_acl *acl = NULL;
173
174 if (!S_ISLNK(mode)) {
175 acl = v9fs_get_cached_acl(dir, ACL_TYPE_DEFAULT);
176 if (IS_ERR(acl))
177 return PTR_ERR(acl);
178 if (!acl)
179 mode &= ~current_umask();
180 }
181 if (acl) {
182 struct posix_acl *clone;
183
184 if (S_ISDIR(mode))
185 *dpacl = acl;
186 clone = posix_acl_clone(acl, GFP_NOFS);
187 retval = -ENOMEM;
188 if (!clone)
189 goto cleanup;
190
191 retval = posix_acl_create_masq(clone, &mode);
192 if (retval < 0) {
193 posix_acl_release(clone);
194 goto cleanup;
195 }
196 if (retval > 0)
197 *pacl = clone;
198 }
199 *modep = mode;
200 return 0;
201cleanup:
202 posix_acl_release(acl);
203 return retval;
204
205}
206
155static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
156 void *buffer, size_t size, int type)
157{
158 struct posix_acl *acl;
159 int error;
160
161 if (strcmp(name, "") != 0)
162 return -EINVAL;

--- 102 unchanged lines hidden ---
207static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
208 void *buffer, size_t size, int type)
209{
210 struct posix_acl *acl;
211 int error;
212
213 if (strcmp(name, "") != 0)
214 return -EINVAL;

--- 102 unchanged lines hidden ---