Skip to contentSkip to conversation

cifs: remove dead/commented code, cifsproto.h cleanup

PATCH New Enzo Matsumiya 1 participant 1 message Jul 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cifs: remove dead/commented code, cifsproto.h cleanup

Remove commented code. Also remove parameters names from cifsproto.h, as any kind of comment/documentation related to the functions sould go into their declaration.

No functional changes.

---
v2: add a comment for the removed parts in smb_snapshot_array and
smb_query_info structs, indicating the start of variable length data

 fs/cifs/cifs_debug.c   |   2 -
 fs/cifs/cifs_dfs_ref.c |   3 -
 fs/cifs/cifs_ioctl.h   |   4 +-
 fs/cifs/cifsacl.c      |   1 -
 fs/cifs/cifsfs.c       |  19 +-
 fs/cifs/cifsglob.h     |   1 -
 fs/cifs/cifspdu.h      |   2 -
 fs/cifs/cifsproto.h    | 908 ++++++++++++++++-------------------------
 fs/cifs/cifssmb.c      |  15 +-
 fs/cifs/fs_context.c   |  20 -
 fs/cifs/inode.c        |   2 -
 fs/cifs/misc.c         |  10 +-
 fs/cifs/smb2ops.c      |   2 +-
 fs/cifs/transport.c    |   3 +-
 14 files changed, 356 insertions(+), 636 deletions(-)
fs/cifs/cifs_debug.c +0 -2
index f5e63dfac2b1..e139719c8b47 100644
@@ -1059,8 +1059,6 @@ static const struct proc_ops cifs_mount_params_proc_ops = {
 	.proc_read	= seq_read,
 	.proc_lseek	= seq_lseek,
 	.proc_release	= single_release,
-	/* No need for write for now */
-	/* .proc_write	= cifs_mount_params_proc_write, */
 };
 
 #else
fs/cifs/cifs_dfs_ref.c +0 -3
index b0864da9ef43..23fa4fa3cb16 100644
@@ -244,9 +244,6 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
 	else
 		kfree(name);
 
-	/*cifs_dbg(FYI, "%s: parent mountdata: %s\n", __func__, sb_mountdata);*/
-	/*cifs_dbg(FYI, "%s: submount mountdata: %s\n", __func__, mountdata );*/
-
 compose_mount_options_out:
 	kfree(srvIP);
 	return mountdata;
fs/cifs/cifs_ioctl.h +2 -2
index b87cbbe6d2d4..e162cf12c859 100644
@@ -30,7 +30,7 @@ struct smb_snapshot_array {
 	__u32	number_of_snapshots;
 	__u32	number_of_snapshots_returned;
 	__u32	snapshot_array_size;
-	/*	snapshots[]; */
+	/* start of snapshot aray after here */
 } __packed;
 
 /* query_info flags */
