summaryrefslogtreecommitdiff
path: root/fs/smb/client/xattr.c
diff options
context:
space:
mode:
authorHenrique Carvalho <henrique.carvalho@suse.com>2024-11-12 16:48:09 -0300
committerEnzo Matsumiya <ematsumiya@suse.de>2024-11-13 15:49:46 -0300
commit472697f67cf64a2461ad1842927f3c8cc539f37e (patch)
tree37bb1e46b0884721d35eb5d902aaf1bcf88374b0 /fs/smb/client/xattr.c
parent8e5cdf186897806453d95697985d2eb21a4730a7 (diff)
downloadlinux-hw24-hc-wip.tar.gz
linux-hw24-hc-wip.tar.bz2
linux-hw24-hc-wip.zip
smb: client: replace function pointers of common operations for thehw24-hc-wip
common function Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Diffstat (limited to 'fs/smb/client/xattr.c')
-rw-r--r--fs/smb/client/xattr.c70
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);