diff options
| author | Henrique Carvalho <henrique.carvalho@suse.com> | 2024-11-14 15:50:21 -0300 |
|---|---|---|
| committer | Henrique Carvalho <henrique.carvalho@suse.com> | 2024-11-14 16:15:32 -0300 |
| commit | 38550a31a1e5d392efc466234a9f814f6fa3c709 (patch) | |
| tree | e5032b57ca4c2ce4d685ae051af3be3f6e1fbb90 | |
| parent | 2d1151570f25cf7f806c3617c76c5b219fa128e5 (diff) | |
| download | linux-38550a31a1e5d392efc466234a9f814f6fa3c709.tar.gz linux-38550a31a1e5d392efc466234a9f814f6fa3c709.tar.bz2 linux-38550a31a1e5d392efc466234a9f814f6fa3c709.zip | |
smb: client: remove ->queryfs op
Add generic smb_queryfs function for smb21, smb30, and smb311.
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
| -rw-r--r-- | fs/smb/client/cifsfs.c | 4 | ||||
| -rw-r--r-- | fs/smb/client/cifsglob.h | 2 | ||||
| -rw-r--r-- | fs/smb/client/smb2ops.c | 17 | ||||
| -rw-r--r-- | fs/smb/client/smb2proto.h | 3 |
4 files changed, 17 insertions, 9 deletions
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index cef26233e791..81d741910c49 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -287,7 +287,6 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) struct super_block *sb = dentry->d_sb; struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); - struct TCP_Server_Info *server = tcon->ses->server; unsigned int xid; int rc = 0; const char *full_path; @@ -315,8 +314,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_files = 0; /* undefined */ buf->f_ffree = 0; /* unlimited */ - if (server->ops->queryfs) - rc = server->ops->queryfs(xid, tcon, full_path, cifs_sb, buf); + rc = smb_queryfs(xid, tcon, full_path, cifs_sb, buf); statfs_out: free_dentry_path(page); diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 83768480dcc4..7f8ac17f4f09 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -283,8 +283,6 @@ struct smb_version_operations { int (*close_getattr)(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *pfile_info); /* query remote filesystem */ - int (*queryfs)(const unsigned int, struct cifs_tcon *, - const char *, struct cifs_sb_info *, struct kstatfs *); int (*generate_signingkey)(struct cifs_ses *ses, struct TCP_Server_Info *server); int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *, diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index f6981a9a667d..b8e991b069d0 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -2881,6 +2881,20 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon, return rc; } +int +smb_queryfs(const unsigned int xid, struct cifs_tcon *tcon, + const char *path, struct cifs_sb_info *cifs_sb, struct kstatfs *buf) +{ + u16 protocol_id = tcon->ses->server->vals->protocol_id; + if (protocol_id >= SMB311_PROT_ID) + return smb311_queryfs(xid, tcon, path, cifs_sb, buf); + else if (protocol_id >= SMB20_PROT_ID) + return smb2_queryfs(xid, tcon, path, cifs_sb, buf); + else + pr_warn_once("unsupported protocol id 0x%x\n", protocol_id); + return -ENOTSUPP; +} + bool smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2) { return ob1->fid.persistent_fid == ob2->fid.persistent_fid && @@ -5068,7 +5082,6 @@ int smb2_make_node(unsigned int xid, struct inode *inode, struct smb_version_operations smb21_operations = { /* send_cancel is missing */ - .queryfs = smb2_queryfs, .calc_signature = smb2_calc_signature, .parse_lease_buf = smb2_parse_lease_buf, }; @@ -5076,7 +5089,6 @@ struct smb_version_operations smb21_operations = { struct smb_version_operations smb30_operations = { /* WSL tags introduced long after smb2.1, enable for SMB3, 3.11 only */ .close_getattr = smb2_close_getattr, - .queryfs = smb2_queryfs, .generate_signingkey = generate_smb30signingkey, .calc_signature = smb3_calc_signature, .parse_lease_buf = smb3_parse_lease_buf, @@ -5090,7 +5102,6 @@ struct smb_version_operations smb30_operations = { struct smb_version_operations smb311_operations = { .posix_mkdir = smb311_posix_mkdir, .close_getattr = smb2_close_getattr, - .queryfs = smb311_queryfs, .generate_signingkey = generate_smb311signingkey, .calc_signature = smb3_calc_signature, .parse_lease_buf = smb3_parse_lease_buf, diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h index 6a73a0c2dd8e..d9d0452bbb49 100644 --- a/fs/smb/client/smb2proto.h +++ b/fs/smb/client/smb2proto.h @@ -60,7 +60,8 @@ extern void smb_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, struct extern void smb_downgrade_oplock(struct TCP_Server_Info *server, struct cifsInodeInfo *cinode, __u32 oplock, unsigned int epoch, bool *purge_cache); - +extern int smb_queryfs(const unsigned int xid, struct cifs_tcon *tcon, + const char *path, struct cifs_sb_info *cifs_sb, struct kstatfs *buf); extern int map_smb2_to_linux_error(char *buf, bool log_err); extern int smb2_check_message(char *buf, unsigned int length, |
