ChangeSet 1.2203, 2005/03/29 11:25:49-08:00, [EMAIL PROTECTED]

        Merge bk://linux.bkbits.net/linux-2.5
        into bkbits.net:/repos/c/cifs/linux-2.5cifs



 cifsfs.c  |   69 ++++++++++++++++++++++++++++----------------------------------
 connect.c |   54 +++++++++++++++++++++++++++++++++++-------------
 2 files changed, 71 insertions(+), 52 deletions(-)


diff -Nru a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
--- a/fs/cifs/cifsfs.c  2005-03-30 12:11:30 -08:00
+++ b/fs/cifs/cifsfs.c  2005-03-30 12:11:30 -08:00
@@ -57,6 +57,7 @@
 unsigned int extended_security = 0;
 unsigned int ntlmv2_support = 0;
 unsigned int sign_CIFS_PDUs = 1;
+extern struct task_struct * oplockThread; /* remove sparse warning */
 struct task_struct * oplockThread = NULL;
 unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
 module_param(CIFSMaxBufSize, int, 0);
@@ -73,6 +74,12 @@
 
 static DECLARE_COMPLETION(cifs_oplock_exited);
 
+extern mempool_t *cifs_sm_req_poolp;
+extern mempool_t *cifs_req_poolp;
+extern mempool_t *cifs_mid_poolp;
+
+extern kmem_cache_t *cifs_oplock_cachep;
+
 static int
 cifs_read_super(struct super_block *sb, void *data,
                const char *devname, int silent)
