diff options
Diffstat (limited to 'fs/cifs/xattr.c')
-rw-r--r-- | fs/cifs/xattr.c | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 09afda4cc58e..5ac836a86b18 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -82,9 +82,11 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) | |||
82 | goto remove_ea_exit; | 82 | goto remove_ea_exit; |
83 | 83 | ||
84 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ | 84 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ |
85 | rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, NULL, | 85 | if (pTcon->ses->server->ops->set_EA) |
86 | (__u16)0, cifs_sb->local_nls, | 86 | rc = pTcon->ses->server->ops->set_EA(xid, pTcon, |
87 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 87 | full_path, ea_name, NULL, (__u16)0, |
88 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
89 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
88 | } | 90 | } |
89 | remove_ea_exit: | 91 | remove_ea_exit: |
90 | kfree(full_path); | 92 | kfree(full_path); |
@@ -149,18 +151,22 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
149 | cifs_dbg(FYI, "attempt to set cifs inode metadata\n"); | 151 | cifs_dbg(FYI, "attempt to set cifs inode metadata\n"); |
150 | 152 | ||
151 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ | 153 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ |
152 | rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, | 154 | if (pTcon->ses->server->ops->set_EA) |
153 | (__u16)value_size, cifs_sb->local_nls, | 155 | rc = pTcon->ses->server->ops->set_EA(xid, pTcon, |
154 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 156 | full_path, ea_name, ea_value, (__u16)value_size, |
157 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
158 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
155 | } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) | 159 | } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) |
156 | == 0) { | 160 | == 0) { |
157 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | 161 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
158 | goto set_ea_exit; | 162 | goto set_ea_exit; |
159 | 163 | ||
160 | ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ | 164 | ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ |
161 | rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, | 165 | if (pTcon->ses->server->ops->set_EA) |
162 | (__u16)value_size, cifs_sb->local_nls, | 166 | rc = pTcon->ses->server->ops->set_EA(xid, pTcon, |
163 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 167 | full_path, ea_name, ea_value, (__u16)value_size, |
168 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
169 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
164 | } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, | 170 | } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, |
165 | strlen(CIFS_XATTR_CIFS_ACL)) == 0) { | 171 | strlen(CIFS_XATTR_CIFS_ACL)) == 0) { |
166 | #ifdef CONFIG_CIFS_ACL | 172 | #ifdef CONFIG_CIFS_ACL |
@@ -170,8 +176,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
170 | rc = -ENOMEM; | 176 | rc = -ENOMEM; |
171 | } else { | 177 | } else { |
172 | memcpy(pacl, ea_value, value_size); | 178 | memcpy(pacl, ea_value, value_size); |
173 | rc = set_cifs_acl(pacl, value_size, | 179 | if (pTcon->ses->server->ops->set_acl) |
174 | direntry->d_inode, full_path, CIFS_ACL_DACL); | 180 | rc = pTcon->ses->server->ops->set_acl(pacl, |
181 | value_size, direntry->d_inode, | ||
182 | full_path, CIFS_ACL_DACL); | ||
183 | else | ||
184 | rc = -EOPNOTSUPP; | ||
175 | if (rc == 0) /* force revalidate of the inode */ | 185 | if (rc == 0) /* force revalidate of the inode */ |
176 | CIFS_I(direntry->d_inode)->time = 0; | 186 | CIFS_I(direntry->d_inode)->time = 0; |
177 | kfree(pacl); | 187 | kfree(pacl); |
@@ -272,17 +282,21 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
272 | /* revalidate/getattr then populate from inode */ | 282 | /* revalidate/getattr then populate from inode */ |
273 | } /* BB add else when above is implemented */ | 283 | } /* BB add else when above is implemented */ |
274 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ | 284 | ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ |
275 | rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value, | 285 | if (pTcon->ses->server->ops->query_all_EAs) |
276 | buf_size, cifs_sb->local_nls, | 286 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, |
277 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 287 | full_path, ea_name, ea_value, buf_size, |
288 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
289 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
278 | } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { | 290 | } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { |
279 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | 291 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
280 | goto get_ea_exit; | 292 | goto get_ea_exit; |
281 | 293 | ||
282 | ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ | 294 | ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ |
283 | rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value, | 295 | if (pTcon->ses->server->ops->query_all_EAs) |
284 | buf_size, cifs_sb->local_nls, | 296 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, |
285 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 297 | full_path, ea_name, ea_value, buf_size, |
298 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
299 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
286 | } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS, | 300 | } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS, |
287 | strlen(POSIX_ACL_XATTR_ACCESS)) == 0) { | 301 | strlen(POSIX_ACL_XATTR_ACCESS)) == 0) { |
288 | #ifdef CONFIG_CIFS_POSIX | 302 | #ifdef CONFIG_CIFS_POSIX |
@@ -313,8 +327,11 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
313 | u32 acllen; | 327 | u32 acllen; |
314 | struct cifs_ntsd *pacl; | 328 | struct cifs_ntsd *pacl; |
315 | 329 | ||
316 | pacl = get_cifs_acl(cifs_sb, direntry->d_inode, | 330 | if (pTcon->ses->server->ops->get_acl == NULL) |
317 | full_path, &acllen); | 331 | goto get_ea_exit; /* rc already EOPNOTSUPP */ |
332 | |||
333 | pacl = pTcon->ses->server->ops->get_acl(cifs_sb, | ||
334 | direntry->d_inode, full_path, &acllen); | ||
318 | if (IS_ERR(pacl)) { | 335 | if (IS_ERR(pacl)) { |
319 | rc = PTR_ERR(pacl); | 336 | rc = PTR_ERR(pacl); |
320 | cifs_dbg(VFS, "%s: error %zd getting sec desc\n", | 337 | cifs_dbg(VFS, "%s: error %zd getting sec desc\n", |
@@ -400,11 +417,12 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
400 | /* if proc/fs/cifs/streamstoxattr is set then | 417 | /* if proc/fs/cifs/streamstoxattr is set then |
401 | search server for EAs or streams to | 418 | search server for EAs or streams to |
402 | returns as xattrs */ | 419 | returns as xattrs */ |
403 | rc = CIFSSMBQAllEAs(xid, pTcon, full_path, NULL, data, | ||
404 | buf_size, cifs_sb->local_nls, | ||
405 | cifs_sb->mnt_cifs_flags & | ||
406 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
407 | 420 | ||
421 | if (pTcon->ses->server->ops->query_all_EAs) | ||
422 | rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, | ||
423 | full_path, NULL, data, buf_size, | ||
424 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
425 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
408 | list_ea_exit: | 426 | list_ea_exit: |
409 | kfree(full_path); | 427 | kfree(full_path); |
410 | free_xid(xid); | 428 | free_xid(xid); |