Skip to content

Commit

Permalink
cifs: remove some more dead code
Browse files Browse the repository at this point in the history
Remove more old commented code, leaving comments where appropriate.

Even though the compiler would probably wipe away the cifs*dbg() macros
contents (because of "if (0)"), leaving any explicit content in them can
be confusing, so also remove them.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
  • Loading branch information
ematsumiya authored and intel-lab-lkp committed Jul 23, 2022
1 parent fb109a3 commit 6e3f3b9
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 179 deletions.
26 changes: 4 additions & 22 deletions fs/cifs/cifs_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,9 @@ do { \
* ---------
*/
#else /* _CIFS_DEBUG */
#define cifs_dbg(type, fmt, ...) \
do { \
if (0) \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)

#define cifs_server_dbg(type, fmt, ...) \
do { \
if (0) \
pr_debug("\\\\%s " fmt, \
server->hostname, ##__VA_ARGS__); \
} while (0)

#define cifs_tcon_dbg(type, fmt, ...) \
do { \
if (0) \
pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__); \
} while (0)

#define cifs_info(fmt, ...) \
pr_info(fmt, ##__VA_ARGS__)
#define cifs_dbg(type, fmt, ...)
#define cifs_server_dbg(type, fmt, ...)
#define cifs_tcon_dbg(type, fmt, ...)
#define cifs_info(fmt, ...) pr_info(fmt, ##__VA_ARGS__)
#endif

#endif /* _H_CIFS_DEBUG */
5 changes: 0 additions & 5 deletions fs/cifs/cifsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,11 +841,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
}
}


/* memcpy((void *)(&(cifscred->aces[i])),
(void *)ppace[i],
sizeof(struct cifs_ace)); */

acl_base = (char *)ppace[i];
acl_size = le16_to_cpu(ppace[i]->size);
}
Expand Down
3 changes: 0 additions & 3 deletions fs/cifs/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ int cifs_verify_signature(struct smb_rqst *rqst,
if (rc)
return rc;

/* cifs_dump_mem("what we think it should be: ",
what_we_think_sig_should_be, 16); */

if (memcmp(server_response_sig, what_we_think_sig_should_be, 8))
return -EACCES;
else
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ extern void cifs_put_tcon(struct cifs_tcon *tcon);
#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
extern void cifs_dfs_release_automount_timer(void);
#else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
#define cifs_dfs_release_automount_timer() do { } while (0)
#define cifs_dfs_release_automount_timer()
#endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */

void cifs_proc_init(void);
Expand Down
18 changes: 0 additions & 18 deletions fs/cifs/cifssmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,10 +1762,6 @@ CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
} else {
pReadData = (char *) (&pSMBr->hdr.Protocol) +
le16_to_cpu(pSMBr->DataOffset);
/* if (rc = copy_to_user(buf, pReadData, data_length)) {
cifs_dbg(VFS, "Faulting on read rc = %d\n",rc);
rc = -EFAULT;
}*/ /* can not use copy_to_user when using page cache*/
if (*buf)
memcpy(*buf, pReadData, data_length);
}
Expand Down Expand Up @@ -1806,7 +1802,6 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,

*nbytes = 0;

/* cifs_dbg(FYI, "write at %lld %d bytes\n", offset, count);*/
if (tcon->ses == NULL)
return -ECONNABORTED;

Expand Down Expand Up @@ -3370,10 +3365,6 @@ static void cifs_convert_ace(struct posix_acl_xattr_entry *ace,
ace->e_perm = cpu_to_le16(cifs_ace->cifs_e_perm);
ace->e_tag = cpu_to_le16(cifs_ace->cifs_e_tag);
ace->e_id = cpu_to_le32(le64_to_cpu(cifs_ace->cifs_uid));
/*
cifs_dbg(FYI, "perm %d tag %d id %d\n",
ace->e_perm, ace->e_tag, ace->e_id);
*/

return;
}
Expand Down Expand Up @@ -3447,10 +3438,6 @@ static void convert_ace_to_cifs_ace(struct cifs_posix_ace *cifs_ace,
cifs_ace->cifs_uid = cpu_to_le64(-1);
} else
cifs_ace->cifs_uid = cpu_to_le64(le32_to_cpu(local_ace->e_id));
/*
cifs_dbg(FYI, "perm %d tag %d id %d\n",
ace->e_perm, ace->e_tag, ace->e_id);
*/
}

/* Convert ACL from local Linux POSIX xattr to CIFS POSIX ACL wire format */
Expand Down Expand Up @@ -4138,7 +4125,6 @@ CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
int name_len;
__u16 params, byte_count;

/* cifs_dbg(FYI, "In QPathInfo path %s\n", search_name); */
QPathInfoRetry:
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
(void **) &pSMBr);
Expand Down Expand Up @@ -4643,9 +4629,6 @@ int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
psrch_inf->last_entry =
psrch_inf->srch_entries_start + lnoff;

/* cifs_dbg(FYI, "fnxt2 entries in buf %d index_of_last %d\n",
psrch_inf->entries_in_buffer, psrch_inf->index_of_last_entry); */

/* BB fixme add unlock here */
}

Expand Down Expand Up @@ -6329,7 +6312,6 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,

/*BB add length check to see if it would fit in
negotiated SMB buffer size BB */
/* if (ea_value_len > buffer_size - 512 (enough for header)) */
if (ea_value_len)
memcpy(parm_data->list[0].name+name_len+1,
ea_value, ea_value_len);
Expand Down
18 changes: 0 additions & 18 deletions fs/cifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
}
CIFSSMBUnixSetFileInfo(xid, tcon, &args, fid->netfid,
current->tgid);
} else {
/*
* BB implement mode setting via Windows security
* descriptors e.g.
*/
/* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/

/* Could set r/o dos attribute if mode & 0222 == 0 */
}

cifs_create_get_file_info:
Expand Down Expand Up @@ -774,19 +766,9 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
return 1;
}

/* static int cifs_d_delete(struct dentry *direntry)
{
int rc = 0;
cifs_dbg(FYI, "In cifs d_delete, name = %pd\n", direntry);
return rc;
} */

const struct dentry_operations cifs_dentry_ops = {
.d_revalidate = cifs_d_revalidate,
.d_automount = cifs_dfs_d_automount,
/* d_delete: cifs_d_delete, */ /* not needed except for debugging */
};

static int cifs_ci_hash(const struct dentry *dentry, struct qstr *q)
Expand Down
6 changes: 0 additions & 6 deletions fs/cifs/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ static struct dentry *cifs_get_parent(struct dentry *dentry)

const struct export_operations cifs_export_ops = {
.get_parent = cifs_get_parent,
/* Following five export operations are unneeded so far and can default:
.get_dentry =
.get_name =
.find_exported_dentry =
.decode_fh =
.encode_fs = */
};

#endif /* CONFIG_CIFS_NFSD_EXPORT */
Expand Down
3 changes: 0 additions & 3 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ static inline int cifs_convert_flags(unsigned int flags)
else if ((flags & O_ACCMODE) == O_WRONLY)
return GENERIC_WRITE;
else if ((flags & O_ACCMODE) == O_RDWR) {
/* GENERIC_ALL is too much permission to request
can cause unnecessary access denied on create */
/* return GENERIC_ALL; */
return (GENERIC_READ | GENERIC_WRITE);
}

Expand Down
12 changes: 0 additions & 12 deletions fs/cifs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ static int cifs_shutdown(struct super_block *sb, unsigned long arg)
return 0;

cifs_dbg(VFS, "shut down requested (%d)", flags);
/* trace_cifs_shutdown(sb, flags);*/

/*
* see:
Expand Down Expand Up @@ -358,23 +357,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
if (pSMBFile == NULL)
break;
tcon = tlink_tcon(pSMBFile->tlink);
/* caps = le64_to_cpu(tcon->fsUnixInfo.Capability); */

if (get_user(ExtAttrBits, (int __user *)arg)) {
rc = -EFAULT;
break;
}

/*
* if (CIFS_UNIX_EXTATTR_CAP & caps)
* rc = CIFSSetExtAttr(xid, tcon,
* pSMBFile->fid.netfid,
* extAttrBits,
* &ExtAttrMask);
* if (rc != EOPNOTSUPP)
* break;
*/