@@ -229,9 +236,7 @@
 cifs_alloc_inode(struct super_block *sb)
 {
        struct cifsInodeInfo *cifs_inode;
-       cifs_inode =
-           (struct cifsInodeInfo *) kmem_cache_alloc(cifs_inode_cachep,
-                                                     SLAB_KERNEL);
+       cifs_inode = kmem_cache_alloc(cifs_inode_cachep, SLAB_KERNEL);
        if (!cifs_inode)
                return NULL;
        cifs_inode->cifsAttrs = 0x20;   /* default */
@@ -438,28 +443,13 @@
 cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size,
           loff_t * poffset)
 {
-       if(file == NULL)
-               return -EIO;
-       else if(file->f_dentry == NULL)
+       if(file->f_dentry == NULL)
                return -EIO;
        else if(file->f_dentry->d_inode == NULL)
                return -EIO;
 
        cFYI(1,("In read_wrapper size %zd at %lld",read_size,*poffset));
 
-#ifdef CONFIG_CIFS_EXPERIMENTAL
-       /* check whether we can cache writes locally */
-       if(file->f_dentry->d_sb) {
-               struct cifs_sb_info *cifs_sb;
-               cifs_sb = CIFS_SB(file->f_dentry->d_sb);
-               if(cifs_sb != NULL) {
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
-                               return cifs_user_read(file,read_data,
-                                                       read_size,poffset);
-               }
-       }
-#endif /* CIFS_EXPERIMENTAL */
-
        if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) {
                return generic_file_read(file,read_data,read_size,poffset);
        } else {
@@ -483,28 +473,13 @@
 {
        ssize_t written;
 
-       if(file == NULL)
-               return -EIO;
-       else if(file->f_dentry == NULL)
+       if(file->f_dentry == NULL)
                return -EIO;
        else if(file->f_dentry->d_inode == NULL)
                return -EIO;
 
        cFYI(1,("In write_wrapper size %zd at %lld",write_size,*poffset));
 
-#ifdef CONFIG_CIFS_EXPERIMENTAL    /* BB fixme - fix user char * to kernel 
char * mapping here BB */
-       /* check whether we can cache writes locally */
-       if(file->f_dentry->d_sb) {
-               struct cifs_sb_info *cifs_sb;
-               cifs_sb = CIFS_SB(file->f_dentry->d_sb);
-               if(cifs_sb != NULL) {
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
-                               return cifs_user_write(file,write_data,
-                                                       write_size,poffset);
-                       }
-               }
-       }
-#endif /* CIFS_EXPERIMENTAL */
        written = generic_file_write(file,write_data,write_size,poffset);
        if(!CIFS_I(file->f_dentry->d_inode)->clientCanCacheAll)  {
                if(file->f_dentry->d_inode->i_mapping) {
@@ -585,6 +560,26 @@
        .mmap  = cifs_file_mmap,
        .sendfile = generic_file_sendfile,
 #ifdef CONFIG_CIFS_EXPERIMENTAL
+       .readv = generic_file_readv,
+       .writev = generic_file_writev,
+       .aio_read = generic_file_aio_read,
+       .aio_write = generic_file_aio_write,
+       .dir_notify = cifs_dir_notify,
+#endif /* CONFIG_CIFS_EXPERIMENTAL */
+};
+
+struct file_operations cifs_file_direct_ops = {
+       /* no mmap, no aio, no readv - 
+          BB reevaluate whether they can be done with directio, no cache */
+       .read = cifs_user_read,
+       .write = cifs_user_write,
+       .open = cifs_open,
+       .release = cifs_close,
+       .lock = cifs_lock,
+       .fsync = cifs_fsync,
+       .flush = cifs_flush,
+       .sendfile = generic_file_sendfile, /* BB removeme BB */
+#ifdef CONFIG_CIFS_EXPERIMENTAL
        .dir_notify = cifs_dir_notify,
 #endif /* CONFIG_CIFS_EXPERIMENTAL */
 };
@@ -601,7 +596,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) {
@@ -654,7 +649,7 @@
                cifs_min_rcv = 1;
        else if (cifs_min_rcv > 64) {
                cifs_min_rcv = 64;
-               cFYI(1,("cifs_min_rcv set to maximum (64)"));
+               cERROR(1,("cifs_min_rcv set to maximum (64)"));
        }
 
        cifs_req_poolp = mempool_create(cifs_min_rcv,
diff -Nru a/fs/cifs/connect.c b/fs/cifs/connect.c
--- a/fs/cifs/connect.c 2005-03-30 12:11:30 -08:00
+++ b/fs/cifs/connect.c 2005-03-30 12:11:30 -08:00
@@ -543,9 +543,18 @@
                                return 1;
                        }
                } else if (strnicmp(data, "pass", 4) == 0) {
-                       if (!value || !*value) {
+                       if (!value) {
                                vol->password = NULL;
                                continue;
+                       } else if(value[0] == 0) {
+                               /* check if string begins with double comma
+                                  since that would mean the password really
+                                  does start with a comma, and would not
+                                  indicate an empty string */
+                               if(value[1] != separator[0]) {
+                                       vol->password = NULL;
+                                       continue;
+                               }
                        }
                        temp_len = strlen(value);
                        /* removed password length check, NTLM passwords
@@ -560,15 +569,20 @@
 
                        /* NB: password legally can have multiple commas and
                        the only illegal character in a password is null */
-                               
+
                        if ((value[temp_len] == 0) && (value[temp_len+1] == 
separator[0])) {
                                /* reinsert comma */
                                value[temp_len] = separator[0];
                                temp_len+=2;  /* move after the second comma */
                                while(value[temp_len] != 0)  {
-                                       if((value[temp_len] == separator[0]) && 
(value[temp_len+1] != separator[0])) {
-                                               /* single comma indicating 
start of next parm */
-                                               break;
+                                       if (value[temp_len] == separator[0]) {
+                                               if (value[temp_len+1] == 
separator[0]) {
+                                                       temp_len++; /* skip 
second comma */
+                                               } else { 
+                                               /* single comma indicating start
+                                                        of next parm */
+                                                       break;
+                                               }
                                        }
                                        temp_len++;
                                }
@@ -576,10 +590,12 @@
                                        options = NULL;
                                } else {
                                        value[temp_len] = 0;
-                                       /* move options to point to start of 
next parm */
+                                       /* point option to start of next parm */
                                        options = value + temp_len + 1;
                                }
-                               /* go from value to (value + temp_len) 
condensing double commas to singles */
+                               /* go from value to value + temp_len condensing 
+                               double commas to singles. Note that this ends up
+                               allocating a few bytes too many, which is ok */
                                vol->password = cifs_kcalloc(temp_len, 
GFP_KERNEL);
                                for(i=0,j=0;i<temp_len;i++,j++) {
                                        vol->password[j] = value[i];
@@ -588,8 +604,7 @@
                                                i++;
                                        }
                                }
-                               /* value[temp_len] is zeroed above so
-                                        vol->password[temp_len] guaranteed to 
be null */
+                               vol->password[j] = 0;
                        } else {
                                vol->password = cifs_kcalloc(temp_len + 1, 
GFP_KERNEL);
                                strcpy(vol->password, value);
@@ -1182,6 +1197,7 @@
        }
 
        if (volume_info.username) {
+               /* BB fixme parse for domain name here */
                cFYI(1, ("Username: %s ", volume_info.username));
 
        } else {
@@ -1564,7 +1580,8 @@
        if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | 
SECMODE_SIGN_ENABLED))
                smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
 
-       capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | 
CAP_LARGE_WRITE_X | CAP_LARGE_READ_X;
+       capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS |
+               CAP_LARGE_WRITE_X | CAP_LARGE_READ_X;
        if (ses->capabilities & CAP_UNICODE) {
                smb_buffer->Flags2 |= SMBFLG2_UNICODE;
                capabilities |= CAP_UNICODE;
@@ -1591,7 +1608,7 @@
        bcc_ptr += CIFS_SESSION_KEY_SIZE;
 
        if (ses->capabilities & CAP_UNICODE) {
-               if ((long) bcc_ptr % 2) {       /* must be word aligned for 
Unicode */
+               if ((long) bcc_ptr % 2) { /* must be word aligned for Unicode */
                        *bcc_ptr = 0;
                        bcc_ptr++;
                }
@@ -1601,7 +1618,8 @@
                        bytes_returned =
                                cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100,
                                        nls_codepage);
-               bcc_ptr += 2 * bytes_returned;  /* convert num 16 bit words to 
bytes */
+               /* convert number of 16 bit words to bytes */
+               bcc_ptr += 2 * bytes_returned;
                bcc_ptr += 2;   /* trailing null */
                if (domain == NULL)
                        bytes_returned =
@@ -1618,8 +1636,8 @@
                                  32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bytes_returned =
-                   cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 
32,
-                                 nls_codepage);
+                   cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release,
+                                 32, nls_codepage);
                bcc_ptr += 2 * bytes_returned;
                bcc_ptr += 2;
                bytes_returned =
@@ -1705,6 +1723,11 @@
                                        bcc_ptr += 2 * (len + 1);
                                        ses->serverNOS[2 * len] = 0;
                                        ses->serverNOS[1 + (2 * len)] = 0;
+                                       if(strncmp(ses->serverNOS,
+                                               "NT LAN Manager 4",16) == 0) {
+                                               cFYI(1,("NT4 server"));
+                                               ses->flags |= CIFS_SES_NT4;
+                                       }
                                        remaining_words -= len + 1;
                                        if (remaining_words > 0) {
                                                len = UniStrnlen((wchar_t *) 
bcc_ptr, remaining_words); 
@@ -2909,7 +2932,8 @@
                                return 0;
                        } else if (rc == -ESHUTDOWN) {
                                cFYI(1,("Waking up socket by sending it 
signal"));
-                               send_sig(SIGKILL,cifsd_task,1);
+                               if(cifsd_task)
+                                       send_sig(SIGKILL,cifsd_task,1);
                                rc = 0;
                        } /* else - we have an smb session
                                left on this socket do not kill cifsd */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to