diff options
Diffstat (limited to 'fs/smb/client/xattr.c')
-rw-r--r-- | fs/smb/client/xattr.c | 70 |
1 files changed, 22 insertions, 48 deletions
diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c index 6780aa3e98a1..8a055ad58dbb 100644 --- a/fs/smb/client/xattr.c +++ b/fs/smb/client/xattr.c @@ -44,7 +44,7 @@ static int cifs_attrib_set(unsigned int xid, struct cifs_tcon *pTcon, struct inode *inode, const char *full_path, const void *value, size_t size) { - ssize_t rc = -EOPNOTSUPP; + ssize_t rc; __u32 *pattrib = (__u32 *)value; __u32 attrib; FILE_BASIC_INFO info_buf; @@ -55,9 +55,7 @@ static int cifs_attrib_set(unsigned int xid, struct cifs_tcon *pTcon, memset(&info_buf, 0, sizeof(info_buf)); attrib = *pattrib; info_buf.Attributes = cpu_to_le32(attrib); - if (pTcon->ses->server->ops->set_file_info) - rc = pTcon->ses->server->ops->set_file_info(inode, full_path, - &info_buf, xid); + rc = smb2_set_file_info(inode, full_path, &info_buf, xid); if (rc == 0) CIFS_I(inode)->cifsAttrs = attrib; @@ -68,7 +66,7 @@ static int cifs_creation_time_set(unsigned int xid, struct cifs_tcon *pTcon, struct inode *inode, const char *full_path, const void *value, size_t size) { - ssize_t rc = -EOPNOTSUPP; + ssize_t rc; __u64 *pcreation_time = (__u64 *)value; __u64 creation_time; FILE_BASIC_INFO info_buf; @@ -79,9 +77,7 @@ static int cifs_creation_time_set(unsigned int xid, struct cifs_tcon *pTcon, memset(&info_buf, 0, sizeof(info_buf)); creation_time = *pcreation_time; info_buf.CreationTime = cpu_to_le64(creation_time); - if (pTcon->ses->server->ops->set_file_info) - rc = pTcon->ses->server->ops->set_file_info(inode, full_path, - &info_buf, xid); + rc = smb2_set_file_info(inode, full_path, &info_buf, xid); if (rc == 0) CIFS_I(inode)->createtime = creation_time; @@ -150,13 +146,10 @@ static int cifs_xattr_set(const struct xattr_handler *handler, if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) goto out; - if (pTcon->ses->server->ops->set_EA) { - rc = pTcon->ses->server->ops->set_EA(xid, pTcon, - full_path, name, value, (__u16)size, - cifs_sb->local_nls, cifs_sb); - if (rc == 0) - inode_set_ctime_current(inode); - } + rc = smb2_set_ea(xid, pTcon, full_path, name, value, (__u16)size, + cifs_sb->local_nls, cifs_sb); + if (rc == 0) + inode_set_ctime_current(inode); break; case XATTR_CIFS_ACL: @@ -170,33 +163,18 @@ static int cifs_xattr_set(const struct xattr_handler *handler, if (!pacl) { rc = -ENOMEM; } else { + int aclflags = 0; + memcpy(pacl, value, size); - if (pTcon->ses->server->ops->set_acl) { - int aclflags = 0; - rc = 0; - - switch (handler->flags) { - case XATTR_CIFS_NTSD_FULL: - aclflags = (CIFS_ACL_OWNER | - CIFS_ACL_GROUP | - CIFS_ACL_DACL | - CIFS_ACL_SACL); - break; - case XATTR_CIFS_NTSD: - aclflags = (CIFS_ACL_OWNER | - CIFS_ACL_GROUP | - CIFS_ACL_DACL); - break; - case XATTR_CIFS_ACL: - default: - aclflags = CIFS_ACL_DACL; - } - - rc = pTcon->ses->server->ops->set_acl(pacl, - size, inode, full_path, aclflags); - } else { - rc = -EOPNOTSUPP; - } + rc = 0; + + aclflags = CIFS_ACL_DACL; + if (handler->flags == XATTR_CIFS_NTSD) + aclflags |= CIFS_ACL_OWNER | CIFS_ACL_GROUP; + else if (handler->flags == XATTR_CIFS_NTSD_FULL) + aclflags |= CIFS_ACL_OWNER | CIFS_ACL_GROUP | CIFS_ACL_SACL; + + rc = set_smb2_acl(pacl, size, inode, full_path, aclflags); if (rc == 0) /* force revalidate of the inode */ CIFS_I(inode)->time = 0; kfree(pacl); @@ -302,9 +280,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler, if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) goto out; - if (pTcon->ses->server->ops->query_all_EAs) - rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, - full_path, name, value, size, cifs_sb); + rc = smb2_query_eas(xid, pTcon, full_path, name, value, size, cifs_sb); break; case XATTR_CIFS_ACL: @@ -325,7 +301,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler, } else { extra_info = 0; } - pacl = pTcon->ses->server->ops->get_acl(cifs_sb, + pacl = pTcon->get_smb2_acl(cifs_sb, inode, full_path, &acllen, extra_info); if (IS_ERR(pacl)) { rc = PTR_ERR(pacl); @@ -396,9 +372,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) search server for EAs or streams to returns as xattrs */ - if (pTcon->ses->server->ops->query_all_EAs) - rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, - full_path, NULL, data, buf_size, cifs_sb); + rc = smb2_query_eas(xid, pTcon, full_path, NULL, data, buf_size, cifs_sb); list_ea_exit: free_dentry_path(page); free_xid(xid); |