aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-18 19:20:32 -0400
committerSteve French <smfrench@gmail.com>2012-09-24 22:46:29 -0400
commitc839ff244ba2d54d0933596e29a4b03e3c846a9a (patch)
tree91c58400bd08c1e5a18ed33cca16f7b890be5dde /fs/cifs/smb2pdu.c
parentd143341815bdc7c45d5289a3ab5743c838332518 (diff)
CIFS: Add SMB2 support for set_file_size
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index a684c4ab42d6..74a8381400b1 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1605,7 +1605,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
1605 1605
1606static int 1606static int
1607send_set_info(const unsigned int xid, struct cifs_tcon *tcon, 1607send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
1608 u64 persistent_fid, u64 volatile_fid, int info_class, 1608 u64 persistent_fid, u64 volatile_fid, u32 pid, int info_class,
1609 unsigned int num, void **data, unsigned int *size) 1609 unsigned int num, void **data, unsigned int *size)
1610{ 1610{
1611 struct smb2_set_info_req *req; 1611 struct smb2_set_info_req *req;
@@ -1635,6 +1635,8 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
1635 return rc; 1635 return rc;
1636 } 1636 }
1637 1637
1638 req->hdr.ProcessId = cpu_to_le32(pid);
1639
1638 req->InfoType = SMB2_O_INFO_FILE; 1640 req->InfoType = SMB2_O_INFO_FILE;
1639 req->FileInfoClass = info_class; 1641 req->FileInfoClass = info_class;
1640 req->PersistentFileId = persistent_fid; 1642 req->PersistentFileId = persistent_fid;
@@ -1705,7 +1707,8 @@ SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
1705 size[1] = len + 2 /* null */; 1707 size[1] = len + 2 /* null */;
1706 1708
1707 rc = send_set_info(xid, tcon, persistent_fid, volatile_fid, 1709 rc = send_set_info(xid, tcon, persistent_fid, volatile_fid,
1708 FILE_RENAME_INFORMATION, 2, data, size); 1710 current->tgid, FILE_RENAME_INFORMATION, 2, data,
1711 size);
1709 kfree(data); 1712 kfree(data);
1710 return rc; 1713 return rc;
1711} 1714}
@@ -1736,7 +1739,24 @@ SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
1736 size[1] = len + 2 /* null */; 1739 size[1] = len + 2 /* null */;
1737 1740
1738 rc = send_set_info(xid, tcon, persistent_fid, volatile_fid, 1741 rc = send_set_info(xid, tcon, persistent_fid, volatile_fid,
1739 FILE_LINK_INFORMATION, 2, data, size); 1742 current->tgid, FILE_LINK_INFORMATION, 2, data, size);
1740 kfree(data); 1743 kfree(data);
1741 return rc; 1744 return rc;
1742} 1745}
1746
1747int
1748SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1749 u64 volatile_fid, u32 pid, __le64 *eof)
1750{
1751 struct smb2_file_eof_info info;
1752 void *data;
1753 unsigned int size;
1754
1755 info.EndOfFile = *eof;
1756
1757 data = &info;
1758 size = sizeof(struct smb2_file_eof_info);
1759
1760 return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid,
1761 FILE_END_OF_FILE_INFORMATION, 1, &data, &size);
1762}