* [PATCH 1/6] cifs: copy_to_user and copy_from_user fixes
@ 2005-01-15 13:25 Pekka Enberg
2005-01-15 13:26 ` [PATCH 2/6] cifs: remove dead code Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:25 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
Check return value for copy_to_user() and copy_from_user().
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
cifssmb.c | 37 ++++++++++++++++++++++---------------
file.c | 6 +++++-
2 files changed, 27 insertions(+), 16 deletions(-)
Index: linux/fs/cifs/cifssmb.c
===================================================================
--- linux.orig/fs/cifs/cifssmb.c 2005-01-12 19:43:26.012611064 +0200
+++ linux/fs/cifs/cifssmb.c 2005-01-12 20:03:29.307682408 +0200
@@ -886,25 +886,29 @@
pSMB->Reserved = 0xFFFFFFFF;
pSMB->WriteMode = 0;
pSMB->Remaining = 0;
- /* BB can relax this if buffer is big enough in some cases - ie we can
- send more if LARGE_WRITE_X capability returned by the server and if
- our buffer is big enough or if we convert to iovecs on socket writes
- and eliminate the copy to the CIFS buffer */
+ /*
+ * BB can relax this if buffer is big enough in some cases - ie we can
+ * send more if LARGE_WRITE_X capability returned by the server and if
+ * our buffer is big enough or if we convert to iovecs on socket writes
+ * and eliminate the copy to the CIFS buffer
+ */
bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & ~0xFF;
if (bytes_sent > count)
bytes_sent = count;
pSMB->DataLengthHigh = 0;
pSMB->DataOffset =
cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4);
- if(buf)
- memcpy(pSMB->Data,buf,bytes_sent);
- else if(ubuf)
- copy_from_user(pSMB->Data,ubuf,bytes_sent);
- else {
- /* No buffer */
- if(pSMB)
- cifs_buf_release(pSMB);
- return -EINVAL;
+
+ if (buf)
+ memcpy(pSMB->Data, buf, bytes_sent);
+ else if (ubuf) {
+ if (copy_from_user(pSMB->Data, ubuf, bytes_sent)) {
+ rc = -EFAULT;
+ goto out_release;
+ }
+ } else {
+ rc = -EINVAL;
+ goto out_release;
}
byte_count = bytes_sent + 1 /* pad */ ;
@@ -921,11 +925,14 @@
} else
*nbytes = le16_to_cpu(pSMBr->Count);
+ out_release:
if (pSMB)
cifs_buf_release(pSMB);
- /* Note: On -EAGAIN error only caller can retry on handle based calls
- since file handle passed in no longer valid */
+ /*
+ * Note: On -EAGAIN error only caller can retry on handle based calls
+ * since file handle passed in no longer valid
+ */
return rc;
}
Index: linux/fs/cifs/file.c
===================================================================
--- linux.orig/fs/cifs/file.c 2005-01-12 19:43:26.018610152 +0200
+++ linux/fs/cifs/file.c 2005-01-12 20:02:29.110833720 +0200
@@ -1165,8 +1165,12 @@
&bytes_read, &smb_read_data);
pSMBr = (struct smb_com_read_rsp *)smb_read_data;
- copy_to_user(current_offset,smb_read_data + 4/* RFC1001 hdr*/
+ rc = copy_to_user(current_offset, smb_read_data + 4 /* RFC1001 hdr */
+ le16_to_cpu(pSMBr->DataOffset), bytes_read);
+ if (rc) {
+ FreeXid(xid);
+ return -EFAULT;
+ }
if(smb_read_data) {
cifs_buf_release(smb_read_data);
smb_read_data = NULL;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/6] cifs: remove dead code
2005-01-15 13:25 [PATCH 1/6] cifs: copy_to_user and copy_from_user fixes Pekka Enberg
@ 2005-01-15 13:26 ` Pekka Enberg
2005-01-15 13:28 ` [PATCH 3/6] cifs: enum conversion Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:26 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
This patch removes commented out code.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
asn1.c | 122 ----------------------------------------------------------
cifsencrypt.c | 5 --
cifsfs.c | 25 -----------
cifssmb.c | 48 +---------------------
connect.c | 25 -----------
dir.c | 18 --------
fcntl.c | 5 --
file.c | 105 -------------------------------------------------
inode.c | 27 ------------
link.c | 13 ------
misc.c | 6 --
readdir.c | 62 -----------------------------
transport.c | 2
13 files changed, 6 insertions(+), 457 deletions(-)
Index: 2.6/fs/cifs/asn1.c
===================================================================
--- 2.6.orig/fs/cifs/asn1.c 2005-01-12 23:39:37.335242560 +0200
+++ 2.6/fs/cifs/asn1.c 2005-01-12 23:39:40.806714816 +0200
@@ -236,128 +236,6 @@
}
}
-/* static unsigned char asn1_null_decode(struct asn1_ctx *ctx,
- unsigned char *eoc)
-{
- ctx->pointer = eoc;
- return 1;
-}
-
-static unsigned char asn1_long_decode(struct asn1_ctx *ctx,
- unsigned char *eoc, long *integer)
-{
- unsigned char ch;
- unsigned int len;
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer = (signed char) ch;
- len = 1;
-
- while (ctx->pointer < eoc) {
- if (++len > sizeof(long)) {
- ctx->error = ASN1_ERR_DEC_BADVALUE;
- return 0;
- }
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer <<= 8;
- *integer |= ch;
- }
- return 1;
-}
-
-static unsigned char asn1_uint_decode(struct asn1_ctx *ctx,
- unsigned char *eoc,
- unsigned int *integer)
-{
- unsigned char ch;
- unsigned int len;
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer = ch;
- if (ch == 0)
- len = 0;
- else
- len = 1;
-
- while (ctx->pointer < eoc) {
- if (++len > sizeof(unsigned int)) {
- ctx->error = ASN1_ERR_DEC_BADVALUE;
- return 0;
- }
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer <<= 8;
- *integer |= ch;
- }
- return 1;
-}
-
-static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx,
- unsigned char *eoc,
- unsigned long *integer)
-{
- unsigned char ch;
- unsigned int len;
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer = ch;
- if (ch == 0)
- len = 0;
- else
- len = 1;
-
- while (ctx->pointer < eoc) {
- if (++len > sizeof(unsigned long)) {
- ctx->error = ASN1_ERR_DEC_BADVALUE;
- return 0;
- }
-
- if (!asn1_octet_decode(ctx, &ch))
- return 0;
-
- *integer <<= 8;
- *integer |= ch;
- }
- return 1;
-}
-
-static unsigned char
-asn1_octets_decode(struct asn1_ctx *ctx,
- unsigned char *eoc,
- unsigned char **octets, unsigned int *len)
-{
- unsigned char *ptr;
-
- *len = 0;
-
- *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC);
- if (*octets == NULL) {
- return 0;
- }
-
- ptr = *octets;
- while (ctx->pointer < eoc) {
- if (!asn1_octet_decode(ctx, (unsigned char *) ptr++)) {
- kfree(*octets);
- *octets = NULL;
- return 0;
- }
- (*len)++;
- }
- return 1;
-} */
-
static unsigned char
asn1_subid_decode(struct asn1_ctx *ctx, unsigned long *subid)
{
Index: 2.6/fs/cifs/cifsencrypt.c
===================================================================
--- 2.6.orig/fs/cifs/cifsencrypt.c 2005-01-12 23:39:37.336242408 +0200
+++ 2.6/fs/cifs/cifsencrypt.c 2005-01-12 23:39:40.807714664 +0200
@@ -120,9 +120,6 @@
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
@@ -198,11 +195,9 @@
{
struct HMACMD5Context context;
memcpy(v2_session_response + 8, ses->server->cryptKey,8);
- /* gen_blob(v2_session_response + 16); */
hmac_md5_init_limK_to_64(ses->mac_signing_key, 16, &context);
hmac_md5_update(ses->server->cryptKey,8,&context);
-/* hmac_md5_update(v2_session_response+16)client thing,8,&context); */ /* BB fix */
hmac_md5_final(v2_session_response,&context);
}
Index: 2.6/fs/cifs/cifsfs.c
===================================================================
--- 2.6.orig/fs/cifs/cifsfs.c 2005-01-12 23:39:37.337242256 +0200
+++ 2.6/fs/cifs/cifsfs.c 2005-01-12 23:39:40.808714512 +0200
@@ -109,8 +109,6 @@
sb->s_magic = CIFS_MAGIC_NUMBER;
sb->s_op = &cifs_super_ops;
-/* if(cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
- sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
#ifdef CONFIG_CIFS_QUOTA
sb->s_qcop = &cifs_quotactl_ops;
#endif
@@ -191,10 +189,6 @@
rc = CIFSSMBQFSInfo(xid, pTcon, buf, cifs_sb->local_nls);
- /*
- int f_type;
- __fsid_t f_fsid;
- int f_namelen; */
/* BB get from info put in tcon struct at mount time with call to QFSAttrInfo */
FreeXid(xid);
return 0; /* always return success? what if volume is no longer available? */
@@ -400,12 +394,7 @@
.statfs = cifs_statfs,
.alloc_inode = cifs_alloc_inode,
.destroy_inode = cifs_destroy_inode,
-/* .drop_inode = generic_delete_inode,
- .delete_inode = cifs_delete_inode, *//* Do not need the above two functions
- 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, *//* consider adding in the future */
.remount_fs = cifs_remount,
};
@@ -463,11 +452,6 @@
return generic_file_read(file,read_data,read_size,poffset);
} else {
/* BB do we need to lock inode from here until after invalidate? */
-/* if(file->f_dentry->d_inode->i_mapping) {
- filemap_fdatawrite(file->f_dentry->d_inode->i_mapping);
- filemap_fdatawait(file->f_dentry->d_inode->i_mapping);
- }*/
-/* cifs_revalidate(file->f_dentry);*/ /* BB fixme */
/* BB we should make timer configurable - perhaps
by simply calling cifs_revalidate here */
@@ -519,7 +503,6 @@
.name = "cifs",
.get_sb = cifs_get_sb,
.kill_sb = kill_anon_super,
- /* .fs_flags */
};
struct inode_operations cifs_dir_inode_ops = {
.create = cifs_create,
@@ -531,7 +514,6 @@
.rmdir = cifs_rmdir,
.rename = cifs_rename,
.permission = cifs_permission,
-/* revalidate:cifs_revalidate, */
.setattr = cifs_setattr,
.symlink = cifs_symlink,
.mknod = cifs_mknod,
@@ -544,7 +526,6 @@
};
struct inode_operations cifs_file_inode_ops = {
-/* revalidate:cifs_revalidate, */
.setattr = cifs_setattr,
.getattr = cifs_getattr, /* do we need this anymore? */
.rename = cifs_rename,
@@ -562,9 +543,6 @@
.follow_link = cifs_follow_link,
.put_link = cifs_put_link,
.permission = cifs_permission,
- /* BB add the following two eventually */
- /* revalidate: cifs_revalidate,
- setattr: cifs_notify_change, *//* BB do we need notify change */
#ifdef CONFIG_CIFS_XATTR
.setxattr = cifs_setxattr,
.getxattr = cifs_getxattr,
@@ -641,7 +619,6 @@
} else {
CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
}
-/* cERROR(1,("CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize)); */
cifs_req_cachep = kmem_cache_create("cifs_request",
CIFSMaxBufSize +
MAX_CIFS_HDR_SIZE, 0,
@@ -794,7 +771,6 @@
deadlock when oplock received on delete
since vfs_unlink holds the i_sem across
the call */
- /* down(&inode->i_sem);*/
if (S_ISREG(inode->i_mode)) {
rc = filemap_fdatawrite(inode->i_mapping);
if(CIFS_I(inode)->clientCanCacheRead == 0) {
@@ -803,7 +779,6 @@
}
} else
rc = 0;
- /* up(&inode->i_sem);*/
if (rc)
CIFS_I(inode)->write_behind_rc = rc;
cFYI(1,("Oplock flush inode %p rc %d",inode,rc));
Index: 2.6/fs/cifs/cifssmb.c
===================================================================
--- 2.6.orig/fs/cifs/cifssmb.c 2005-01-12 23:39:39.111972456 +0200
+++ 2.6/fs/cifs/cifssmb.c 2005-01-12 23:39:40.817713144 +0200
@@ -739,8 +739,6 @@
if (tcon->ses->capabilities & CAP_UNIX)
pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS);
- /* if ((omode & S_IWUGO) == 0)
- pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/
/* Above line causes problems due to vfs splitting create into two
pieces - need to set mode after file created not while it is
being created */
@@ -838,10 +836,6 @@
pReadData =
(char *) (&pSMBr->hdr.Protocol) +
le16_to_cpu(pSMBr->DataOffset);
-/* if(rc = copy_to_user(buf, pReadData, data_length)) {
- cERROR(1,("Faulting on read rc = %d",rc));
- rc = -EFAULT;
- }*/ /* can not use copy_to_user when using page cache*/
if(*buf)
memcpy(*buf,pReadData,data_length);
}
@@ -979,13 +973,7 @@
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
-/* rc = SendReceive2(xid, tcon->ses, (struct smb_hdr *) pSMB,
- (struct smb_hdr *) pSMBr, buf, buflen, &bytes_returned, long_op); */ /* BB fixme BB */
- if (rc) {
- cFYI(1, ("Send error in write2 (large write) = %d", rc));
- *nbytes = 0;
- } else
- *nbytes = le16_to_cpu(pSMBr->Count);
+ *nbytes = le16_to_cpu(pSMBr->Count);
if (pSMB)
cifs_small_buf_release(pSMB);
@@ -1774,9 +1762,6 @@
ace->e_perm = (__u16)cifs_ace->cifs_e_perm;
ace->e_tag = (__u16)cifs_ace->cifs_e_tag;
ace->e_id = (__u32)le64_to_cpu(cifs_ace->cifs_uid);
- /* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */
-
- return;
}
/* Convert ACL from CIFS POSIX wire format to local Linux POSIX ACL xattr */
@@ -1846,7 +1831,6 @@
cifs_ace->cifs_uid = cpu_to_le64(-1);
} else
cifs_ace->cifs_uid = (__u64)cpu_to_le32(local_ace->e_id);
- /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/
return rc;
}
@@ -2079,7 +2063,6 @@
int name_len;
__u16 params, byte_count;
-/* cFYI(1, ("In QPathInfo path %s", searchName)); */ /* BB fixme BB */
QPathInfoRetry:
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
(void **) &pSMBr);
@@ -2537,7 +2520,6 @@
psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount);
psrch_inf->index_of_last_entry =
psrch_inf->entries_in_buffer;
-/*cFYI(1,("entries in buf %d index_of_last %d",psrch_inf->entries_in_buffer,psrch_inf->index_of_last_entry)); */
*pnetfid = parms->SearchHandle;
} else {
if(pSMB)
@@ -2590,15 +2572,6 @@
pSMB->SearchHandle = searchHandle; /* always kept as le */
pSMB->SearchCount =
cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_UNIX_INFO));
- /* test for Unix extensions */
-/* if (tcon->ses->capabilities & CAP_UNIX) {
- pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_UNIX);
- psrch_inf->info_level = SMB_FIND_FILE_UNIX;
- } else {
- pSMB->InformationLevel =
- cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO);
- psrch_inf->info_level = SMB_FIND_FILE_DIRECTORY_INFO;
- } */
pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
pSMB->ResumeKey = psrch_inf->resume_key;
pSMB->SearchFlags =
@@ -2653,8 +2626,6 @@
psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount);
psrch_inf->index_of_last_entry +=
psrch_inf->entries_in_buffer;
-/* cFYI(1,("fnxt2 entries in buf %d index_of_last %d",psrch_inf->entries_in_buffer,psrch_inf->index_of_last_entry)); */
-
/* BB fixme add unlock here */
}
@@ -3798,8 +3769,6 @@
}
if (pSMB)
cifs_buf_release(pSMB);
-/* if (rc == -EAGAIN)
- goto NotifyRetry; */
return rc;
}
#ifdef CONFIG_CIFS_XATTR
@@ -3875,11 +3844,7 @@
of these trans2 responses */
if (rc || (pSMBr->ByteCount < 4))
rc = -EIO; /* bad smb */
- /* else if (pFindData){
- memcpy((char *) pFindData,
- (char *) &pSMBr->hdr.Protocol +
- data_offset, kl);
- }*/ else {
+ else {
/* check that length of list is not more than bcc */
/* check that each entry does not go beyond length
of list */
@@ -3888,7 +3853,6 @@
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
struct fealist * ea_response_data;
rc = 0;
- /* validate_trans2_offsets() */
/* BB to check if(start of smb + data_offset > &bcc+ bcc)*/
ea_response_data = (struct fealist *)
(((char *) &pSMBr->hdr.Protocol) +
@@ -4019,11 +3983,7 @@
of these trans2 responses */
if (rc || (pSMBr->ByteCount < 4))
rc = -EIO; /* bad smb */
- /* else if (pFindData){
- memcpy((char *) pFindData,
- (char *) &pSMBr->hdr.Protocol +
- data_offset, kl);
- }*/ else {
+ else {
/* check that length of list is not more than bcc */
/* check that each entry does not go beyond length
of list */
@@ -4032,7 +3992,6 @@
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
struct fealist * ea_response_data;
rc = -ENODATA;
- /* validate_trans2_offsets() */
/* BB to check if(start of smb + data_offset > &bcc+ bcc)*/
ea_response_data = (struct fealist *)
(((char *) &pSMBr->hdr.Protocol) +
@@ -4176,7 +4135,6 @@
we need to ensure that it fits within the smb */
/*BB add length check that 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);
Index: 2.6/fs/cifs/connect.c
===================================================================
--- 2.6.orig/fs/cifs/connect.c 2005-01-12 23:39:37.344241192 +0200
+++ 2.6/fs/cifs/connect.c 2005-01-12 23:39:40.821712536 +0200
@@ -184,7 +184,6 @@
if(server->tcpStatus != CifsExiting)
server->tcpStatus = CifsGood;
spin_unlock(&GlobalMid_Lock);
- /* atomic_set(&server->inFlight,0);*/
wake_up(&server->response_q);
}
}
@@ -1200,8 +1199,6 @@
xid = GetXid();
-/* cFYI(1, ("Entering cifs_mount. Xid: %d with: %s", xid, mount_data)); */
-
memset(&volume_info,0,sizeof(struct smb_vol));
if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
if(volume_info.UNC)
@@ -1518,7 +1515,6 @@
} else
cFYI(1, ("No session or bad tcon"));
sesInfoFree(pSesInfo);
- /* pSesInfo = NULL; */
}
}
} else {
@@ -1928,7 +1924,6 @@
rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
&bytes_returned, 1);
if (rc) {
-/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */
} else if ((smb_buffer_response->WordCount == 3)
|| (smb_buffer_response->WordCount == 4)) {
__u16 action = le16_to_cpu(pSMBr->resp.Action);
@@ -2137,7 +2132,7 @@
negotiate_flags =
NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM |
NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 |
- /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128;
+ NTLMSSP_NEGOTIATE_128;
if(sign_CIFS_PDUs)
negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN;
if(ntlmv2_support)
@@ -2218,7 +2213,6 @@
rc = 0;
if (rc) {
-/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */
} else if ((smb_buffer_response->WordCount == 3)
|| (smb_buffer_response->WordCount == 4)) {
__u16 action = le16_to_cpu(pSMBr->resp.Action);
@@ -2483,7 +2477,7 @@
NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO |
0x80000000 | NTLMSSP_NEGOTIATE_128;
if(sign_CIFS_PDUs)
- negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN;
+ negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN;
if(ntlmv2_flag)
negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2;
@@ -2548,14 +2542,6 @@
cpu_to_le16(len);
}
- /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage);
- SecurityBlob->WorkstationName.Length *= 2;
- SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length);
- SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength);
- bcc_ptr += SecurityBlob->WorkstationName.Length;
- SecurityBlobLength += SecurityBlob->WorkstationName.Length;
- SecurityBlob->WorkstationName.Length = cpu_to_le16(SecurityBlob->WorkstationName.Length); */
-
if ((long) bcc_ptr % 2) {
*bcc_ptr = 0;
bcc_ptr++;
@@ -2633,7 +2619,6 @@
rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
&bytes_returned, 1);
if (rc) {
-/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */
} else if ((smb_buffer_response->WordCount == 3)
|| (smb_buffer_response->WordCount == 4)) {
__u16 action = le16_to_cpu(pSMBr->resp.Action);
@@ -2641,9 +2626,6 @@
le16_to_cpu(pSMBr->resp.SecurityBlobLength);
if (action & GUEST_LOGIN)
cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */
-/* if(SecurityBlob2->MessageType != NtLm??){
- cFYI("Unexpected message type on auth response is %d "));
- } */
if (ses) {
cFYI(1,
("Does UID on challenge %d match auth response UID %d ",
@@ -2856,8 +2838,6 @@
rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0);
- /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */
- /* above now done in SendReceive */
if ((rc == 0) && (tcon != NULL)) {
tcon->tidStatus = CifsGood;
tcon->tid = smb_buffer_response->Tid;
@@ -3017,7 +2997,6 @@
v2_response = kmalloc(16 + 64 /* blob */, GFP_KERNEL);
if(v2_response) {
CalcNTLMv2_response(pSesInfo,v2_response);
-/* cifs_calculate_ntlmv2_mac_key(pSesInfo->mac_signing_key, response, ntlm_session_key, */
kfree(v2_response);
/* BB Put dummy sig in SessSetup PDU? */
} else
Index: 2.6/fs/cifs/dir.c
===================================================================
--- 2.6.orig/fs/cifs/dir.c 2005-01-12 23:39:37.345241040 +0200
+++ 2.6/fs/cifs/dir.c 2005-01-12 23:39:40.822712384 +0200
@@ -297,7 +297,6 @@
pCifsFile->closePend = FALSE;
init_MUTEX(&pCifsFile->fh_sem);
/* put the following in at open now */
- /* pCifsFile->pfile = file; */
write_lock(&GlobalSMBSeslock);
list_add(&pCifsFile->tlist,&pTcon->openFileList);
pCifsInode = CIFS_I(newinode);
@@ -489,11 +488,8 @@
{
int isValid = 1;
-/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */
-
if (direntry->d_inode) {
if (cifs_revalidate(direntry)) {
- /* unlock_kernel(); */
return 0;
}
} else {
@@ -501,23 +497,9 @@
("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p",
direntry->d_name.name, direntry));
}
-
-/* unlock_kernel(); */
-
return isValid;
}
-/* static int cifs_d_delete(struct dentry *direntry)
-{
- int rc = 0;
-
- cFYI(1, ("In cifs d_delete, name = %s", direntry->d_name.name));
-
- return rc;
-} */
-
struct dentry_operations cifs_dentry_ops = {
.d_revalidate = cifs_d_revalidate,
-/* d_delete: cifs_d_delete, *//* not needed except for debugging */
- /* no need for d_hash, d_compare, d_release, d_iput ... yet. BB confirm this BB */
};
Index: 2.6/fs/cifs/fcntl.c
===================================================================
--- 2.6.orig/fs/cifs/fcntl.c 2005-01-12 23:39:37.346240888 +0200
+++ 2.6/fs/cifs/fcntl.c 2005-01-12 23:39:40.823712232 +0200
@@ -58,11 +58,6 @@
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
FILE_NOTIFY_CHANGE_ATTRIBUTES;
}
-/* if(fcntl_notify_flags & DN_MULTISHOT) {
- cifs_ntfy_flags |= ;
- } */ /* BB fixme - not sure how to handle this with CIFS yet */
-
-
return cifs_ntfy_flags;
}
Index: 2.6/fs/cifs/file.c
===================================================================
--- 2.6.orig/fs/cifs/file.c 2005-01-12 23:39:39.114972000 +0200
+++ 2.6/fs/cifs/file.c 2005-01-12 23:39:40.826711776 +0200
@@ -340,14 +340,6 @@
and server version of file size can be stale. If we
knew for sure that inode was not dirty locally we could do this */
-/* buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
- if(buf==0) {
- up(&pCifsFile->fh_sem);
- if (full_path)
- kfree(full_path);
- FreeXid(xid);
- return -ENOMEM;
- }*/
rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess,
CREATE_NOT_DIR, &netfid, &oplock, NULL, cifs_sb->local_nls);
if (rc) {
@@ -584,7 +576,6 @@
rc = 0;
} else {
- /* if rc == ERR_SHARING_VIOLATION ? */
rc = 0; /* do not change lock type to unlock since range in use */
}
@@ -624,10 +615,6 @@
}
pTcon = cifs_sb->tcon;
- /*cFYI(1,
- (" write %d bytes to offset %lld of %s", write_size,
- *poffset, file->f_dentry->d_name.name)); */
-
if (file->private_data == NULL) {
return -EBADF;
} else {
@@ -744,10 +731,6 @@
}
pTcon = cifs_sb->tcon;
- /*cFYI(1,
- (" write %d bytes to offset %lld of %s", write_size,
- *poffset, file->f_dentry->d_name.name)); */
-
if (file->private_data == NULL) {
return -EBADF;
} else {
@@ -937,20 +920,6 @@
return rc;
}
-#if 0
-static int
-cifs_writepages(struct address_space *mapping, struct writeback_control *wbc)
-{
- int rc = -EFAULT;
- int xid;
-
- xid = GetXid();
-/* call 16K write then Setpageuptodate */
- FreeXid(xid);
- return rc;
-}
-#endif
-
static int
cifs_writepage(struct page* page, struct writeback_control *wbc)
{
@@ -986,30 +955,6 @@
cFYI(1,("commit write for page %p up to position %lld for %d",page,position,to));
if (position > inode->i_size){
i_size_write(inode, position);
- /*if (file->private_data == NULL) {
- rc = -EBADF;
- } else {
- open_file = (struct cifsFileInfo *)file->private_data;
- cifs_sb = CIFS_SB(inode->i_sb);
- rc = -EAGAIN;
- while(rc == -EAGAIN) {
- if((open_file->invalidHandle) &&
- (!open_file->closePend)) {
- rc = cifs_reopen_file(file->f_dentry->d_inode,file);
- if(rc != 0)
- break;
- }
- if(!open_file->closePend) {
- rc = CIFSSMBSetFileSize(xid, cifs_sb->tcon,
- position, open_file->netfid,
- open_file->pid,FALSE);
- } else {
- rc = -EBADF;
- break;
- }
- }
- cFYI(1,(" SetEOF (commit write) rc = %d",rc));
- }*/
}
if (!PageUptodate(page)) {
position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset;
@@ -1031,7 +976,6 @@
&position);
if(rc > 0)
rc = 0;
- /* else if rc < 0 should we set writebehind rc? */
kunmap(page);
} else {
set_page_dirty(page);
@@ -1060,33 +1004,6 @@
return rc;
}
-/* static int
-cifs_sync_page(struct page *page)
-{
- struct address_space *mapping;
- struct inode *inode;
- unsigned long index = page->index;
- unsigned int rpages = 0;
- int rc = 0;
-
- cFYI(1,("sync page %p",page));
- mapping = page->mapping;
- if (!mapping)
- return 0;
- inode = mapping->host;
- if (!inode)
- return 0;*/
-
-/* fill in rpages then
- result = cifs_pagein_inode(inode, index, rpages); *//* BB finish */
-
-/* cFYI(1, ("rpages is %d for sync page of Index %ld ", rpages, index));
-
- if (rc < 0)
- return rc;
- return 0;
-} */
-
/*
* As file closes, flush all cached write data for this inode checking
* for write behind errors.
@@ -1444,13 +1361,6 @@
/* server copy of file can have smaller size than client */
/* BB do we need to verify this common case ? this case is ok -
if we are at server EOF we will hit it on next read */
-
- /* while(!list_empty(page_list) && (i < num_pages)) {
- page = list_entry(page_list->prev,struct page, list);
- list_del(&page->list);
- page_cache_release(page);
- }
- break; */
}
} else {
cFYI(1,("No bytes read (%d) at offset %lld . Cleaning remaining pages from readahead list",bytes_read,offset));
@@ -1622,10 +1532,6 @@
tmp_inode->i_mode = cifs_sb->mnt_dir_mode;
}
tmp_inode->i_mode |= S_IFDIR;
-/* we no longer mark these because we could not follow them */
-/* } else if (attr & ATTR_REPARSE) {
- *pobject_type = DT_LNK;
- tmp_inode->i_mode |= S_IFLNK;*/
} else {
*pobject_type = DT_REG;
tmp_inode->i_mode |= S_IFREG;
@@ -1746,7 +1652,6 @@
} else if (S_ISLNK(tmp_inode->i_mode)) {
cFYI(1, ("Symbolic Link inode"));
tmp_inode->i_op = &cifs_symlink_inode_ops;
-/* tmp_inode->i_fop = *//* do not need to set to anything */
} else {
cFYI(1, ("Special inode"));
init_special_inode(tmp_inode, tmp_inode->i_mode,
@@ -2179,7 +2084,6 @@
(FILE_DIRECTORY_INFO *) ((char *) pfindData
+ le32_to_cpu(pfindData->NextEntryOffset));
/* BB also should check to make sure that pointer is not beyond the end of the SMB */
- /* if(pfindData > lastFindData) rc = -EIO; break; */
} /* end for loop */
if ((findParms.EndofSearch != 0) && cifsFile) {
cifsFile->srch_inf.endOfSearch = TRUE;
@@ -2405,13 +2309,6 @@
loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
cFYI(1,("prepare write for page %p from %d to %d",page,from,to));
if (!PageUptodate(page)) {
- /* if (to - from != PAGE_CACHE_SIZE) {
- void *kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr, 0, from);
- memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
- flush_dcache_page(page);
- kunmap_atomic(kaddr, KM_USER0);
- } */
/* If we are writing a full page it will be up to date,
no need to read from the server */
if((to==PAGE_CACHE_SIZE) && (from == 0))
@@ -2440,6 +2337,4 @@
.prepare_write = cifs_prepare_write,
.commit_write = cifs_commit_write,
.set_page_dirty = __set_page_dirty_nobuffers,
- /* .sync_page = cifs_sync_page, */
- /*.direct_IO = */
};
Index: 2.6/fs/cifs/inode.c
===================================================================
--- 2.6.orig/fs/cifs/inode.c 2005-01-12 23:39:37.350240280 +0200
+++ 2.6/fs/cifs/inode.c 2005-01-12 23:39:40.828711472 +0200
@@ -49,7 +49,6 @@
/* we could have done a find first instead but this returns more info */
rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData,
cifs_sb->local_nls);
- /* dump_mem("\nUnixQPathInfo return data", &findData, sizeof(findData)); */
if (rc) {
if (rc == -EREMOTE) {
tmp_path =
@@ -149,9 +148,6 @@
size of 512 is required to be used for calculating num blocks */
-/* inode->i_blocks =
- (inode->i_blksize - 1 + num_of_bytes) >> inode->i_blkbits;*/
-
/* 512 bytes (2**9) is the fake blocksize that must be used */
/* for this calculation */
inode->i_blocks = (512 - 1 + num_of_bytes) >> 9;
@@ -174,7 +170,6 @@
} else if (S_ISLNK(inode->i_mode)) {
cFYI(1, (" Symbolic Link inode "));
inode->i_op = &cifs_symlink_inode_ops;
-/* tmp_inode->i_fop = *//* do not need to set to anything */
} else {
cFYI(1, (" Init special inode "));
init_special_inode(inode, inode->i_mode,
@@ -215,7 +210,6 @@
rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
cifs_sb->local_nls);
}
- /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
if (rc) {
if (rc == -EREMOTE) {
tmp_path =
@@ -261,11 +255,6 @@
Are there Windows server or network appliances
for which IndexNumber field is not guaranteed unique? */
- /* if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
- (*pinode)->i_ino =
- (unsigned long)pfindData->IndexNumber;
- } */ /*NB: ino incremented to unique num in new_inode*/
-
insert_inode_hash(*pinode);
}
inode = *pinode;
@@ -295,7 +284,6 @@
/* new inode, can safely set these fields */
inode->i_mode = cifs_sb->mnt_file_mode;
-/* if (attr & ATTR_REPARSE) */
/* We no longer handle these as symlinks because we could not */
/* follow them due to the absolute path with drive letter */
if (attr & ATTR_DIRECTORY) {
@@ -391,9 +379,7 @@
/* Unlink can be called from rename so we can not grab
the sem here since we deadlock otherwise */
-/* down(&direntry->d_sb->s_vfs_rename_sem);*/
full_path = build_path_from_dentry(direntry);
-/* up(&direntry->d_sb->s_vfs_rename_sem);*/
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
@@ -730,16 +716,12 @@
direntry->d_sb,xid);
if(rc) {
cFYI(1,("error on getting revalidate info %d",rc));
-/* if(rc != -ENOENT)
- rc = 0; */ /* BB should we cache info on certain errors? */
}
} else {
rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL,
direntry->d_sb,xid);
if(rc) {
cFYI(1,("error on getting revalidate info %d",rc));
-/* if(rc != -ENOENT)
- rc = 0; */ /* BB should we cache info on certain errors? */
}
}
/* should we remap certain errors, access denied?, to zero */
@@ -765,7 +747,6 @@
documentation indicates i_sem may be taken by the kernel
on lookup and rename which could deadlock if we grab
the i_sem here as well */
-/* down(&direntry->d_inode->i_sem);*/
/* need to write out dirty pages here */
if(direntry->d_inode->i_mapping) {
/* do we need to lock inode until after invalidate completes below? */
@@ -780,7 +761,6 @@
invalidate_remote_inode(direntry->d_inode);
}
}
-/* up(&direntry->d_inode->i_sem);*/
if (full_path)
kfree(full_path);
@@ -907,7 +887,6 @@
}
/* Server is ok setting allocation size implicitly - no need to call: */
- /*CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, TRUE, cifs_sb->local_nls);*/
if (rc == 0) {
rc = vmtruncate(direntry->d_inode, attrs->ia_size);
@@ -917,19 +896,16 @@
if (attrs->ia_valid & ATTR_UID) {
cFYI(1, (" CIFS - UID changed to %d", attrs->ia_uid));
uid = attrs->ia_uid;
- /* entry->uid = cpu_to_le16(attr->ia_uid); */
}
if (attrs->ia_valid & ATTR_GID) {
cFYI(1, (" CIFS - GID changed to %d", attrs->ia_gid));
gid = attrs->ia_gid;
- /* entry->gid = cpu_to_le16(attr->ia_gid); */
}
time_buf.Attributes = 0;
if (attrs->ia_valid & ATTR_MODE) {
cFYI(1, (" CIFS - Mode changed to 0x%x", attrs->ia_mode));
mode = attrs->ia_mode;
- /* entry->mode = cpu_to_le16(attr->ia_mode); */
}
if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX)
@@ -947,7 +923,6 @@
cpu_to_le32(cifsInode->cifsAttrs & (~ATTR_READONLY));
}
/* BB to be implemented - via Windows security descriptors or streams */
- /* CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,uid,gid,cifs_sb->local_nls);*/
}
if (attrs->ia_valid & ATTR_ATIME) {
@@ -987,8 +962,6 @@
below rather than here */
/* Better to return EOPNOTSUPP until function
below is ready */
- /* CIFSSMBSetTimesLegacy(xid, pTcon, full_path,
- FILE_INFO_STANDARD * data, cifs_sb->local_nls); */
}
}
Index: 2.6/fs/cifs/link.c
===================================================================
--- 2.6.orig/fs/cifs/link.c 2005-01-12 23:39:37.352239976 +0200
+++ 2.6/fs/cifs/link.c 2005-01-12 23:39:40.829711320 +0200
@@ -67,14 +67,6 @@
rc = -EOPNOTSUPP;
}
-/* if (!rc) */
- {
- /* renew_parental_timestamps(old_file);
- inode->i_nlink++;
- mark_inode_dirty(inode);
- d_instantiate(direntry, inode); */
- /* BB add call to either mark inode dirty or refresh its data and timestamp to current time */
- }
d_drop(direntry); /* force new lookup from server */
cifsInode = CIFS_I(old_file->d_inode);
cifsInode->time = 0; /* will force revalidate to go get info when needed */
@@ -124,7 +116,6 @@
PATH_MAX-1,
cifs_sb->local_nls);
else {
- /* rc = CIFSSMBQueryReparseLinkInfo */
/* BB Add code to Query ReparsePoint info */
/* BB Add MAC style xsymlink check here if enabled */
}
@@ -178,8 +169,6 @@
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname,
cifs_sb->local_nls);
- /* else
- rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,cifs_sb_target->local_nls); */
if (rc == 0) {
if (pTcon->ses->capabilities & CAP_UNIX)
@@ -228,9 +217,7 @@
/* BB would it be safe against deadlock to grab this sem
even though rename itself grabs the sem and calls lookup? */
-/* down(&inode->i_sb->s_vfs_rename_sem);*/
full_path = build_path_from_dentry(direntry);
-/* up(&inode->i_sb->s_vfs_rename_sem);*/
if(full_path == NULL) {
FreeXid(xid);
Index: 2.6/fs/cifs/misc.c
===================================================================
--- 2.6.orig/fs/cifs/misc.c 2005-01-12 23:39:37.353239824 +0200
+++ 2.6/fs/cifs/misc.c 2005-01-12 23:39:40.830711168 +0200
@@ -59,8 +59,6 @@
_FreeXid(unsigned int xid)
{
spin_lock(&GlobalMid_Lock);
- /* if(GlobalTotalActiveXid == 0)
- BUG(); */
GlobalTotalActiveXid--;
spin_unlock(&GlobalMid_Lock);
}
@@ -175,13 +173,11 @@
{
if (buf_to_free == NULL) {
- /* cFYI(1, ("Null buffer passed to cifs_buf_release"));*/
return;
}
mempool_free(buf_to_free,cifs_req_poolp);
atomic_dec(&bufAllocCount);
- return;
}
struct smb_hdr *
@@ -197,7 +193,6 @@
(struct smb_hdr *) mempool_alloc(cifs_sm_req_poolp, SLAB_KERNEL | SLAB_NOFS);
if (ret_buf) {
/* No need to clear memory here, cleared in header assemble */
- /* memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/
atomic_inc(&smBufAllocCount);
}
return ret_buf;
@@ -404,7 +399,6 @@
+ data_offset);
cFYI(1,("dnotify on %s with action: 0x%x",pnotify->FileName,
pnotify->Action)); /* BB removeme BB */
- /* cifs_dump_mem("Received notify Data is: ",buf,sizeof(struct smb_hdr)+60); */
return TRUE;
}
if(pSMBr->hdr.Status.CifsError) {
Index: 2.6/fs/cifs/readdir.c
===================================================================
--- 2.6.orig/fs/cifs/readdir.c 2005-01-12 23:39:37.355239520 +0200
+++ 2.6/fs/cifs/readdir.c 2005-01-12 23:39:40.832710864 +0200
@@ -47,30 +47,6 @@
FILE_UNIX_INFO * pfindData, int *pobject_type);
-/* BB fixme - add debug wrappers around this function to disable it fixme BB */
-/* static void dump_cifs_file_struct(struct file * file, char * label)
-{
- struct cifsFileInfo * cf;
-
- if(file) {
- cf = (struct cifsFileInfo *)file->private_data;
- if(cf == NULL) {
- cFYI(1,("empty cifs private file data"));
- return;
- }
- if(cf->invalidHandle) {
- cFYI(1,("invalid handle"));
- }
- if(cf->srch_inf.endOfSearch) {
- cFYI(1,("end of search"));
- }
- if(cf->srch_inf.emptyDir) {
- cFYI(1,("empty dir"));
- }
-
- }
-} */
-
static int initiate_cifs_search(const int xid, struct file * file)
{
int rc = 0;
@@ -255,7 +231,6 @@
first_entry_in_buffer =
cifsFile->srch_inf.index_of_last_entry -
cifsFile->srch_inf.entries_in_buffer;
-/* dump_cifs_file_struct(file, "In fce ");*/
if(index_to_find < first_entry_in_buffer) {
/* close and restart search */
cFYI(1,("search backing up - close and restart search"));
@@ -290,7 +265,6 @@
char * current_entry;
char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start +
smbCalcSize((struct smb_hdr *)cifsFile->srch_inf.ntwrk_buf_start);
-/* dump_cifs_file_struct(file,"found entry in fce "); */
first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry -
cifsFile->srch_inf.entries_in_buffer;
pos_in_buf = index_to_find - first_entry_in_buffer;
@@ -325,7 +299,6 @@
*num_to_ret = 0;
} else
*num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf;
-/* dump_cifs_file_struct(file, "end fce ");*/
return rc;
}
@@ -388,7 +361,6 @@
pqst->len = len;
}
pqst->hash = full_name_hash(pqst->name,pqst->len);
-/* cFYI(1,("filldir on %s",pqst->name)); */
return rc;
}
@@ -533,32 +505,15 @@
FreeXid(xid);
return -EIO;
}
-/* dump_cifs_file_struct(file, "Begin rdir "); */
cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon;
if(pTcon == NULL)
return -EINVAL;
-/* cFYI(1,("readdir2 pos: %lld",file->f_pos)); */
-
switch ((int) file->f_pos) {
case 0:
- /*if (filldir(direntry, ".", 1, file->f_pos,
- file->f_dentry->d_inode->i_ino, DT_DIR) < 0) {
- cERROR(1, ("Filldir for current dir failed "));
- rc = -ENOMEM;
- break;
- }
- file->f_pos++; */
case 1:
- /* if (filldir(direntry, "..", 2, file->f_pos,
- file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) {
- cERROR(1, ("Filldir for parent dir failed "));
- rc = -ENOMEM;
- break;
- }
- file->f_pos++; */
case 2:
/* 1) If search is active,
is in current search buffer?
@@ -586,14 +541,7 @@
rc = 0;
break;
}
- } /* else {
- cifsFile->invalidHandle = TRUE;
- CIFSFindClose(xid, pTcon, cifsFile->netfid);
- }
- if(cifsFile->search_resume_name) {
- kfree(cifsFile->search_resume_name);
- cifsFile->search_resume_name = NULL;
- } */
+ }
/* BB account for . and .. in f_pos */
/* dump_cifs_file_struct(file, "rdir after default ");*/
@@ -618,13 +566,6 @@
cERROR(1,("beyond end of smb with num to fill %d i %d",num_to_fill,i)); /* BB removeme BB */
break;
}
-/* if((!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) ||
- (cifsFile->srch_inf.info_level != something that supports server inodes)) {
- create dentry
- create inode
- fill in inode new_inode (which makes number locally)
- }
- also create local inode for per reasons unless new mount parm says otherwise */
rc = cifs_filldir2(current_entry, file,
filldir, direntry,tmp_buf);
file->f_pos++;
@@ -641,7 +582,6 @@
} /* end switch */
rddir2_exit:
- /* dump_cifs_file_struct(file, "end rdir "); */
FreeXid(xid);
return rc;
}
Index: 2.6/fs/cifs/transport.c
===================================================================
--- 2.6.orig/fs/cifs/transport.c 2005-01-12 23:39:37.356239368 +0200
+++ 2.6/fs/cifs/transport.c 2005-01-12 23:39:40.833710712 +0200
@@ -285,8 +285,6 @@
rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number);
midQ->midState = MID_REQUEST_SUBMITTED;
-/* rc = smb_send2(ses->server->ssocket, in_buf, in_buf->smb_buf_length, piovec,
- (struct sockaddr *) &(ses->server->addr.sockAddr));*/
if(rc < 0) {
DeleteMidQEntry(midQ);
up(&ses->server->tcpSem);
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/6] cifs: enum conversion
2005-01-15 13:26 ` [PATCH 2/6] cifs: remove dead code Pekka Enberg
@ 2005-01-15 13:28 ` Pekka Enberg
2005-01-15 13:29 ` [PATCH 4/6] cifs: remove spurious casts Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:28 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
Convert #defines to proper enums and remove duplicate symbols.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
asn1.c | 72 +++--
cifspdu.h | 798 ++++++++++++++++++++++++++++++++------------------------------
2 files changed, 464 insertions(+), 406 deletions(-)
Index: 2.6/fs/cifs/asn1.c
===================================================================
--- 2.6.orig/fs/cifs/asn1.c 2005-01-15 15:07:18.115524784 +0200
+++ 2.6/fs/cifs/asn1.c 2005-01-15 15:07:20.647139920 +0200
@@ -34,46 +34,54 @@
*****************************************************************************/
/* Class */
-#define ASN1_UNI 0 /* Universal */
-#define ASN1_APL 1 /* Application */
-#define ASN1_CTX 2 /* Context */
-#define ASN1_PRV 3 /* Private */
+enum {
+ ASN1_UNI = 0, /* Universal */
+ ASN1_APL = 1, /* Application */
+ ASN1_CTX = 2, /* Context */
+ ASN1_PRV = 3 /* Private */
+};
/* Tag */
-#define ASN1_EOC 0 /* End Of Contents or N/A */
-#define ASN1_BOL 1 /* Boolean */
-#define ASN1_INT 2 /* Integer */
-#define ASN1_BTS 3 /* Bit String */
-#define ASN1_OTS 4 /* Octet String */
-#define ASN1_NUL 5 /* Null */
-#define ASN1_OJI 6 /* Object Identifier */
-#define ASN1_OJD 7 /* Object Description */
-#define ASN1_EXT 8 /* External */
-#define ASN1_SEQ 16 /* Sequence */
-#define ASN1_SET 17 /* Set */
-#define ASN1_NUMSTR 18 /* Numerical String */
-#define ASN1_PRNSTR 19 /* Printable String */
-#define ASN1_TEXSTR 20 /* Teletext String */
-#define ASN1_VIDSTR 21 /* Video String */
-#define ASN1_IA5STR 22 /* IA5 String */
-#define ASN1_UNITIM 23 /* Universal Time */
-#define ASN1_GENTIM 24 /* General Time */
-#define ASN1_GRASTR 25 /* Graphical String */
-#define ASN1_VISSTR 26 /* Visible String */
-#define ASN1_GENSTR 27 /* General String */
+enum {
+ ASN1_EOC = 0, /* End Of Contents or N/A */
+ ASN1_BOL = 1, /* Boolean */
+ ASN1_INT = 2, /* Integer */
+ ASN1_BTS = 3, /* Bit String */
+ ASN1_OTS = 4, /* Octet String */
+ ASN1_NUL = 5, /* Null */
+ ASN1_OJI = 6, /* Object Identifier */
+ ASN1_OJD = 7, /* Object Description */
+ ASN1_EXT = 8, /* External */
+ ASN1_SEQ = 16, /* Sequence */
+ ASN1_SET = 17, /* Set */
+ ASN1_NUMSTR = 18, /* Numerical String */
+ ASN1_PRNSTR = 19, /* Printable String */
+ ASN1_TEXSTR = 20, /* Teletext String */
+ ASN1_VIDSTR = 21, /* Video String */
+ ASN1_IA5STR = 22, /* IA5 String */
+ ASN1_UNITIM = 23, /* Universal Time */
+ ASN1_GENTIM = 24, /* General Time */
+ ASN1_GRASTR = 25, /* Graphical String */
+ ASN1_VISSTR = 26, /* Visible String */
+ ASN1_GENSTR = 27 /* General String */
+};
/* Primitive / Constructed methods*/
-#define ASN1_PRI 0 /* Primitive */
-#define ASN1_CON 1 /* Constructed */
+enum {
+ ASN1_PRI = 0, /* Primitive */
+ ASN1_CON = 1 /* Constructed */
+};
/*
* Error codes.
*/
-#define ASN1_ERR_NOERROR 0
-#define ASN1_ERR_DEC_EMPTY 2
-#define ASN1_ERR_DEC_EOC_MISMATCH 3
-#define ASN1_ERR_DEC_LENGTH_MISMATCH 4
-#define ASN1_ERR_DEC_BADVALUE 5
+enum {
+ ASN1_ERR_NOERROR = 0,
+ ASN1_ERR_DEC_EMPTY = 2,
+ ASN1_ERR_DEC_EOC_MISMATCH = 3,
+ ASN1_ERR_DEC_LENGTH_MISMATCH = 4,
+ ASN1_ERR_DEC_BADVALUE = 5
+};
#define SPNEGO_OID_LEN 7
#define NTLMSSP_OID_LEN 10
Index: 2.6/fs/cifs/cifspdu.h
===================================================================
--- 2.6.orig/fs/cifs/cifspdu.h 2005-01-12 23:46:16.000000000 +0200
+++ 2.6/fs/cifs/cifspdu.h 2005-01-15 15:11:07.013726968 +0200
@@ -28,61 +28,62 @@
#define BAD_PROT CIFS_PROT+1
/* SMB command codes */
-/* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
- (ie which include no useful data other than the SMB error code itself).
- Knowing this helps avoid response buffer allocations and copy in some cases */
-#define SMB_COM_CREATE_DIRECTORY 0x00 /* trivial response */
-#define SMB_COM_DELETE_DIRECTORY 0x01 /* trivial response */
-#define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */
-#define SMB_COM_DELETE 0x06 /* trivial response */
-#define SMB_COM_RENAME 0x07 /* trivial response */
-#define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */
-#define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/
-#define SMB_COM_READ_ANDX 0x2E
-#define SMB_COM_WRITE_ANDX 0x2F
-#define SMB_COM_TRANSACTION2 0x32
-#define SMB_COM_TRANSACTION2_SECONDARY 0x33
-#define SMB_COM_FIND_CLOSE2 0x34 /* trivial response */
-#define SMB_COM_TREE_DISCONNECT 0x71 /* trivial response */
-#define SMB_COM_NEGOTIATE 0x72
-#define SMB_COM_SESSION_SETUP_ANDX 0x73
-#define SMB_COM_LOGOFF_ANDX 0x74 /* trivial response */
-#define SMB_COM_TREE_CONNECT_ANDX 0x75
-#define SMB_COM_NT_TRANSACT 0xA0
-#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
-#define SMB_COM_NT_CREATE_ANDX 0xA2
-#define SMB_COM_NT_RENAME 0xA5 /* trivial response */
+/* Some commands have minimal (wct=0,bcc=0), or uninteresting, responses (ie
+ * which include no useful data other than the SMB error code itself). Knowing
+ * this helps avoid response buffer allocations and copy in some cases
+ */
+enum {
+ SMB_COM_CREATE_DIRECTORY = 0x00, /* trivial response */
+ SMB_COM_DELETE_DIRECTORY = 0x01, /* trivial response */
+ SMB_COM_CLOSE = 0x04, /* triv req/rsp, timestamp ignored */
+ SMB_COM_DELETE = 0x06, /* trivial response */
+ SMB_COM_RENAME = 0x07, /* trivial response */
+ SMB_COM_LOCKING_ANDX = 0x24, /* trivial response */
+ SMB_COM_COPY = 0x29, /* trivial rsp, fail filename ignrd*/
+ SMB_COM_READ_ANDX = 0x2E,
+ SMB_COM_WRITE_ANDX = 0x2F,
+ SMB_COM_TRANSACTION2 = 0x32,
+ SMB_COM_TRANSACTION2_SECONDARY = 0x33,
+ SMB_COM_FIND_CLOSE2 = 0x34, /* trivial response */
+ SMB_COM_TREE_DISCONNECT = 0x71, /* trivial response */
+ SMB_COM_NEGOTIATE = 0x72,
+ SMB_COM_SESSION_SETUP_ANDX = 0x73,
+ SMB_COM_LOGOFF_ANDX = 0x74, /* trivial response */
+ SMB_COM_TREE_CONNECT_ANDX = 0x75,
+ SMB_COM_NT_TRANSACT = 0xA0,
+ SMB_COM_NT_TRANSACT_SECONDARY = 0xA1,
+ SMB_COM_NT_CREATE_ANDX = 0xA2,
+ SMB_COM_NT_RENAME = 0xA5 /* trivial response */
+};
/* Transact2 subcommand codes */
-#define TRANS2_OPEN 0x00
-#define TRANS2_FIND_FIRST 0x01
-#define TRANS2_FIND_NEXT 0x02
-#define TRANS2_QUERY_FS_INFORMATION 0x03
-#define TRANS2_QUERY_PATH_INFORMATION 0x05
-#define TRANS2_SET_PATH_INFORMATION 0x06
-#define TRANS2_QUERY_FILE_INFORMATION 0x07
-#define TRANS2_SET_FILE_INFORMATION 0x08
-#define TRANS2_GET_DFS_REFERRAL 0x10
-#define TRANS2_REPORT_DFS_INCOSISTENCY 0x11
+enum {
+ TRANS2_OPEN = 0x00,
+ TRANS2_FIND_FIRST = 0x01,
+ TRANS2_FIND_NEXT = 0x02,
+ TRANS2_QUERY_FS_INFORMATION = 0x03,
+ TRANS2_QUERY_PATH_INFORMATION = 0x05,
+ TRANS2_SET_PATH_INFORMATION = 0x06,
+ TRANS2_QUERY_FILE_INFORMATION = 0x07,
+ TRANS2_SET_FILE_INFORMATION = 0x08,
+ TRANS2_GET_DFS_REFERRAL = 0x10,
+ TRANS2_REPORT_DFS_INCOSISTENCY = 0x11
+};
/* NT Transact subcommand codes */
-#define NT_TRANSACT_CREATE 0x01
-#define NT_TRANSACT_IOCTL 0x02
-#define NT_TRANSACT_SET_SECURITY_DESC 0x03
-#define NT_TRANSACT_NOTIFY_CHANGE 0x04
-#define NT_TRANSACT_RENAME 0x05
-#define NT_TRANSACT_QUERY_SECURITY_DESC 0x06
-#define NT_TRANSACT_GET_USER_QUOTA 0x07
-#define NT_TRANSACT_SET_USER_QUOTA 0x08
+enum {
+ NT_TRANSACT_CREATE = 0x01,
+ NT_TRANSACT_IOCTL = 0x02,
+ NT_TRANSACT_SET_SECURITY_DESC = 0x03,
+ NT_TRANSACT_NOTIFY_CHANGE = 0x04,
+ NT_TRANSACT_RENAME = 0x05,
+ NT_TRANSACT_QUERY_SECURITY_DESC = 0x06,
+ NT_TRANSACT_GET_USER_QUOTA = 0x07,
+ NT_TRANSACT_SET_USER_QUOTA = 0x08
+};
#define MAX_CIFS_HDR_SIZE 256 /* chained NTCreateXReadX will probably be biggest */
-/* internal cifs vfs structures */
-/*****************************************************************
- * All constants go here
- *****************************************************************
- */
-
/*
* Starting value for maximum SMB size negotiation
*/
@@ -111,31 +112,37 @@
/*
* Flags on SMB open
*/
-#define SMBOPEN_WRITE_THROUGH 0x4000
-#define SMBOPEN_DENY_ALL 0x0010
-#define SMBOPEN_DENY_WRITE 0x0020
-#define SMBOPEN_DENY_READ 0x0030
-#define SMBOPEN_DENY_NONE 0x0040
-#define SMBOPEN_READ 0x0000
-#define SMBOPEN_WRITE 0x0001
-#define SMBOPEN_READWRITE 0x0002
-#define SMBOPEN_EXECUTE 0x0003
-
-#define SMBOPEN_OCREATE 0x0010
-#define SMBOPEN_OTRUNC 0x0002
-#define SMBOPEN_OAPPEND 0x0001
+enum {
+ SMBOPEN_WRITE_THROUGH = 0x4000,
+ SMBOPEN_DENY_ALL = 0x0010,
+ SMBOPEN_DENY_WRITE = 0x0020,
+ SMBOPEN_DENY_READ = 0x0030,
+ SMBOPEN_DENY_NONE = 0x0040,
+ SMBOPEN_READ = 0x0000,
+ SMBOPEN_WRITE = 0x0001,
+ SMBOPEN_READWRITE = 0x0002,
+ SMBOPEN_EXECUTE = 0x0003
+};
+
+enum {
+ SMBOPEN_OCREATE = 0x0010,
+ SMBOPEN_OTRUNC = 0x0002,
+ SMBOPEN_OAPPEND = 0x0001
+};
/*
* SMB flag definitions
*/
-#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock primitives */
-#define SMBFLG_RCV_POSTED 0x02 /* obsolete */
-#define SMBFLG_RSVD 0x04
-#define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off implies case sensitive file handling requested) */
-#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */
-#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */
-#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */
-#define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */
+enum {
+ SMBFLG_EXTD_LOCK = 0x01, /* server supports lock-read write-unlock primitives */
+ SMBFLG_RCV_POSTED = 0x02, /* obsolete */
+ SMBFLG_RSVD = 0x04,
+ SMBFLG_CASELESS = 0x08, /* all pathnames treated as caseless (off implies case sensitive file handling requested) */
+ SMBFLG_CANONICAL_PATH_FORMAT = 0x10, /* obsolete */
+ SMBFLG_OLD_OPLOCK = 0x20, /* obsolete */
+ SMBFLG_OLD_OPLOCK_NOTIFY = 0x40, /* obsolete */
+ SMBFLG_RESPONSE = 0x80 /* this PDU is a response from server */
+};
/*
* SMB flag2 definitions
@@ -159,41 +166,43 @@
* file and can have any suitable combination of the following values:
*/
-#define FILE_READ_DATA 0x00000001 /* Data can be read from the file */
-#define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */
-#define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */
-#define FILE_READ_EA 0x00000008 /* Extended attributes associated */
- /* with the file can be read */
-#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */
- /* with the file can be written */
-#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */
- /* the file using system paging I/O */
-#define FILE_DELETE_CHILD 0x00000040
-#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */
- /* file can be read */
-#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */
- /* file can be written */
-#define DELETE 0x00010000 /* The file can be deleted */
-#define READ_CONTROL 0x00020000 /* The access control list and */
- /* ownership associated with the */
- /* file can be read */
-#define WRITE_DAC 0x00040000 /* The access control list and */
- /* ownership associated with the */
- /* file can be written. */
-#define WRITE_OWNER 0x00080000 /* Ownership information associated */
- /* with the file can be written */
-#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */
- /* synchronize with the completion */
- /* of an input/output request */
-#define GENERIC_ALL 0x10000000
-#define GENERIC_EXECUTE 0x20000000
-#define GENERIC_WRITE 0x40000000
-#define GENERIC_READ 0x80000000
+enum {
+ FILE_READ_DATA = 0x00000001, /* Data can be read from the file */
+ FILE_WRITE_DATA = 0x00000002, /* Data can be written to the file */
+ FILE_APPEND_DATA = 0x00000004, /* Data can be appended to the file */
+ FILE_READ_EA = 0x00000008, /* Extended attributes associated */
+ /* with the file can be read */
+ FILE_WRITE_EA = 0x00000010, /* Extended attributes associated */
+ /* with the file can be written */
+ FILE_EXECUTE = 0x00000020, /* Data can be read into memory from */
+ /* the file using system paging I/O */
+ FILE_DELETE_CHILD = 0x00000040,
+ FILE_READ_ATTRIBUTES = 0x00000080, /* Attributes associated with the */
+ /* file can be read */
+ FILE_WRITE_ATTRIBUTES = 0x00000100, /* Attributes associated with the */
+ /* file can be written */
+ DELETE = 0x00010000, /* The file can be deleted */
+ READ_CONTROL = 0x00020000, /* The access control list and */
+ /* ownership associated with the */
+ /* file can be read */
+ WRITE_DAC = 0x00040000, /* The access control list and */
+ /* ownership associated with the */
+ /* file can be written. */
+ WRITE_OWNER = 0x00080000, /* Ownership information associated */
+ /* with the file can be written */
+ SYNCHRONIZE = 0x00100000, /* The file handle can waited on to */
+ /* synchronize with the completion */
+ /* of an input/output request */
+ GENERIC_ALL = 0x10000000,
+ GENERIC_EXECUTE = 0x20000000,
+ GENERIC_WRITE = 0x40000000,
+ GENERIC_READ = 0x80000000
/* In summary - Relevant file */
/* access flags from CIFS are */
/* file_read_data, file_write_data */
/* file_execute, file_read_attributes */
/* write_dac, and delete. */
+};
/*
* Invalid readdir handle
@@ -211,75 +220,91 @@
#define ASCII_NULL 0x00
/*
- * Server type values (returned on EnumServer API
+ * Server type values (returned on EnumServer API)
*/
-#define CIFS_SV_TYPE_DC 0x00000008
-#define CIFS_SV_TYPE_BACKDC 0x00000010
+enum {
+ CIFS_SV_TYPE_DC = 0x00000008,
+ CIFS_SV_TYPE_BACKDC = 0x00000010
+};
/*
- * Alias type flags (From EnumAlias API call
+ * Alias type flags (From EnumAlias API call)
*/
-#define CIFS_ALIAS_TYPE_FILE 0x0001
-#define CIFS_SHARE_TYPE_FILE 0x0000
+enum {
+ CIFS_ALIAS_TYPE_FILE = 0x0001,
+ CIFS_SHARE_TYPE_FILE = 0x0000
+};
/*
* File Attribute flags
*/
-#define ATTR_READONLY 0x0001
-#define ATTR_HIDDEN 0x0002
-#define ATTR_SYSTEM 0x0004
-#define ATTR_VOLUME 0x0008
-#define ATTR_DIRECTORY 0x0010
-#define ATTR_ARCHIVE 0x0020
-#define ATTR_DEVICE 0x0040
-#define ATTR_NORMAL 0x0080
-#define ATTR_TEMPORARY 0x0100
-#define ATTR_SPARSE 0x0200
-#define ATTR_REPARSE 0x0400
-#define ATTR_COMPRESSED 0x0800
-#define ATTR_OFFLINE 0x1000 /* ie file not immediately available - offline storage */
-#define ATTR_NOT_CONTENT_INDEXED 0x2000
-#define ATTR_ENCRYPTED 0x4000
-#define ATTR_POSIX_SEMANTICS 0x01000000
-#define ATTR_BACKUP_SEMANTICS 0x02000000
-#define ATTR_DELETE_ON_CLOSE 0x04000000
-#define ATTR_SEQUENTIAL_SCAN 0x08000000
-#define ATTR_RANDOM_ACCESS 0x10000000
-#define ATTR_NO_BUFFERING 0x20000000
-#define ATTR_WRITE_THROUGH 0x80000000
+enum {
+ ATTR_READONLY = 0x0001,
+ ATTR_HIDDEN = 0x0002,
+ ATTR_SYSTEM = 0x0004,
+ ATTR_VOLUME = 0x0008,
+ ATTR_DIRECTORY = 0x0010,
+ ATTR_ARCHIVE = 0x0020,
+ ATTR_DEVICE = 0x0040,
+ ATTR_NORMAL = 0x0080,
+ ATTR_TEMPORARY = 0x0100,
+ ATTR_SPARSE = 0x0200,
+ ATTR_REPARSE = 0x0400,
+ ATTR_COMPRESSED = 0x0800,
+ ATTR_OFFLINE = 0x1000, /* ie file not immediately available - offline storage */
+ ATTR_NOT_CONTENT_INDEXED = 0x2000,
+ ATTR_ENCRYPTED = 0x4000,
+ ATTR_POSIX_SEMANTICS = 0x01000000,
+ ATTR_BACKUP_SEMANTICS = 0x02000000,
+ ATTR_DELETE_ON_CLOSE = 0x04000000,
+ ATTR_SEQUENTIAL_SCAN = 0x08000000,
+ ATTR_RANDOM_ACCESS = 0x10000000,
+ ATTR_NO_BUFFERING = 0x20000000,
+ ATTR_WRITE_THROUGH = 0x80000000
+};
/* ShareAccess flags */
-#define FILE_NO_SHARE 0x00000000
-#define FILE_SHARE_READ 0x00000001
-#define FILE_SHARE_WRITE 0x00000002
-#define FILE_SHARE_DELETE 0x00000004
-#define FILE_SHARE_ALL 0x00000007
+enum {
+ FILE_NO_SHARE = 0x00000000,
+ FILE_SHARE_READ = 0x00000001,
+ FILE_SHARE_WRITE = 0x00000002,
+ FILE_SHARE_DELETE = 0x00000004,
+ FILE_SHARE_ALL = 0x00000007
+};
/* CreateDisposition flags */
-#define FILE_SUPERSEDE 0x00000000
-#define FILE_OPEN 0x00000001
-#define FILE_CREATE 0x00000002
-#define FILE_OPEN_IF 0x00000003
-#define FILE_OVERWRITE 0x00000004
-#define FILE_OVERWRITE_IF 0x00000005
+enum {
+ FILE_SUPERSEDE = 0x00000000,
+ FILE_OPEN = 0x00000001,
+ FILE_CREATE = 0x00000002,
+ FILE_OPEN_IF = 0x00000003,
+ FILE_OVERWRITE = 0x00000004,
+ FILE_OVERWRITE_IF = 0x00000005
+};
/* CreateOptions */
-#define CREATE_NOT_FILE 0x00000001 /* if set must not be file */
-#define CREATE_WRITE_THROUGH 0x00000002
-#define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */
-#define CREATE_RANDOM_ACCESS 0x00000800
-#define CREATE_DELETE_ON_CLOSE 0x00001000
-#define OPEN_REPARSE_POINT 0x00200000
+enum {
+ CREATE_NOT_FILE = 0x00000001, /* if set must not be file */
+ CREATE_WRITE_THROUGH = 0x00000002,
+ CREATE_NOT_DIR = 0x00000040, /* if set must not be directory */
+ CREATE_RANDOM_ACCESS = 0x00000800,
+ CREATE_DELETE_ON_CLOSE = 0x00001000,
+ OPEN_REPARSE_POINT = 0x00200000
+};
/* ImpersonationLevel flags */
-#define SECURITY_ANONYMOUS 0
-#define SECURITY_IDENTIFICATION 1
-#define SECURITY_IMPERSONATION 2
-#define SECURITY_DELEGATION 3
+enum {
+ SECURITY_ANONYMOUS = 0,
+ SECURITY_IDENTIFICATION = 1,
+ SECURITY_IMPERSONATION = 2,
+ SECURITY_DELEGATION = 3,
+};
/* SecurityFlags */
-#define SECURITY_CONTEXT_TRACKING 0x01
-#define SECURITY_EFFECTIVE_ONLY 0x02
+enum {
+ SECURITY_CONTEXT_TRACKING = 0x01,
+ SECURITY_EFFECTIVE_ONLY = 0x02
+};
/*
* Default PID value, used in all SMBs where the PID is not important
@@ -290,8 +315,10 @@
* We use the same routine for Copy and Move SMBs. This flag is used to
* distinguish
*/
-#define CIFS_COPY_OP 1
-#define CIFS_RENAME_OP 2
+enum {
+ CIFS_COPY_OP = 1,
+ CIFS_RENAME_OP = 2
+};
#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
@@ -408,31 +435,35 @@
} NEGOTIATE_RSP;
/* SecurityMode bits */
-#define SECMODE_USER 0x01 /* off indicates share level security */
-#define SECMODE_PW_ENCRYPT 0x02
-#define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */
-#define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required */
+enum {
+ SECMODE_USER = 0x01, /* off indicates share level security */
+ SECMODE_PW_ENCRYPT = 0x02,
+ SECMODE_SIGN_ENABLED = 0x04, /* SMB security signatures enabled */
+ SECMODE_SIGN_REQUIRED = 0x08 /* SMB security signatures required */
+};
/* Negotiate response Capabilities */
-#define CAP_RAW_MODE 0x00000001
-#define CAP_MPX_MODE 0x00000002
-#define CAP_UNICODE 0x00000004
-#define CAP_LARGE_FILES 0x00000008
-#define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */
-#define CAP_RPC_REMOTE_APIS 0x00000020
-#define CAP_STATUS32 0x00000040
-#define CAP_LEVEL_II_OPLOCKS 0x00000080
-#define CAP_LOCK_AND_READ 0x00000100
-#define CAP_NT_FIND 0x00000200
-#define CAP_DFS 0x00001000
-#define CAP_INFOLEVEL_PASSTHRU 0x00002000
-#define CAP_LARGE_READ_X 0x00004000
-#define CAP_LARGE_WRITE_X 0x00008000
-#define CAP_UNIX 0x00800000
-#define CAP_RESERVED 0x02000000
-#define CAP_BULK_TRANSFER 0x20000000
-#define CAP_COMPRESSED_DATA 0x40000000
-#define CAP_EXTENDED_SECURITY 0x80000000
+enum {
+ CAP_RAW_MODE = 0x00000001,
+ CAP_MPX_MODE = 0x00000002,
+ CAP_UNICODE = 0x00000004,
+ CAP_LARGE_FILES = 0x00000008,
+ CAP_NT_SMBS = 0x00000010, /* implies CAP_NT_FIND */
+ CAP_RPC_REMOTE_APIS = 0x00000020,
+ CAP_STATUS32 = 0x00000040,
+ CAP_LEVEL_II_OPLOCKS = 0x00000080,
+ CAP_LOCK_AND_READ = 0x00000100,
+ CAP_NT_FIND = 0x00000200,
+ CAP_DFS = 0x00001000,
+ CAP_INFOLEVEL_PASSTHRU = 0x00002000,
+ CAP_LARGE_READ_X = 0x00004000,
+ CAP_LARGE_WRITE_X = 0x00008000,
+ CAP_UNIX = 0x00800000,
+ CAP_RESERVED = 0x02000000,
+ CAP_BULK_TRANSFER = 0x20000000,
+ CAP_COMPRESSED_DATA = 0x40000000,
+ CAP_EXTENDED_SECURITY = 0x80000000
+};
typedef union smb_com_session_setup_andx {
struct { /* request format */
@@ -523,16 +554,6 @@
#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"
-/* Capabilities bits (for NTLM SessSetup request) */
-#define CAP_UNICODE 0x00000004
-#define CAP_LARGE_FILES 0x00000008
-#define CAP_NT_SMBS 0x00000010
-#define CAP_STATUS32 0x00000040
-#define CAP_LEVEL_II_OPLOCKS 0x00000080
-#define CAP_NT_FIND 0x00000200 /* reserved should be zero (presumably because NT_SMBs implies the same thing) */
-#define CAP_BULK_TRANSFER 0x20000000
-#define CAP_EXTENDED_SECURITY 0x80000000
-
/* Action bits */
#define GUEST_LOGIN 1
@@ -561,11 +582,16 @@
} TCONX_RSP;
/* tree connect Flags */
-#define DISCONNECT_TID 0x0001
-#define TCON_EXTENDED_SECINFO 0x0008
+enum {
+ DISCONNECT_TID = 0x0001,
+ TCON_EXTENDED_SECINFO = 0x0008
+};
+
/* OptionalSupport bits */
-#define SMB_SUPPORT_SEARCH_BITS 0x0001 /* must have bits (exclusive searches suppt. */
-#define SMB_SHARE_IS_IN_DFS 0x0002
+enum {
+ SMB_SUPPORT_SEARCH_BITS = 0x0001, /* must have bits (exclusive searches suppt. */
+ SMB_SHARE_IS_IN_DFS = 0x0002
+};
typedef struct smb_com_logoff_andx_req {
@@ -614,9 +640,11 @@
} FINDCLOSE_REQ;
/* OpenFlags */
-#define REQ_OPLOCK 0x00000002
-#define REQ_BATCHOPLOCK 0x00000004
-#define REQ_OPENDIRONLY 0x00000008
+enum {
+ REQ_OPLOCK = 0x00000002,
+ REQ_BATCHOPLOCK = 0x00000004,
+ REQ_OPENDIRONLY = 0x00000008
+};
typedef struct smb_com_open_req { /* also handles create */
struct smb_hdr hdr; /* wct = 24 */
@@ -640,10 +668,12 @@
} OPEN_REQ;
/* open response: oplock levels */
-#define OPLOCK_NONE 0
-#define OPLOCK_EXCLUSIVE 1
-#define OPLOCK_BATCH 2
-#define OPLOCK_READ 3 /* level 2 oplock */
+enum {
+ OPLOCK_NONE = 0,
+ OPLOCK_EXCLUSIVE = 1,
+ OPLOCK_BATCH = 2,
+ OPLOCK_READ = 3 /* level 2 oplock */
+};
/* open response for CreateAction shifted left */
#define CIFS_CREATE_ACTION 0x20000 /* file created */
@@ -740,11 +770,13 @@
__le32 LengthLow;
} LOCKING_ANDX_RANGE;
-#define LOCKING_ANDX_SHARED_LOCK 0x01
-#define LOCKING_ANDX_OPLOCK_RELEASE 0x02
-#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
-#define LOCKING_ANDX_CANCEL_LOCK 0x08
-#define LOCKING_ANDX_LARGE_FILES 0x10 /* always on for us */
+enum {
+ LOCKING_ANDX_SHARED_LOCK = 0x01,
+ LOCKING_ANDX_OPLOCK_RELEASE = 0x02,
+ LOCKING_ANDX_CHANGE_LOCKTYPE = 0x04,
+ LOCKING_ANDX_CANCEL_LOCK = 0x08,
+ LOCKING_ANDX_LARGE_FILES = 0x10 /* always on for us */
+};
typedef struct smb_com_lock_req {
struct smb_hdr hdr; /* wct = 8 */
@@ -779,13 +811,15 @@
/* followed by NewFileName */
} RENAME_REQ;
- /* copy request flags */
-#define COPY_MUST_BE_FILE 0x0001
-#define COPY_MUST_BE_DIR 0x0002
-#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
-#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
-#define COPY_VERIFY_WRITES 0x0010
-#define COPY_TREE 0x0020
+/* copy request flags */
+enum {
+ COPY_MUST_BE_FILE = 0x0001,
+ COPY_MUST_BE_DIR = 0x0002,
+ COPY_TARGET_MODE_ASCII = 0x0004, /* if not set, binary */
+ COPY_SOURCE_MODE_ASCII = 0x0008, /* if not set, binary */
+ COPY_VERIFY_WRITES = 0x0010,
+ COPY_TREE = 0x0020
+};
typedef struct smb_com_copy_req {
struct smb_hdr hdr; /* wct = 3 */
@@ -807,9 +841,11 @@
unsigned char ErrorFileName[1]; /* only present if error in copy */
} COPY_RSP;
-#define CREATE_HARD_LINK 0x103
-#define MOVEFILE_COPY_ALLOWED 0x0002
-#define MOVEFILE_REPLACE_EXISTING 0x0001
+enum {
+ CREATE_HARD_LINK = 0x103,
+ MOVEFILE_COPY_ALLOWED = 0x0002,
+ MOVEFILE_REPLACE_EXISTING = 0x0001
+};
typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */
struct smb_hdr hdr; /* wct = 4 */
@@ -949,29 +985,34 @@
__u16 ByteCount;
/* __u8 Pad[3]; */
} TRANSACT_CHANGE_NOTIFY_RSP;
+
/* Completion Filter flags for Notify */
-#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
-#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
-#define FILE_NOTIFY_CHANGE_NAME 0x00000003
-#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
-#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
-#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
-#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
-#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
-#define FILE_NOTIFY_CHANGE_EA 0x00000080
-#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
-#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
-#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
-#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
-
-#define FILE_ACTION_ADDED 0x00000001
-#define FILE_ACTION_REMOVED 0x00000002
-#define FILE_ACTION_MODIFIED 0x00000003
-#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
-#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
-#define FILE_ACTION_ADDED_STREAM 0x00000006
-#define FILE_ACTION_REMOVED_STREAM 0x00000007
-#define FILE_ACTION_MODIFIED_STREAM 0x00000008
+enum {
+ FILE_NOTIFY_CHANGE_FILE_NAME = 0x00000001,
+ FILE_NOTIFY_CHANGE_DIR_NAME = 0x00000002,
+ FILE_NOTIFY_CHANGE_NAME = 0x00000003,
+ FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x00000004,
+ FILE_NOTIFY_CHANGE_SIZE = 0x00000008,
+ FILE_NOTIFY_CHANGE_LAST_WRITE = 0x00000010,
+ FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x00000020,
+ FILE_NOTIFY_CHANGE_CREATION = 0x00000040,
+ FILE_NOTIFY_CHANGE_EA = 0x00000080,
+ FILE_NOTIFY_CHANGE_SECURITY = 0x00000100,
+ FILE_NOTIFY_CHANGE_STREAM_NAME = 0x00000200,
+ FILE_NOTIFY_CHANGE_STREAM_SIZE = 0x00000400,
+ FILE_NOTIFY_CHANGE_STREAM_WRITE = 0x00000800
+};
+
+enum {
+ FILE_ACTION_ADDED = 0x00000001,
+ FILE_ACTION_REMOVED = 0x00000002,
+ FILE_ACTION_MODIFIED = 0x00000003,
+ FILE_ACTION_RENAMED_OLD_NAME = 0x00000004,
+ FILE_ACTION_RENAMED_NEW_NAME = 0x00000005,
+ FILE_ACTION_ADDED_STREAM = 0x00000006,
+ FILE_ACTION_REMOVED_STREAM = 0x00000007,
+ FILE_ACTION_MODIFIED_STREAM = 0x00000008
+};
/* response contains array of the following structures */
struct file_notify_information {
@@ -1003,9 +1044,11 @@
};
/* quota sub commands */
-#define QUOTA_LIST_CONTINUE 0
-#define QUOTA_LIST_START 0x100
-#define QUOTA_FOR_SID 0x101
+enum {
+ QUOTA_LIST_CONTINUE = 0,
+ QUOTA_LIST_START = 0x100,
+ QUOTA_FOR_SID = 0x101
+};
struct trans2_req {
/* struct smb_hdr hdr precedes. Set wct = 14+ */
@@ -1058,61 +1101,66 @@
};
/* PathInfo/FileInfo infolevels */
-#define SMB_INFO_STANDARD 1
-#define SMB_SET_FILE_EA 2
-#define SMB_QUERY_FILE_EA_SIZE 2
-#define SMB_INFO_QUERY_EAS_FROM_LIST 3
-#define SMB_INFO_QUERY_ALL_EAS 4
-#define SMB_INFO_IS_NAME_VALID 6
-#define SMB_QUERY_FILE_BASIC_INFO 0x101
-#define SMB_QUERY_FILE_STANDARD_INFO 0x102
-#define SMB_QUERY_FILE_EA_INFO 0x103
-#define SMB_QUERY_FILE_NAME_INFO 0x104
-#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
-#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
-#define SMB_QUERY_FILE_ALL_INFO 0x107
-#define SMB_QUERY_ALT_NAME_INFO 0x108
-#define SMB_QUERY_FILE_STREAM_INFO 0x109
-#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B
-#define SMB_QUERY_FILE_UNIX_BASIC 0x200
-#define SMB_QUERY_FILE_UNIX_LINK 0x201
-#define SMB_QUERY_POSIX_ACL 0x204
-#define SMB_QUERY_XATTR 0x205
-#define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee
-#define SMB_QUERY_FILE_ACCESS_INFO 0x3f0
-#define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */
-#define SMB_QUERY_FILE_POSITION_INFO 0x3f6
-#define SMB_QUERY_FILE_MODE_INFO 0x3f8
-#define SMB_QUERY_FILE_ALGN_INFO 0x3f9
-
-
-#define SMB_SET_FILE_BASIC_INFO 0x101
-#define SMB_SET_FILE_DISPOSITION_INFO 0x102
-#define SMB_SET_FILE_ALLOCATION_INFO 0x103
-#define SMB_SET_FILE_END_OF_FILE_INFO 0x104
-#define SMB_SET_FILE_UNIX_BASIC 0x200
-#define SMB_SET_FILE_UNIX_LINK 0x201
-#define SMB_SET_FILE_UNIX_HLINK 0x203
-#define SMB_SET_POSIX_ACL 0x204
-#define SMB_SET_XATTR 0x205
-#define SMB_SET_FILE_BASIC_INFO2 0x3ec
-#define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo level too */
-#define SMB_FILE_ALL_INFO2 0x3fa
-#define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb
-#define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc
-#define SMB_FILE_MOVE_CLUSTER_INFO 0x407
-#define SMB_FILE_QUOTA_INFO 0x408
-#define SMB_FILE_REPARSEPOINT_INFO 0x409
-#define SMB_FILE_MAXIMUM_INFO 0x40d
+enum {
+ SMB_INFO_STANDARD = 1,
+ SMB_SET_FILE_EA = 2,
+ SMB_QUERY_FILE_EA_SIZE = 2,
+ SMB_INFO_QUERY_EAS_FROM_LIST = 3,
+ SMB_INFO_QUERY_ALL_EAS = 4,
+ SMB_INFO_IS_NAME_VALID = 6,
+ SMB_QUERY_FILE_BASIC_INFO = 0x101,
+ SMB_QUERY_FILE_STANDARD_INFO = 0x102,
+ SMB_QUERY_FILE_EA_INFO = 0x103,
+ SMB_QUERY_FILE_NAME_INFO = 0x104,
+ SMB_QUERY_FILE_ALLOCATION_INFO = 0x105,
+ SMB_QUERY_FILE_END_OF_FILEINFO = 0x106,
+ SMB_QUERY_FILE_ALL_INFO = 0x107,
+ SMB_QUERY_ALT_NAME_INFO = 0x108,
+ SMB_QUERY_FILE_STREAM_INFO = 0x109,
+ SMB_QUERY_FILE_COMPRESSION_INFO = 0x10B,
+ SMB_QUERY_FILE_UNIX_BASIC = 0x200,
+ SMB_QUERY_FILE_UNIX_LINK = 0x201,
+ SMB_QUERY_POSIX_ACL = 0x204,
+ SMB_QUERY_XATTR = 0x205,
+ SMB_QUERY_FILE_INTERNAL_INFO = 0x3ee,
+ SMB_QUERY_FILE_ACCESS_INFO = 0x3f0,
+ SMB_QUERY_FILE_NAME_INFO2 = 0x3f1, /* = 0x30 bytes */
+ SMB_QUERY_FILE_POSITION_INFO = 0x3f6,
+ SMB_QUERY_FILE_MODE_INFO = 0x3f8,
+ SMB_QUERY_FILE_ALGN_INFO = 0x3f9
+};
+
+enum {
+ SMB_SET_FILE_BASIC_INFO = 0x101,
+ SMB_SET_FILE_DISPOSITION_INFO = 0x102,
+ SMB_SET_FILE_ALLOCATION_INFO = 0x103,
+ SMB_SET_FILE_END_OF_FILE_INFO = 0x104,
+ SMB_SET_FILE_UNIX_BASIC = 0x200,
+ SMB_SET_FILE_UNIX_LINK = 0x201,
+ SMB_SET_FILE_UNIX_HLINK = 0x203,
+ SMB_SET_POSIX_ACL = 0x204,
+ SMB_SET_XATTR = 0x205,
+ SMB_SET_FILE_BASIC_INFO2 = 0x3ec,
+ SMB_SET_FILE_RENAME_INFORMATION = 0x3f2, /* BB check if qpathinfo level too */
+ SMB_FILE_ALL_INFO2 = 0x3fa,
+ SMB_SET_FILE_ALLOCATION_INFO2 = 0x3fb,
+ SMB_SET_FILE_END_OF_FILE_INFO2 = 0x3fc,
+ SMB_FILE_MOVE_CLUSTER_INFO = 0x407,
+ SMB_FILE_QUOTA_INFO = 0x408,
+ SMB_FILE_REPARSEPOINT_INFO = 0x409,
+ SMB_FILE_MAXIMUM_INFO = 0x40d
+};
/* Find File infolevels */
-#define SMB_FIND_FILE_DIRECTORY_INFO 0x101
-#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
-#define SMB_FIND_FILE_NAMES_INFO 0x103
-#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
-#define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105
-#define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106
-#define SMB_FIND_FILE_UNIX 0x202
+enum {
+ SMB_FIND_FILE_DIRECTORY_INFO = 0x101,
+ SMB_FIND_FILE_FULL_DIRECTORY_INFO = 0x102,
+ SMB_FIND_FILE_NAMES_INFO = 0x103,
+ SMB_FIND_FILE_BOTH_DIRECTORY_INFO = 0x104,
+ SMB_FIND_FILE_ID_FULL_DIR_INFO = 0x105,
+ SMB_FIND_FILE_ID_BOTH_DIR_INFO = 0x106,
+ SMB_FIND_FILE_UNIX = 0x202
+};
typedef struct smb_com_transaction2_qpi_req {
struct smb_hdr hdr; /* wct = 14+ */
@@ -1223,11 +1271,13 @@
/*
* Flags on T2 FINDFIRST and FINDNEXT
*/
-#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001
-#define CIFS_SEARCH_CLOSE_AT_END 0x0002
-#define CIFS_SEARCH_RETURN_RESUME 0x0004
-#define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008
-#define CIFS_SEARCH_BACKUP_SEARCH 0x0010
+enum {
+ CIFS_SEARCH_CLOSE_ALWAYS = 0x0001,
+ CIFS_SEARCH_CLOSE_AT_END = 0x0002,
+ CIFS_SEARCH_RETURN_RESUME = 0x0004,
+ CIFS_SEARCH_CONTINUE_FROM_LAST = 0x0008,
+ CIFS_SEARCH_BACKUP_SEARCH = 0x0010
+};
/*
* Size of the resume key on FINDFIRST and FINDNEXT calls
@@ -1318,17 +1368,19 @@
} T2_FNEXT_RSP_PARMS;
/* QFSInfo Levels */
-#define SMB_INFO_ALLOCATION 1
-#define SMB_INFO_VOLUME 2
-#define SMB_QUERY_FS_VOLUME_INFO 0x102
-#define SMB_QUERY_FS_SIZE_INFO 0x103
-#define SMB_QUERY_FS_DEVICE_INFO 0x104
-#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
-#define SMB_QUERY_CIFS_UNIX_INFO 0x200
-#define SMB_QUERY_LABEL_INFO 0x3ea
-#define SMB_QUERY_FS_QUOTA_INFO 0x3ee
-#define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef
-#define SMB_QUERY_OBJECTID_INFO 0x3f0
+enum {
+ SMB_INFO_ALLOCATION = 1,
+ SMB_INFO_VOLUME = 2,
+ SMB_QUERY_FS_VOLUME_INFO = 0x102,
+ SMB_QUERY_FS_SIZE_INFO = 0x103,
+ SMB_QUERY_FS_DEVICE_INFO = 0x104,
+ SMB_QUERY_FS_ATTRIBUTE_INFO = 0x105,
+ SMB_QUERY_CIFS_UNIX_INFO = 0x200,
+ SMB_QUERY_LABEL_INFO = 0x3ea,
+ SMB_QUERY_FS_QUOTA_INFO = 0x3ee,
+ SMB_QUERY_FS_FULL_SIZE_INFO = 0x3ef,
+ SMB_QUERY_OBJECTID_INFO = 0x3f0
+};
typedef struct smb_com_transaction2_qfsi_req {
struct smb_hdr hdr; /* wct = 14+ */
@@ -1410,8 +1462,10 @@
} TRANSACTION2_GET_DFS_REFER_RSP;
/* DFS Flags */
-#define DFSREF_REFERRAL_SERVER 0x0001
-#define DFSREF_STORAGE_SERVER 0x0002
+enum {
+ DFSREF_REFERRAL_SERVER = 0x0001,
+ DFSREF_STORAGE_SERVER = 0x0002
+};
/* IOCTL information */
/* List of ioctl function codes that look to be of interest to remote clients like this. */
@@ -1419,30 +1473,34 @@
/* Some of the following such as the encryption/compression ones would be */
/* invoked from tools via a specialized hook into the VFS rather than via the */
/* standard vfs entry points */
-#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
-#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
-#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
-#define FSCTL_LOCK_VOLUME 0x00090018
-#define FSCTL_UNLOCK_VOLUME 0x0009001C
-#define FSCTL_GET_COMPRESSION 0x0009003C
-#define FSCTL_SET_COMPRESSION 0x0009C040
-#define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C
-#define FSCTL_FILESYS_GET_STATISTICS 0x00090090
-#define FSCTL_SET_REPARSE_POINT 0x000900A4
-#define FSCTL_GET_REPARSE_POINT 0x000900A8
-#define FSCTL_DELETE_REPARSE_POINT 0x000900AC
-#define FSCTL_SET_SPARSE 0x000900C4
-#define FSCTL_SET_ZERO_DATA 0x000900C8
-#define FSCTL_SET_ENCRYPTION 0x000900D7
-#define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB
-#define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF
-#define FSCTL_READ_RAW_ENCRYPTED 0x000900E3
-#define FSCTL_SIS_COPYFILE 0x00090100
-#define FSCTL_SIS_LINK_FILES 0x0009C104
-
-#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
-#define IO_REPARSE_TAG_HSM 0xC0000004
-#define IO_REPARSE_TAG_SIS 0x80000007
+enum {
+ FSCTL_REQUEST_OPLOCK_LEVEL_1 = 0x00090000,
+ FSCTL_REQUEST_OPLOCK_LEVEL_2 = 0x00090004,
+ FSCTL_REQUEST_BATCH_OPLOCK = 0x00090008,
+ FSCTL_LOCK_VOLUME = 0x00090018,
+ FSCTL_UNLOCK_VOLUME = 0x0009001C,
+ FSCTL_GET_COMPRESSION = 0x0009003C,
+ FSCTL_SET_COMPRESSION = 0x0009C040,
+ FSCTL_REQUEST_FILTER_OPLOCK = 0x0009008C,
+ FSCTL_FILESYS_GET_STATISTICS = 0x00090090,
+ FSCTL_SET_REPARSE_POINT = 0x000900A4,
+ FSCTL_GET_REPARSE_POINT = 0x000900A8,
+ FSCTL_DELETE_REPARSE_POINT = 0x000900AC,
+ FSCTL_SET_SPARSE = 0x000900C4,
+ FSCTL_SET_ZERO_DATA = 0x000900C8,
+ FSCTL_SET_ENCRYPTION = 0x000900D7,
+ FSCTL_ENCRYPTION_FSCTL_IO = 0x000900DB,
+ FSCTL_WRITE_RAW_ENCRYPTED = 0x000900DF,
+ FSCTL_READ_RAW_ENCRYPTED = 0x000900E3,
+ FSCTL_SIS_COPYFILE = 0x00090100,
+ FSCTL_SIS_LINK_FILES = 0x0009C104
+};
+
+enum {
+ IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003,
+ IO_REPARSE_TAG_HSM = 0xC0000004,
+ IO_REPARSE_TAG_SIS = 0x80000007
+};
/*
************************************************************************
@@ -1501,29 +1559,33 @@
__le64 Capability;
} FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */
/* Linux/Unix extensions capability flags */
-#define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */
-#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002
-#define CIFS_UNIX_XATTR_CAP 0x00000004 /*support for new namespace*/
+enum {
+ CIFS_UNIX_FCNTL_CAP = 0x00000001, /* support for fcntl locks */
+ CIFS_UNIX_POSIX_ACL_CAP = 0x00000002,
+ CIFS_UNIX_XATTR_CAP = 0x00000004 /*support for new namespace*/
+};
/* DeviceType Flags */
-#define FILE_DEVICE_CD_ROM 0x00000002
-#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
-#define FILE_DEVICE_DFS 0x00000006
-#define FILE_DEVICE_DISK 0x00000007
-#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
-#define FILE_DEVICE_FILE_SYSTEM 0x00000009
-#define FILE_DEVICE_NAMED_PIPE 0x00000011
-#define FILE_DEVICE_NETWORK 0x00000012
-#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
-#define FILE_DEVICE_NULL 0x00000015
-#define FILE_DEVICE_PARALLEL_PORT 0x00000016
-#define FILE_DEVICE_PRINTER 0x00000018
-#define FILE_DEVICE_SERIAL_PORT 0x0000001b
-#define FILE_DEVICE_STREAMS 0x0000001e
-#define FILE_DEVICE_TAPE 0x0000001f
-#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
-#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
-#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
+enum {
+ FILE_DEVICE_CD_ROM = 0x00000002,
+ FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003,
+ FILE_DEVICE_DFS = 0x00000006,
+ FILE_DEVICE_DISK = 0x00000007,
+ FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008,
+ FILE_DEVICE_FILE_SYSTEM = 0x00000009,
+ FILE_DEVICE_NAMED_PIPE = 0x00000011,
+ FILE_DEVICE_NETWORK = 0x00000012,
+ FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014,
+ FILE_DEVICE_NULL = 0x00000015,
+ FILE_DEVICE_PARALLEL_PORT = 0x00000016,
+ FILE_DEVICE_PRINTER = 0x00000018,
+ FILE_DEVICE_SERIAL_PORT = 0x0000001b,
+ FILE_DEVICE_STREAMS = 0x0000001e,
+ FILE_DEVICE_TAPE = 0x0000001f,
+ FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020,
+ FILE_DEVICE_VIRTUAL_DISK = 0x00000024,
+ FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028
+};
typedef struct {
__le32 DeviceType;
@@ -1565,13 +1627,16 @@
} FILE_ALL_INFO; /* level 0x107 QPathInfo */
/* defines for enumerating possible values of the Unix type field below */
-#define UNIX_FILE 0
-#define UNIX_DIR 1
-#define UNIX_SYMLINK 2
-#define UNIX_CHARDEV 3
-#define UNIX_BLOCKDEV 4
-#define UNIX_FIFO 5
-#define UNIX_SOCKET 6
+enum {
+ UNIX_FILE = 0,
+ UNIX_DIR = 1,
+ UNIX_SYMLINK = 2,
+ UNIX_CHARDEV = 3,
+ UNIX_BLOCKDEV = 4,
+ UNIX_FIFO = 5,
+ UNIX_SOCKET = 6
+};
+
typedef struct {
__le64 EndOfFile;
__le64 NumOfBytes;
@@ -1660,21 +1725,6 @@
struct cifs_posix_ace default_ace_arraay[] */
}; /* level 0x204 */
-/* types of access control entries already defined in posix_acl.h */
-/* #define CIFS_POSIX_ACL_USER_OBJ 0x01
-#define CIFS_POSIX_ACL_USER 0x02
-#define CIFS_POSIX_ACL_GROUP_OBJ 0x04
-#define CIFS_POSIX_ACL_GROUP 0x08
-#define CIFS_POSIX_ACL_MASK 0x10
-#define CIFS_POSIX_ACL_OTHER 0x20 */
-
-/* types of perms */
-/* #define CIFS_POSIX_ACL_EXECUTE 0x01
-#define CIFS_POSIX_ACL_WRITE 0x02
-#define CIFS_POSIX_ACL_READ 0x04 */
-
-/* end of POSIX ACL definitions */
-
struct file_internal_info {
__u64 UniqueId; /* inode number */
}; /* level 0x3ee */
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/6] cifs: remove spurious casts
2005-01-15 13:28 ` [PATCH 3/6] cifs: enum conversion Pekka Enberg
@ 2005-01-15 13:29 ` Pekka Enberg
2005-01-15 13:30 ` [PATCH 5/6] cifs: reduce deep nesting Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:29 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
Remove spurious void pointer casts.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
cifsfs.c | 9 ++++-----
dir.c | 6 ++----
file.c | 32 +++++++++++++-------------------
misc.c | 17 ++++-------------
readdir.c | 6 +++---
transport.c | 5 ++---
6 files changed, 28 insertions(+), 47 deletions(-)
Index: linux/fs/cifs/cifsfs.c
===================================================================
--- linux.orig/fs/cifs/cifsfs.c 2005-01-12 20:13:39.874862088 +0200
+++ linux/fs/cifs/cifsfs.c 2005-01-12 20:13:47.453709928 +0200
@@ -221,10 +221,9 @@
static struct inode *
cifs_alloc_inode(struct super_block *sb)
{
- struct cifsInodeInfo *cifs_inode;
- cifs_inode =
- (struct cifsInodeInfo *) kmem_cache_alloc(cifs_inode_cachep,
- SLAB_KERNEL);
+ struct cifsInodeInfo *cifs_inode =
+ kmem_cache_alloc(cifs_inode_cachep, SLAB_KERNEL);
+
if (!cifs_inode)
return NULL;
cifs_inode->cifsAttrs = 0x20; /* default */
@@ -578,7 +577,7 @@
static void
cifs_init_once(void *inode, kmem_cache_t * cachep, unsigned long flags)
{
- struct cifsInodeInfo *cifsi = (struct cifsInodeInfo *) inode;
+ struct cifsInodeInfo *cifsi = inode;
if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) {
Index: linux/fs/cifs/dir.c
===================================================================
--- linux.orig/fs/cifs/dir.c 2005-01-12 20:13:40.114825608 +0200
+++ linux/fs/cifs/dir.c 2005-01-12 20:13:47.454709776 +0200
@@ -284,12 +284,10 @@
/* mknod case - do not leave file open */
CIFSSMBClose(xid, pTcon, fileHandle);
} else if(newinode) {
- pCifsFile = (struct cifsFileInfo *)
- kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
+ pCifsFile = kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
if (pCifsFile) {
- memset((char *)pCifsFile, 0,
- sizeof (struct cifsFileInfo));
+ memset(pCifsFile, 0, sizeof (struct cifsFileInfo));
pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->tgid;
pCifsFile->pInode = newinode;
Index: linux/fs/cifs/file.c
===================================================================
--- linux.orig/fs/cifs/file.c 2005-01-12 20:13:40.119824848 +0200
+++ linux/fs/cifs/file.c 2005-01-12 20:13:47.457709320 +0200
@@ -166,7 +166,7 @@
kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
if (file->private_data) {
memset(file->private_data, 0, sizeof(struct cifsFileInfo));
- pCifsFile = (struct cifsFileInfo *) file->private_data;
+ pCifsFile = file->private_data;
pCifsFile->netfid = netfid;
pCifsFile->pid = current->tgid;
init_MUTEX(&pCifsFile->fh_sem);
@@ -285,7 +285,7 @@
if(inode == NULL)
return -EBADF;
if (file->private_data) {
- pCifsFile = (struct cifsFileInfo *) file->private_data;
+ pCifsFile = file->private_data;
} else
return -EBADF;
@@ -399,8 +399,7 @@
int xid;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon;
- struct cifsFileInfo *pSMBFile =
- (struct cifsFileInfo *) file->private_data;
+ struct cifsFileInfo *pSMBFile = file->private_data;
xid = GetXid();
@@ -446,8 +445,7 @@
{
int rc = 0;
int xid;
- struct cifsFileInfo *pCFileStruct =
- (struct cifsFileInfo *) file->private_data;
+ struct cifsFileInfo *pCFileStruct = file->private_data;
char * ptmp;
cFYI(1, ("Closedir inode = 0x%p with ", inode));
@@ -618,7 +616,7 @@
if (file->private_data == NULL) {
return -EBADF;
} else {
- open_file = (struct cifsFileInfo *) file->private_data;
+ open_file = file->private_data;
}
xid = GetXid();
@@ -734,7 +732,7 @@
if (file->private_data == NULL) {
return -EBADF;
} else {
- open_file = (struct cifsFileInfo *) file->private_data;
+ open_file = file->private_data;
}
xid = GetXid();
@@ -1057,7 +1055,7 @@
FreeXid(xid);
return -EBADF;
}
- open_file = (struct cifsFileInfo *)file->private_data;
+ open_file = file->private_data;
if((file->f_flags & O_ACCMODE) == O_WRONLY) {
cFYI(1,("attempting read on write only file instance"));
@@ -1136,7 +1134,7 @@
FreeXid(xid);
return -EBADF;
}
- open_file = (struct cifsFileInfo *)file->private_data;
+ open_file = file->private_data;
if((file->f_flags & O_ACCMODE) == O_WRONLY) {
cFYI(1,("attempting read on write only file instance"));
@@ -1274,7 +1272,7 @@
FreeXid(xid);
return -EBADF;
}
- open_file = (struct cifsFileInfo *)file->private_data;
+ open_file = file->private_data;
cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon;
@@ -1712,9 +1710,7 @@
static void reset_resume_key(struct file * dir_file,
unsigned char * filename,
unsigned int len,int Unicode,struct nls_table * nls_tab) {
- struct cifsFileInfo *cifsFile;
-
- cifsFile = (struct cifsFileInfo *)dir_file->private_data;
+ struct cifsFileInfo *cifsFile = dir_file->private_data;
if(cifsFile == NULL)
return;
if(cifsFile->search_resume_name) {
@@ -1897,8 +1893,7 @@
/* fallthrough */
case 2:
if (file->private_data != NULL) {
- cifsFile =
- (struct cifsFileInfo *) file->private_data;
+ cifsFile = file->private_data;
if (cifsFile->srch_inf.endOfSearch) {
if(cifsFile->srch_inf.emptyDir) {
cFYI(1, ("End of search, empty dir"));
@@ -1930,8 +1925,7 @@
if (file->private_data) {
memset(file->private_data, 0,
sizeof (struct cifsFileInfo));
- cifsFile =
- (struct cifsFileInfo *) file->private_data;
+ cifsFile = file->private_data;
cifsFile->netfid = searchHandle;
cifsFile->invalidHandle = FALSE;
init_MUTEX(&cifsFile->fh_sem);
@@ -2104,7 +2098,7 @@
("Readdir on closed srch, pos = %lld",
file->f_pos));
} else {
- cifsFile = (struct cifsFileInfo *) file->private_data;
+ cifsFile = file->private_data;
if (cifsFile->srch_inf.endOfSearch) {
rc = 0;
cFYI(1, ("End of search "));
Index: linux/fs/cifs/misc.c
===================================================================
--- linux.orig/fs/cifs/misc.c 2005-01-12 20:13:40.124824088 +0200
+++ linux/fs/cifs/misc.c 2005-01-12 20:13:47.459709016 +0200
@@ -66,11 +66,7 @@
struct cifsSesInfo *
sesInfoAlloc(void)
{
- struct cifsSesInfo *ret_buf;
-
- ret_buf =
- (struct cifsSesInfo *) kmalloc(sizeof (struct cifsSesInfo),
- GFP_KERNEL);
+ struct cifsSesInfo *ret_buf = kmalloc(sizeof(*ret_buf), GFP_KERNEL);
if (ret_buf) {
memset(ret_buf, 0, sizeof (struct cifsSesInfo));
write_lock(&GlobalSMBSeslock);
@@ -109,10 +105,7 @@
struct cifsTconInfo *
tconInfoAlloc(void)
{
- struct cifsTconInfo *ret_buf;
- ret_buf =
- (struct cifsTconInfo *) kmalloc(sizeof (struct cifsTconInfo),
- GFP_KERNEL);
+ struct cifsTconInfo *ret_buf = kmalloc(sizeof (*ret_buf), GFP_KERNEL);
if (ret_buf) {
memset(ret_buf, 0, sizeof (struct cifsTconInfo));
write_lock(&GlobalSMBSeslock);
@@ -155,8 +148,7 @@
but it may be more efficient to always alloc same size
albeit slightly larger than necessary and maxbuffersize
defaults to this and can not be bigger */
- ret_buf =
- (struct smb_hdr *) mempool_alloc(cifs_req_poolp, SLAB_KERNEL | SLAB_NOFS);
+ ret_buf = mempool_alloc(cifs_req_poolp, SLAB_KERNEL | SLAB_NOFS);
/* clear the first few header bytes */
/* for most paths, more is cleared in header_assemble */
@@ -189,8 +181,7 @@
but it may be more efficient to always alloc same size
albeit slightly larger than necessary and maxbuffersize
defaults to this and can not be bigger */
- ret_buf =
- (struct smb_hdr *) mempool_alloc(cifs_sm_req_poolp, SLAB_KERNEL | SLAB_NOFS);
+ ret_buf = mempool_alloc(cifs_sm_req_poolp, SLAB_KERNEL | SLAB_NOFS);
if (ret_buf) {
/* No need to clear memory here, cleared in header assemble */
atomic_inc(&smBufAllocCount);
Index: linux/fs/cifs/readdir.c
===================================================================
--- linux.orig/fs/cifs/readdir.c 2005-01-12 20:13:40.126823784 +0200
+++ linux/fs/cifs/readdir.c 2005-01-12 20:13:47.460708864 +0200
@@ -65,7 +65,7 @@
} else {
memset(file->private_data,0,sizeof(struct cifsFileInfo));
}
- cifsFile = (struct cifsFileInfo *)file->private_data;
+ cifsFile = file->private_data;
cifsFile->invalidHandle = TRUE;
cifsFile->srch_inf.endOfSearch = FALSE;
@@ -221,7 +221,7 @@
int pos_in_buf = 0;
loff_t first_entry_in_buffer;
loff_t index_to_find = file->f_pos;
- struct cifsFileInfo * cifsFile = (struct cifsFileInfo *)file->private_data;
+ struct cifsFileInfo * cifsFile = file->private_data;
/* check if index in the buffer */
if((cifsFile == NULL) || (ppCurrentEntry == NULL) || (num_to_ret == NULL))
@@ -534,7 +534,7 @@
FreeXid(xid);
return rc;
}
- cifsFile = (struct cifsFileInfo *) file->private_data;
+ cifsFile = file->private_data;
if (cifsFile->srch_inf.endOfSearch) {
if(cifsFile->srch_inf.emptyDir) {
cFYI(1, ("End of search, empty dir"));
Index: linux/fs/cifs/transport.c
===================================================================
--- linux.orig/fs/cifs/transport.c 2005-01-12 20:13:40.127823632 +0200
+++ linux/fs/cifs/transport.c 2005-01-12 20:13:47.462708560 +0200
@@ -48,7 +48,7 @@
return NULL;
}
- temp = (struct mid_q_entry *) mempool_alloc(cifs_mid_poolp,SLAB_KERNEL | SLAB_NOFS);
+ temp = mempool_alloc(cifs_mid_poolp,SLAB_KERNEL | SLAB_NOFS);
if (temp == NULL)
return temp;
else {
@@ -90,8 +90,7 @@
cERROR(1, ("Null parms passed to AllocOplockQEntry"));
return NULL;
}
- temp = (struct oplock_q_entry *) kmem_cache_alloc(cifs_oplock_cachep,
- SLAB_KERNEL);
+ temp = kmem_cache_alloc(cifs_oplock_cachep, SLAB_KERNEL);
if (temp == NULL)
return temp;
else {
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/6] cifs: reduce deep nesting
2005-01-15 13:29 ` [PATCH 4/6] cifs: remove spurious casts Pekka Enberg
@ 2005-01-15 13:30 ` Pekka Enberg
2005-01-15 13:31 ` [PATCH 6/6] cifs: convert schedule_timeout to msleep and ssleep Pekka Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:30 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
This patch converts deep if statement nesting to use gotos in few places.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
cifsfs.c | 51 +++++++++++++++++++++++++++++++--------------------
connect.c | 44 ++++++++++++++++++++------------------------
2 files changed, 51 insertions(+), 44 deletions(-)
Index: linux/fs/cifs/cifsfs.c
===================================================================
--- linux.orig/fs/cifs/cifsfs.c 2005-01-11 08:04:55.007622032 +0200
+++ linux/fs/cifs/cifsfs.c 2005-01-11 08:04:57.454250088 +0200
@@ -839,26 +839,37 @@
}
rc = cifs_init_inodecache();
- if (!rc) {
- rc = cifs_init_mids();
- if (!rc) {
- rc = cifs_init_request_bufs();
- if (!rc) {
- rc = register_filesystem(&cifs_fs_type);
- if (!rc) {
- rc = (int)kernel_thread(cifs_oplock_thread, NULL,
- CLONE_FS | CLONE_FILES | CLONE_VM);
- if(rc > 0)
- return 0;
- else
- cERROR(1,("error %d create oplock thread",rc));
- }
- cifs_destroy_request_bufs();
- }
- cifs_destroy_mids();
- }
- cifs_destroy_inodecache();
- }
+ if (rc)
+ goto failed_init_inodecache;
+
+ rc = cifs_init_mids();
+ if (rc)
+ goto failed_init_mids;
+
+ rc = cifs_init_request_bufs();
+ if (rc)
+ goto failed_init_request_bufs;
+
+ rc = register_filesystem(&cifs_fs_type);
+ if (rc)
+ goto failed_register_filesystem;
+
+ rc = kernel_thread(cifs_oplock_thread, NULL,
+ CLONE_FS | CLONE_FILES | CLONE_VM);
+ if (rc <= 0)
+ goto failed_kernel_thread;
+
+ return 0;
+
+ failed_kernel_thread:
+ cERROR(1,("error %d create oplock thread",rc));
+ failed_register_filesystem:
+ cifs_destroy_request_bufs();
+ failed_init_request_bufs:
+ cifs_destroy_mids();
+ failed_init_mids:
+ cifs_destroy_inodecache();
+ failed_init_inodecache:
#ifdef CONFIG_PROC_FS
cifs_proc_clean();
#endif
Index: linux/fs/cifs/connect.c
===================================================================
--- linux.orig/fs/cifs/connect.c 2005-01-11 08:04:50.326333696 +0200
+++ linux/fs/cifs/connect.c 2005-01-11 08:04:57.457249632 +0200
@@ -122,11 +122,9 @@
read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &GlobalSMBSessionList) {
ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
- if (ses->server) {
- if (ses->server == server) {
- ses->status = CifsNeedReconnect;
- ses->ipc_tid = 0;
- }
+ if (ses->server && ses->server == server) {
+ ses->status = CifsNeedReconnect;
+ ses->ipc_tid = 0;
}
/* else tcp and smb sessions need reconnection */
}
@@ -857,33 +855,31 @@
char *userName, struct TCP_Server_Info **psrvTcp)
{
struct list_head *tmp;
- struct cifsSesInfo *ses;
+ struct cifsSesInfo *ret = NULL;
*psrvTcp = NULL;
read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &GlobalSMBSessionList) {
- ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
- if (ses->server) {
- if((target_ip_addr &&
- (ses->server->addr.sockAddr.sin_addr.s_addr
- == target_ip_addr->s_addr)) || (target_ip6_addr
- && memcmp(&ses->server->addr.sockAddr6.sin6_addr,
- target_ip6_addr,sizeof(*target_ip6_addr)))){
- /* BB lock server and tcp session and increment use count here?? */
- *psrvTcp = ses->server; /* found a match on the TCP session */
- /* BB check if reconnection needed */
- if (strncmp
- (ses->userName, userName,
- MAX_USERNAME_SIZE) == 0){
- read_unlock(&GlobalSMBSeslock);
- return ses; /* found exact match on both tcp and SMB sessions */
- }
+ struct cifsSesInfo * ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
+ if (!ses->server)
+ continue;
+ if((target_ip_addr &&
+ (ses->server->addr.sockAddr.sin_addr.s_addr
+ == target_ip_addr->s_addr)) || (target_ip6_addr
+ && memcmp(&ses->server->addr.sockAddr6.sin6_addr,
+ target_ip6_addr,sizeof(*target_ip6_addr)))){
+ /* BB lock server and tcp session and increment use count here?? */
+ *psrvTcp = ses->server; /* found a match on the TCP session */
+ /* BB check if reconnection needed */
+ if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) {
+ ret = ses;
+ goto out;
}
}
- /* else tcp and smb sessions need reconnection */
}
+ out:
read_unlock(&GlobalSMBSeslock);
- return NULL;
+ return ret;
}
static struct cifsTconInfo *
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 6/6] cifs: convert schedule_timeout to msleep and ssleep
2005-01-15 13:30 ` [PATCH 5/6] cifs: reduce deep nesting Pekka Enberg
@ 2005-01-15 13:31 ` Pekka Enberg
0 siblings, 0 replies; 6+ messages in thread
From: Pekka Enberg @ 2005-01-15 13:31 UTC (permalink / raw)
To: sfrench; +Cc: linux-kernel
This patch converts cifs code to use msleep() and ssleep() instead of
schedule_timeout().
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
cifsfs.c | 9 ++++-----
connect.c | 25 +++++++++----------------
2 files changed, 13 insertions(+), 21 deletions(-)
Index: 2.6/fs/cifs/cifsfs.c
===================================================================
--- 2.6.orig/fs/cifs/cifsfs.c 2005-01-12 23:33:14.476445944 +0200
+++ 2.6/fs/cifs/cifsfs.c 2005-01-12 23:37:09.402731720 +0200
@@ -32,6 +32,7 @@
#include <linux/seq_file.h>
#include <linux/vfs.h>
#include <linux/mempool.h>
+#include <linux/delay.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
@@ -748,14 +749,12 @@
oplockThread = current;
do {
- set_current_state(TASK_INTERRUPTIBLE);
-
- schedule_timeout(1*HZ);
+ ssleep(1);
+
spin_lock(&GlobalMid_Lock);
if(list_empty(&GlobalOplock_Q)) {
spin_unlock(&GlobalMid_Lock);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(39*HZ);
+ ssleep(39);
} else {
oplock_item = list_entry(GlobalOplock_Q.next,
struct oplock_q_entry, qhead);
Index: 2.6/fs/cifs/connect.c
===================================================================
--- 2.6.orig/fs/cifs/connect.c 2005-01-12 23:33:14.479445488 +0200
+++ 2.6/fs/cifs/connect.c 2005-01-12 23:37:47.396955720 +0200
@@ -29,6 +29,7 @@
#include <linux/ctype.h>
#include <linux/utsname.h>
#include <linux/mempool.h>
+#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
#include "cifspdu.h"
@@ -174,8 +175,7 @@
server->workstation_RFC1001_name);
}
if(rc) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(3 * HZ);
+ ssleep(3);
} else {
atomic_inc(&tcpSesReconnectCount);
spin_lock(&GlobalMid_Lock);
@@ -226,8 +226,7 @@
if (smb_buffer == NULL) {
cERROR(1,("Can not get memory for SMB response"));
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ * 3); /* give system time to free memory */
+ ssleep(3);
continue;
}
iov.iov_base = smb_buffer;
@@ -308,8 +307,7 @@
} else {
/* give server a second to
clean up before reconnect attempt */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ);
+ ssleep(1);
/* always try 445 first on reconnect
since we get NACK on some if we ever
connected to port 139 (the NACK is
@@ -433,8 +431,7 @@
and get out of SendReceive. */
wake_up_all(&server->request_q);
/* give those requests time to exit */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ/8);
+ msleep(125);
if(server->ssocket) {
sock_release(csocket);
@@ -471,17 +468,15 @@
}
spin_unlock(&GlobalMid_Lock);
read_unlock(&GlobalSMBSeslock);
- set_current_state(TASK_INTERRUPTIBLE);
/* 1/8th of sec is more than enough time for them to exit */
- schedule_timeout(HZ/8);
+ msleep(125);
}
if (list_empty(&server->pending_mid_q)) {
/* mpx threads have not exited yet give them
at least the smb send timeout time for long ops */
cFYI(1, ("Wait for exit from demultiplex thread"));
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(46 * HZ);
+ ssleep(46);
/* if threads still have not exited they are probably never
coming home not much else we can do but free the memory */
}
@@ -497,8 +492,7 @@
GFP_KERNEL);
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ/4);
+ msleep(250);
return 0;
}
@@ -2924,8 +2918,7 @@
cifs_sb->tcon = NULL;
if (ses) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ / 2);
+ msleep(500);
}
if (ses)
sesInfoFree(ses);
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-01-15 13:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15 13:25 [PATCH 1/6] cifs: copy_to_user and copy_from_user fixes Pekka Enberg
2005-01-15 13:26 ` [PATCH 2/6] cifs: remove dead code Pekka Enberg
2005-01-15 13:28 ` [PATCH 3/6] cifs: enum conversion Pekka Enberg
2005-01-15 13:29 ` [PATCH 4/6] cifs: remove spurious casts Pekka Enberg
2005-01-15 13:30 ` [PATCH 5/6] cifs: reduce deep nesting Pekka Enberg
2005-01-15 13:31 ` [PATCH 6/6] cifs: convert schedule_timeout to msleep and ssleep Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox