diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 19:20:31 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:29 -0400 |
commit | d143341815bdc7c45d5289a3ab5743c838332518 (patch) | |
tree | 2e94221eb03a569e07fa4118b7d68c507f66efb4 /fs/cifs/cifssmb.c | |
parent | 568798cc6211553e2494a6876fa19d064c822e79 (diff) |
CIFS: Move set_file_size to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index eb3d2cf76e6e..c4f43cf671dc 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -5395,16 +5395,16 @@ QFSPosixRetry: | |||
5395 | } | 5395 | } |
5396 | 5396 | ||
5397 | 5397 | ||
5398 | /* We can not use write of zero bytes trick to | 5398 | /* |
5399 | set file size due to need for large file support. Also note that | 5399 | * We can not use write of zero bytes trick to set file size due to need for |
5400 | this SetPathInfo is preferred to SetFileInfo based method in next | 5400 | * large file support. Also note that this SetPathInfo is preferred to |
5401 | routine which is only needed to work around a sharing violation bug | 5401 | * SetFileInfo based method in next routine which is only needed to work around |
5402 | in Samba which this routine can run into */ | 5402 | * a sharing violation bugin Samba which this routine can run into. |
5403 | 5403 | */ | |
5404 | int | 5404 | int |
5405 | CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, | 5405 | CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, |
5406 | const char *fileName, __u64 size, bool SetAllocation, | 5406 | const char *file_name, __u64 size, struct cifs_sb_info *cifs_sb, |
5407 | const struct nls_table *nls_codepage, int remap) | 5407 | bool set_allocation) |
5408 | { | 5408 | { |
5409 | struct smb_com_transaction2_spi_req *pSMB = NULL; | 5409 | struct smb_com_transaction2_spi_req *pSMB = NULL; |
5410 | struct smb_com_transaction2_spi_rsp *pSMBr = NULL; | 5410 | struct smb_com_transaction2_spi_rsp *pSMBr = NULL; |
@@ -5412,6 +5412,8 @@ CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, | |||
5412 | int name_len; | 5412 | int name_len; |
5413 | int rc = 0; | 5413 | int rc = 0; |
5414 | int bytes_returned = 0; | 5414 | int bytes_returned = 0; |
5415 | int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; | ||
5416 | |||
5415 | __u16 params, byte_count, data_count, param_offset, offset; | 5417 | __u16 params, byte_count, data_count, param_offset, offset; |
5416 | 5418 | ||
5417 | cFYI(1, "In SetEOF"); | 5419 | cFYI(1, "In SetEOF"); |
@@ -5423,14 +5425,14 @@ SetEOFRetry: | |||
5423 | 5425 | ||
5424 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 5426 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
5425 | name_len = | 5427 | name_len = |
5426 | cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName, | 5428 | cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name, |
5427 | PATH_MAX, nls_codepage, remap); | 5429 | PATH_MAX, cifs_sb->local_nls, remap); |
5428 | name_len++; /* trailing null */ | 5430 | name_len++; /* trailing null */ |
5429 | name_len *= 2; | 5431 | name_len *= 2; |
5430 | } else { /* BB improve the check for buffer overruns BB */ | 5432 | } else { /* BB improve the check for buffer overruns BB */ |
5431 | name_len = strnlen(fileName, PATH_MAX); | 5433 | name_len = strnlen(file_name, PATH_MAX); |
5432 | name_len++; /* trailing null */ | 5434 | name_len++; /* trailing null */ |
5433 | strncpy(pSMB->FileName, fileName, name_len); | 5435 | strncpy(pSMB->FileName, file_name, name_len); |
5434 | } | 5436 | } |
5435 | params = 6 + name_len; | 5437 | params = 6 + name_len; |
5436 | data_count = sizeof(struct file_end_of_file_info); | 5438 | data_count = sizeof(struct file_end_of_file_info); |
@@ -5444,7 +5446,7 @@ SetEOFRetry: | |||
5444 | param_offset = offsetof(struct smb_com_transaction2_spi_req, | 5446 | param_offset = offsetof(struct smb_com_transaction2_spi_req, |
5445 | InformationLevel) - 4; | 5447 | InformationLevel) - 4; |
5446 | offset = param_offset + params; | 5448 | offset = param_offset + params; |
5447 | if (SetAllocation) { | 5449 | if (set_allocation) { |
5448 | if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) | 5450 | if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) |
5449 | pSMB->InformationLevel = | 5451 | pSMB->InformationLevel = |
5450 | cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); | 5452 | cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); |
@@ -5491,8 +5493,8 @@ SetEOFRetry: | |||
5491 | } | 5493 | } |
5492 | 5494 | ||
5493 | int | 5495 | int |
5494 | CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, __u64 size, | 5496 | CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, |
5495 | __u16 fid, __u32 pid_of_opener, bool SetAllocation) | 5497 | struct cifsFileInfo *cfile, __u64 size, bool set_allocation) |
5496 | { | 5498 | { |
5497 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 5499 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
5498 | struct file_end_of_file_info *parm_data; | 5500 | struct file_end_of_file_info *parm_data; |
@@ -5506,8 +5508,8 @@ CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, __u64 size, | |||
5506 | if (rc) | 5508 | if (rc) |
5507 | return rc; | 5509 | return rc; |
5508 | 5510 | ||
5509 | pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); | 5511 | pSMB->hdr.Pid = cpu_to_le16((__u16)cfile->pid); |
5510 | pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); | 5512 | pSMB->hdr.PidHigh = cpu_to_le16((__u16)(cfile->pid >> 16)); |
5511 | 5513 | ||
5512 | params = 6; | 5514 | params = 6; |
5513 | pSMB->MaxSetupCount = 0; | 5515 | pSMB->MaxSetupCount = 0; |
@@ -5536,8 +5538,8 @@ CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, __u64 size, | |||
5536 | + offset); | 5538 | + offset); |
5537 | pSMB->DataOffset = cpu_to_le16(offset); | 5539 | pSMB->DataOffset = cpu_to_le16(offset); |
5538 | parm_data->FileSize = cpu_to_le64(size); | 5540 | parm_data->FileSize = cpu_to_le64(size); |
5539 | pSMB->Fid = fid; | 5541 | pSMB->Fid = cfile->fid.netfid; |
5540 | if (SetAllocation) { | 5542 | if (set_allocation) { |
5541 | if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) | 5543 | if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) |
5542 | pSMB->InformationLevel = | 5544 | pSMB->InformationLevel = |
5543 | cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); | 5545 | cpu_to_le16(SMB_SET_FILE_ALLOCATION_INFO2); |