aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-09-18 23:49:21 -0400
committerSteve French <sfrench@us.ibm.com>2005-09-18 23:49:21 -0400
commit3e87d80391c84eefceb4bda94a6363661dba4f71 (patch)
treeef39515dde8b86007de4ad769716d375b8973dca
parentf9f5c81769f88bccd177423a30a7d30461754c39 (diff)
[CIFS] Add support for legacy servers part seven. Fix open for write,
begin implementation of Win9x style set file size via open then write of zero bytes. Signed-off-by: Steve French (sfrench@us.ibm.com)
-rw-r--r--fs/cifs/cifssmb.c10
-rw-r--r--fs/cifs/inode.c15
2 files changed, 21 insertions, 4 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index b8830118f09a..575b2281518d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -766,7 +766,7 @@ OldOpenRetry:
766 if(create_options & CREATE_OPTION_SPECIAL) 766 if(create_options & CREATE_OPTION_SPECIAL)
767 pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); 767 pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM);
768 else 768 else
769 pSMB->FileAttributes = cpu_to_le16(ATTR_NORMAL); 769 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); /* BB FIXME */
770 770
771 /* if ((omode & S_IWUGO) == 0) 771 /* if ((omode & S_IWUGO) == 0)
772 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ 772 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/
@@ -777,6 +777,8 @@ OldOpenRetry:
777 /* BB FIXME BB */ 777 /* BB FIXME BB */
778/* pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); */ 778/* pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); */
779 /* BB FIXME END BB */ 779 /* BB FIXME END BB */
780
781 pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
780 pSMB->OpenFunction = convert_disposition(openDisposition); 782 pSMB->OpenFunction = convert_disposition(openDisposition);
781 count += name_len; 783 count += name_len;
782 pSMB->hdr.smb_buf_length += count; 784 pSMB->hdr.smb_buf_length += count;
@@ -3689,7 +3691,7 @@ SetEOFRetry:
3689 PATH_MAX, nls_codepage, remap); 3691 PATH_MAX, nls_codepage, remap);
3690 name_len++; /* trailing null */ 3692 name_len++; /* trailing null */
3691 name_len *= 2; 3693 name_len *= 2;
3692 } else { /* BB improve the check for buffer overruns BB */ 3694 } else { /* BB improve the check for buffer overruns BB */
3693 name_len = strnlen(fileName, PATH_MAX); 3695 name_len = strnlen(fileName, PATH_MAX);
3694 name_len++; /* trailing null */ 3696 name_len++; /* trailing null */
3695 strncpy(pSMB->FileName, fileName, name_len); 3697 strncpy(pSMB->FileName, fileName, name_len);
@@ -3697,7 +3699,7 @@ SetEOFRetry:
3697 params = 6 + name_len; 3699 params = 6 + name_len;
3698 data_count = sizeof (struct file_end_of_file_info); 3700 data_count = sizeof (struct file_end_of_file_info);
3699 pSMB->MaxParameterCount = cpu_to_le16(2); 3701 pSMB->MaxParameterCount = cpu_to_le16(2);
3700 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ 3702 pSMB->MaxDataCount = cpu_to_le16(4100);
3701 pSMB->MaxSetupCount = 0; 3703 pSMB->MaxSetupCount = 0;
3702 pSMB->Reserved = 0; 3704 pSMB->Reserved = 0;
3703 pSMB->Flags = 0; 3705 pSMB->Flags = 0;
@@ -4079,7 +4081,7 @@ setPermsRetry:
4079 PATH_MAX, nls_codepage, remap); 4081 PATH_MAX, nls_codepage, remap);
4080 name_len++; /* trailing null */ 4082 name_len++; /* trailing null */
4081 name_len *= 2; 4083 name_len *= 2;
4082 } else { /* BB improve the check for buffer overruns BB */ 4084 } else { /* BB improve the check for buffer overruns BB */
4083 name_len = strnlen(fileName, PATH_MAX); 4085 name_len = strnlen(fileName, PATH_MAX);
4084 name_len++; /* trailing null */ 4086 name_len++; /* trailing null */
4085 strncpy(pSMB->FileName, fileName, name_len); 4087 strncpy(pSMB->FileName, fileName, name_len);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0fbe02ebc033..6e82e1ae03b4 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1030,6 +1030,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1030 /* now that we found one valid file 1030 /* now that we found one valid file
1031 handle no sense continuing to loop 1031 handle no sense continuing to loop
1032 trying others, so break here */ 1032 trying others, so break here */
1033 /* if(rc == -EINVAL) {
1034 int bytes_written;
1035 rc = CIFSSMBWrite(xid, pTcon,
1036 nfid, 0,
1037 attrs->ia_size,
1038 &bytes_written,
1039 NULL, NULL, long_op);
1040 } */
1033 break; 1041 break;
1034 } 1042 }
1035 } 1043 }
@@ -1048,6 +1056,13 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1048 cifs_sb->mnt_cifs_flags & 1056 cifs_sb->mnt_cifs_flags &
1049 CIFS_MOUNT_MAP_SPECIAL_CHR); 1057 CIFS_MOUNT_MAP_SPECIAL_CHR);
1050 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc)); 1058 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc));
1059 /* if(rc == -EINVAL)
1060 old_style_set_eof_via_write(xid, pTcon,
1061 full_path,
1062 attrs->ia_size,
1063 cifs_sb->local_nls,
1064 cifs_sb->mnt_cifs_flags &
1065 CIFS_MOUNT_MAP_SPECIAL_CHR);*/
1051 } 1066 }
1052 1067
1053 /* Server is ok setting allocation size implicitly - no need 1068 /* Server is ok setting allocation size implicitly - no need