@@ -44,7 +44,7 @@ struct smb_query_info {
 	__u32   flags;
 	__u32	input_buffer_length;
 	__u32	output_buffer_length;
-	/* char buffer[]; */
+	/* start of buffer after here */
 } __packed;
 
 /*
fs/cifs/cifsacl.c +0 -1
index bf861fef2f0c..73754cb74065 100644
@@ -1208,7 +1208,6 @@ static int parse_sec_desc(struct cifs_sb_info *cifs_sb,
 		 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
 		 le32_to_cpu(pntsd->gsidoffset),
 		 le32_to_cpu(pntsd->sacloffset), dacloffset);
-/*	cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */
 	rc = parse_sid(owner_sid_ptr, end_of_acl);
 	if (rc) {
 		cifs_dbg(FYI, "%s: Error %d parsing Owner SID\n", __func__, rc);
fs/cifs/cifsfs.c +2 -17
index f909d9e9faaa..4c3a9c97d766 100644
@@ -66,7 +66,6 @@ bool enable_gcm_256 = true;
 bool require_gcm_256; /* false by default */
 bool enable_negotiate_signing; /* false by default */
 unsigned int global_secflags = CIFSSEC_DEF;
-/* unsigned int ntlmv2_support = 0; */
 unsigned int sign_CIFS_PDUs = 1;
 atomic_t mid_count;
 atomic_t buf_alloc_count;
@@ -394,11 +393,6 @@ cifs_alloc_inode(struct super_block *sb)
 	spin_lock_init(&cifs_inode->open_file_lock);
 	generate_random_uuid(cifs_inode->lease_key);
 
-	/*
-	 * Can not set i_flags here - they get immediately overwritten to zero
-	 * by the VFS.
-	 */
-	/* cifs_inode->netfs.inode.i_flags = S_NOATIME | S_NOCMTIME; */
 	INIT_LIST_HEAD(&cifs_inode->openFileList);
 	INIT_LIST_HEAD(&cifs_inode->llist);
 	INIT_LIST_HEAD(&cifs_inode->deferred_closes);
@@ -722,8 +716,6 @@ static void cifs_umount_begin(struct super_block *sb)
 		tcon->status = TID_EXITING;
 	spin_unlock(&cifs_tcp_ses_lock);
 
-	/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
-	/* cancel_notify_requests(tcon); */
 	if (tcon->ses && tcon->ses->server) {
 		cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
 		wake_up_all(&tcon->ses->server->request_q);
@@ -767,12 +759,8 @@ static const struct super_operations cifs_super_ops = {
 	.free_inode = cifs_free_inode,
 	.drop_inode	= cifs_drop_inode,
 	.evict_inode	= cifs_evict_inode,
-/*	.show_path	= cifs_show_path, */ /* Would we ever need show path? */
+	/* XXX: would we ever need show path? */
 	.show_devname   = cifs_show_devname,
-/*	.delete_inode	= cifs_delete_inode,  */  /* Do not need above
-	function unless later we add lazy close of inodes or unless the
-	kernel forgets to call us with the same number of releases (closes)
-	as opens */
 	.show_options = cifs_show_options,
 	.umount_begin   = cifs_umount_begin,
 #ifdef CONFIG_CIFS_STATS2
@@ -1474,10 +1462,7 @@ cifs_init_request_bufs(void)
 	} else {
 		CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
 	}
-/*
-	cifs_dbg(VFS, "CIFSMaxBufSize %d 0x%x\n",
-		 CIFSMaxBufSize, CIFSMaxBufSize);
-*/
+
 	cifs_req_cachep = kmem_cache_create_usercopy("cifs_request",
 					    CIFSMaxBufSize + max_hdr_size, 0,
 					    SLAB_HWCACHE_ALIGN, 0,
fs/cifs/cifsglob.h +0 -1
index 9b7f409bfc8c..2a458db1b5ae 100644
@@ -2034,7 +2034,6 @@ extern struct smb_version_operations smb30_operations;
 extern struct smb_version_values smb30_values;
 #define SMB302_VERSION_STRING	"3.02"
 #define ALT_SMB302_VERSION_STRING "3.0.2"
-/*extern struct smb_version_operations smb302_operations;*/ /* not needed yet */
 extern struct smb_version_values smb302_values;
 #define SMB311_VERSION_STRING	"3.1.1"
 #define ALT_SMB311_VERSION_STRING "3.11"
fs/cifs/cifspdu.h +0 -2
index aeba371c4c70..36df9a55376f 100644
@@ -1928,8 +1928,6 @@ typedef struct whoami_rsp_data { /* Query level 0x202 */
 	__u32 number_of_sids; /* may be zero */
 	__u32 length_of_sid_array; /* in bytes - may be zero */
 	__u32 pad; /* reserved - MBZ */
-	/* __u64 gid_array[0]; */  /* may be empty */
-	/* __u8 * psid_list */  /* may be empty */
 } __attribute__((packed)) WHOAMI_RSP_DATA;
 
 /* SETFSInfo Levels */
fs/cifs/cifsproto.h +348 -560

979 lines not on this page · raw message

fs/cifs/cifssmb.c +1 -14
index 9ed21752f2df..011d17b7523c 100644
@@ -1208,11 +1208,6 @@ SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
 	if (create_options & CREATE_OPTION_READONLY)
 		pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY);
 
-	/* BB FIXME BB */
-/*	pSMB->CreateOptions = cpu_to_le32(create_options &
-						 CREATE_OPTIONS_MASK); */
-	/* BB FIXME END BB */
-
 	pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
 	pSMB->OpenFunction = cpu_to_le16(convert_disposition(openDisposition));
 	count += name_len;
@@ -1225,17 +1220,10 @@ SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc) {
 		cifs_dbg(FYI, "Error in Open = %d\n", rc);
 	} else {
-	/* BB verify if wct == 15 */
-
-/*		*pOplock = pSMBr->OplockLevel; */ /* BB take from action field*/
-
+		/* BB verify if wct == 15 */
 		*netfid = pSMBr->Fid;   /* cifs fid stays in le */
 		/* Let caller know file was created so we can set the mode. */
 		/* Do we care about the CreateAction in any other cases? */
-	/* BB FIXME BB */
-/*		if (cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction)
-			*pOplock |= CIFS_CREATE_ACTION; */
-	/* BB FIXME END */
 
 		if (pfile_info) {
 			pfile_info->CreationTime = 0; /* BB convert CreateTime*/
@@ -2382,7 +2370,6 @@ CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon,
 {
 	int rc = 0;
 	LOCK_REQ *pSMB = NULL;
-/*	LOCK_RSP *pSMBr = NULL; */ /* No response data other than rc to parse */
 	int bytes_returned;
 	int flags = 0;
 	__u16 count;
fs/cifs/fs_context.c +0 -20
index 8dc0d923ef6a..f76d9920a7a7 100644
@@ -5,19 +5,6 @@
  *   Author(s): Steve French <[email protected]>
  *              David Howells <[email protected]>
  */
-
-/*
-#include <linux/module.h>
-#include <linux/nsproxy.h>
-#include <linux/slab.h>
-#include <linux/magic.h>
-#include <linux/security.h>
-#include <net/net_namespace.h>
-#ifdef CONFIG_CIFS_DFS_UPCALL
-#include "dfs_cache.h"
-#endif
-*/
-
 #include <linux/ctype.h>
 #include <linux/fs_context.h>
 #include <linux/fs_parser.h>
@@ -1538,13 +1525,6 @@ int smb3_init_fs_context(struct fs_context *fc)
 	ctx->backupuid_specified = false; /* no backup intent for a user */
 	ctx->backupgid_specified = false; /* no backup intent for a group */
 
-/*
- *	short int override_uid = -1;
- *	short int override_gid = -1;
- *	char *nodename = strdup(utsname()->nodename);
- *	struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;
- */
-
 	fc->fs_private = ctx;
 	fc->ops = &smb3_fs_context_ops;
 	return 0;
fs/cifs/inode.c +0 -2
index 3ad303dd5e5a..46ebc2554b53 100644
@@ -623,8 +623,6 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo *
 
 	fattr->cf_nlink = le32_to_cpu(info->HardLinks);
 	fattr->cf_mode = (umode_t) le32_to_cpu(info->Mode);
-	/* The srv fs device id is overridden on network mount so setting rdev isn't needed here */
-	/* fattr->cf_rdev = le32_to_cpu(info->DeviceId); */
 
 	if (symlink) {
 		fattr->cf_mode |= S_IFLNK;
fs/cifs/misc.c +1 -9
index 16168ebd1a62..ec0069058f45 100644
@@ -55,8 +55,6 @@ void
 _free_xid(unsigned int xid)
 {
 	spin_lock(&GlobalMid_Lock);
-	/* if (GlobalTotalActiveXid == 0)
-		BUG(); */
 	GlobalTotalActiveXid--;
 	spin_unlock(&GlobalMid_Lock);
 }
@@ -183,10 +181,8 @@ cifs_buf_get(void)
 void
 cifs_buf_release(void *buf_to_free)
 {
-	if (buf_to_free == NULL) {
-		/* cifs_dbg(FYI, "Null buffer passed to cifs_buf_release\n");*/
+	if (buf_to_free == NULL)
 		return;
-	}
 	mempool_free(buf_to_free, cifs_req_poolp);
 
 	atomic_dec(&buf_alloc_count);
@@ -203,8 +199,6 @@ cifs_small_buf_get(void)
    albeit slightly larger than necessary and maxbuffersize
    defaults to this and can not be bigger */
 	ret_buf = mempool_alloc(cifs_sm_req_poolp, GFP_NOFS);
-	/* No need to clear memory here, cleared in header assemble */
-	/*	memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/
 	atomic_inc(&small_buf_alloc_count);
 #ifdef CONFIG_CIFS_STATS2
 	atomic_inc(&total_small_buf_alloc_count);
@@ -428,8 +422,6 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
 				((char *)&pSMBr->hdr.Protocol + data_offset);
 			cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",
 				 pnotify->FileName, pnotify->Action);
-			/*   cifs_dump_mem("Rcvd notify Data: ",buf,
-				sizeof(struct smb_hdr)+60); */
 			return true;
 		}
 		if (pSMBr->hdr.Status.CifsError) {
fs/cifs/smb2ops.c +1 -1
index aa4c1d403708..2f36bc1720fd 100644
@@ -5862,7 +5862,7 @@ struct smb_version_operations smb311_operations = {
 	.parse_lease_buf = smb3_parse_lease_buf,
 	.copychunk_range = smb2_copychunk_range,
 	.duplicate_extents = smb2_duplicate_extents,
-/*	.validate_negotiate = smb3_validate_negotiate, */ /* not used in 3.11 */
+	/* validate_negotiate not used in 3.11 */
 	.wp_retry_size = smb2_wp_retry_size,
 	.dir_needs_close = smb2_dir_needs_close,
 	.fallocate = smb3_fallocate,
fs/cifs/transport.c +1 -2
index dac8d6f9b309..081dd21b731e 100644
@@ -54,8 +54,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
 	temp->pid = current->pid;
 	temp->command = cpu_to_le16(smb_buffer->Command);
 	cifs_dbg(FYI, "For smb_command %d\n", smb_buffer->Command);
-	/*	do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
-	/* when mid allocated can be before when sent */
+	/* when_alloc can be before when_sent */
 	temp->when_alloc = jiffies;
 	temp->server = server;
 
Signature · 1 line
2.35.3