/* Currently only flag we can set is compressed flag */
if ((ExtAttrBits & FS_COMPR_FL) == 0)
break;
Expand Down
3 changes: 0 additions & 3 deletions fs/cifs/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,6 @@ cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname,
cifs_sb->local_nls,
cifs_remap(cifs_sb));
/* else
rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,
cifs_sb_target->local_nls); */

if (rc == 0) {
if (pTcon->posix_extensions)
Expand Down
6 changes: 0 additions & 6 deletions fs/cifs/netmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ static const struct smb_to_posix_error mapping_table_ERRSRV[] = {
{ERRusestd, -EIO},
{ERR_NOTIFY_ENUM_DIR, -ENOBUFS},
{ERRnoSuchUser, -EACCES},
/* {ERRaccountexpired, -EACCES},
{ERRbadclient, -EACCES},
{ERRbadLogonTime, -EACCES},
{ERRpasswordExpired, -EACCES},*/
{ERRaccountexpired, -EKEYEXPIRED},
{ERRbadclient, -EACCES},
{ERRbadLogonTime, -EACCES},
Expand Down Expand Up @@ -1014,8 +1010,6 @@ struct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)

ts.tv_sec = sec + offset;

/* cifs_dbg(FYI, "sec after cnvrt dos to unix time %d\n",sec); */

ts.tv_nsec = 0;
return ts;
}
49 changes: 10 additions & 39 deletions fs/cifs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,36 +335,11 @@ cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info,
cifs_fill_common_info(fattr, cifs_sb);
}

/* BB eventually need to add the following helper function to
resolve NT_STATUS_STOPPED_ON_SYMLINK return code when
we try to do FindFirst on (NTFS) directory symlinks */
/*
int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
unsigned int xid)
{
__u16 fid;
int len;
int oplock = 0;
int rc;
struct cifs_tcon *ptcon = cifs_sb_tcon(cifs_sb);
char *tmpbuffer;
rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
OPEN_REPARSE_POINT, &fid, &oplock, NULL,
cifs_sb->local_nls,
cifs_remap(cifs_sb);
if (!rc) {
tmpbuffer = kmalloc(maxpath);
rc = CIFSSMBQueryReparseLinkInfo(xid, ptcon, full_path,
tmpbuffer,
maxpath -1,
fid,
cifs_sb->local_nls);
if (CIFSSMBClose(xid, ptcon, fid)) {
cifs_dbg(FYI, "Error closing temporary reparsepoint open\n");
}
}
}
* TODO: eventually need to add a helper function to
* resolve NT_STATUS_STOPPED_ON_SYMLINK return code when
* we try to do FindFirst on (NTFS) directory symlinks
* (see below)
*/

static int
Expand Down Expand Up @@ -411,9 +386,7 @@ _initiate_cifs_search(const unsigned int xid, struct file *file,
cifs_dbg(FYI, "Full path: %s start at: %lld\n", full_path, file->f_pos);

ffirst_retry:
/* test for Unix extensions */
/* but now check for them on the share/mount not on the SMB session */
/* if (cap_unix(tcon->ses) { */
/* test for Unix extensions on the share/mount, not on the SMB session */
if (tcon->unix_ext)
cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX;
else if (tcon->posix_extensions)
Expand All @@ -437,9 +410,10 @@ _initiate_cifs_search(const unsigned int xid, struct file *file,

if (rc == 0)
cifsFile->invalidHandle = false;
/* BB add following call to handle readdir on new NTFS symlink errors
else if STATUS_STOPPED_ON_SYMLINK
call get_symlink_reparse_path and retry with new path */
/*
* TODO: handle readdir on new NTFS symlink errors here
* (STATUS_STOPPED_ON_SYMLINK) and retry with new path
*/
else if ((rc == -EOPNOTSUPP) &&
(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
Expand Down Expand Up @@ -1134,10 +1108,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
rc = 0;
goto rddir2_exit;
}
} /* else {
cifsFile->invalidHandle = true;
tcon->ses->server->close(xid, tcon, &cifsFile->fid);
} */
}

tcon = tlink_tcon(cifsFile->tlink);
rc = find_cifs_entry(xid, tcon, ctx->pos, file, full_path,
Expand Down

0 comments on commit 6e3f3b9

Please sign in to comment.