Commit 61dd271d authored by Steve French's avatar Steve French Committed by Steve French

[CIFS] cifs readdir part 11. Also renames unused /proc/fs/cifs/QuotaEnabled...

[CIFS] cifs readdir part 11.  Also renames unused /proc/fs/cifs/QuotaEnabled config switch to NewReaddirEnabled for turning on testing of new readdir code

Signed-off-by: Steve French (sfrench@us.ibm.com)
parent b1fb0b05
......@@ -337,7 +337,7 @@ cifs_proc_init(void)
if (pde)
pde->write_proc = oplockEnabled_write;
pde = create_proc_read_entry("QuotaEnabled", 0, proc_fs_cifs,
pde = create_proc_read_entry("NewReaddirEnabled", 0, proc_fs_cifs,
quotaEnabled_read, NULL);
if (pde)
pde->write_proc = quotaEnabled_write;
......@@ -396,7 +396,7 @@ cifs_proc_clean(void)
remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
remove_proc_entry("QuotaEnabled",proc_fs_cifs);
remove_proc_entry("NewReaddirEnabled",proc_fs_cifs);
remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
remove_proc_entry("cifs", proc_root_fs);
}
......@@ -485,7 +485,7 @@ quotaEnabled_read(char *page, char **start, off_t off,
{
int len;
len = sprintf(page, "%d\n", quotaEnabled);
len = sprintf(page, "%d\n", experimEnabled);
/* could also check if quotas are enabled in kernel
as a whole first */
len -= off;
......@@ -512,9 +512,9 @@ quotaEnabled_write(struct file *file, const char __user *buffer,
if (rc)
return rc;
if (c == '0' || c == 'n' || c == 'N')
quotaEnabled = 0;
experimEnabled = 0;
else if (c == '1' || c == 'y' || c == 'Y')
quotaEnabled = 1;
experimEnabled = 1;
return count;
}
......
......@@ -50,7 +50,7 @@ int cifsFYI = 0;
int cifsERROR = 1;
int traceSMB = 0;
unsigned int oplockEnabled = 1;
unsigned int quotaEnabled = 0;
unsigned int experimEnabled = 0;
unsigned int linuxExtEnabled = 1;
unsigned int lookupCacheEnabled = 1;
unsigned int multiuser_mount = 0;
......
......@@ -243,7 +243,7 @@ struct cifsLockInfo {
struct cifs_search_info {
loff_t index_of_last_entry;
__u16 entries_in_buffer;
unsigned info_level;
__u16 info_level;
char * ntwrk_buf_start;
char * srch_entries_start;
unsigned endOfSearch:1;
......@@ -418,7 +418,7 @@ GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions
have the uid/password or Kerberos credential
or equivalent for current user */
GLOBAL_EXTERN unsigned int oplockEnabled;
GLOBAL_EXTERN unsigned int quotaEnabled;
GLOBAL_EXTERN unsigned int experimEnabled;
GLOBAL_EXTERN unsigned int lookupCacheEnabled;
GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent
with more secure ntlmssp2 challenge/resp */
......
......@@ -2096,7 +2096,6 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
return rc;
}
#ifdef CIFS_EXPERIMENTAL
/* xid, tcon, searchName and codepage are input parms, rest are returned */
int
CIFSFindFirst2(const int xid, struct cifsTconInfo *tcon,
......@@ -2166,16 +2165,8 @@ CIFSFindFirst2(const int xid, struct cifsTconInfo *tcon,
pSMB->SearchCount= cpu_to_le16(CIFS_MAX_MSGSIZE/sizeof(FILE_UNIX_INFO));
pSMB->SearchFlags = cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END |
CIFS_SEARCH_RETURN_RESUME);
pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
/* 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;
}
/* BB what should we set StorageType to? Does it matter? BB */
pSMB->SearchStorageType = 0;
pSMB->hdr.smb_buf_length += byte_count;
......@@ -2271,14 +2262,15 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon,
pSMB->SearchCount =
cpu_to_le16(CIFS_MAX_MSGSIZE / sizeof (FILE_UNIX_INFO));
/* test for Unix extensions */
if (tcon->ses->capabilities & CAP_UNIX) {
/* 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 = 0; /* BB fixme add resume_key BB */
pSMB->SearchFlags =
cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME);
......@@ -2345,8 +2337,6 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon,
return rc;
}
#endif /* CIFS_EXPERIMENTAL */
int
CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
FILE_DIRECTORY_INFO * findData, T2_FNEXT_RSP_PARMS * findParms,
......
......@@ -35,6 +35,8 @@
#include "cifs_debug.h"
#include "cifs_fs_sb.h"
extern int cifs_readdir2(struct file *file, void *direntry, filldir_t filldir); /* BB removeme BB */
int
cifs_open(struct inode *inode, struct file *file)
{
......@@ -452,20 +454,44 @@ cifs_closedir(struct inode *inode, struct file *file)
{
int rc = 0;
int xid;
struct cifsFileInfo *pSMBFileStruct =
struct cifsFileInfo *pCFileStruct =
(struct cifsFileInfo *) file->private_data;
char * ptmp;
cFYI(1, ("Closedir inode = 0x%p with ", inode));
xid = GetXid();
/* BB add code to close search if not end of search BB */
if (pCFileStruct) {
struct cifsTconInfo *pTcon;
struct cifs_sb_info * cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon;
if (pSMBFileStruct) {
cFYI(1, ("Freeing private data in close dir"));
if(pCFileStruct->srch_inf.endOfSearch == FALSE) {
pCFileStruct->invalidHandle = TRUE;
rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid);
cFYI(1,("Closing uncompleted readdir with rc %d",rc));
/* not much we can do if it fails anywway, ignore rc */
rc = 0;
}
ptmp = pCFileStruct->srch_inf.ntwrk_buf_start;
if(ptmp) {
cFYI(1,("freeing smb buf in srch struct in closedir")); /* BB removeme BB */
pCFileStruct->srch_inf.ntwrk_buf_start = NULL;
cifs_buf_release(ptmp);
}
ptmp = pCFileStruct->search_resume_name;
if(ptmp) {
cFYI(1,("freeing resume name in closedir")); /* BB removeme BB */
pCFileStruct->search_resume_name = NULL;
kfree(ptmp);
}
kfree(file->private_data);
file->private_data = NULL;
}
/* BB can we lock the filestruct while this is going on? */
FreeXid(xid);
return rc;
}
......@@ -1519,7 +1545,7 @@ unix_fill_in_inode(struct inode *tmp_inode,
/* Returns one if new inode created (which therefore needs to be hashed) */
/* Might check in the future if inode number changed so we can rehash inode */
static int
int
construct_dentry(struct qstr *qstring, struct file *file,
struct inode **ptmp_inode, struct dentry **pnew_dentry)
{
......@@ -1696,6 +1722,13 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
FILE_DIRECTORY_INFO *lastFindData;
FILE_UNIX_INFO *pfindDataUnix;
/* BB removeme begin */
if(experimEnabled)
return cifs_readdir2(file,direntry,filldir);
/* BB removeme end */
xid = GetXid();
if(file->f_dentry == NULL) {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment