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 | 568798cc6211553e2494a6876fa19d064c822e79 (patch) | |
tree | fa73b97cac75ae54a08a5e0dfc26c2120243a412 /fs/cifs/smb2inode.c | |
parent | d6e906f1b571d15ff5778a049802f6ef6f70159a (diff) |
CIFS: Add SMB2 support for hardlink operation
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2inode.c')
-rw-r--r-- | fs/cifs/smb2inode.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index a6952bafe331..1921c9c87ccd 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
@@ -78,6 +78,10 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon, | |||
78 | tmprc = SMB2_rename(xid, tcon, persistent_fid, volatile_fid, | 78 | tmprc = SMB2_rename(xid, tcon, persistent_fid, volatile_fid, |
79 | (__le16 *)data); | 79 | (__le16 *)data); |
80 | break; | 80 | break; |
81 | case SMB2_OP_HARDLINK: | ||
82 | tmprc = SMB2_set_hardlink(xid, tcon, persistent_fid, | ||
83 | volatile_fid, (__le16 *)data); | ||
84 | break; | ||
81 | default: | 85 | default: |
82 | cERROR(1, "Invalid command"); | 86 | cERROR(1, "Invalid command"); |
83 | break; | 87 | break; |
@@ -175,10 +179,10 @@ smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name, | |||
175 | SMB2_OP_DELETE); | 179 | SMB2_OP_DELETE); |
176 | } | 180 | } |
177 | 181 | ||
178 | int | 182 | static int |
179 | smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon, | 183 | smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon, |
180 | const char *from_name, const char *to_name, | 184 | const char *from_name, const char *to_name, |
181 | struct cifs_sb_info *cifs_sb) | 185 | struct cifs_sb_info *cifs_sb, __u32 access, int command) |
182 | { | 186 | { |
183 | __le16 *smb2_to_name = NULL; | 187 | __le16 *smb2_to_name = NULL; |
184 | int rc; | 188 | int rc; |
@@ -189,9 +193,27 @@ smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon, | |||
189 | goto smb2_rename_path; | 193 | goto smb2_rename_path; |
190 | } | 194 | } |
191 | 195 | ||
192 | rc = smb2_open_op_close(xid, tcon, cifs_sb, from_name, DELETE, | 196 | rc = smb2_open_op_close(xid, tcon, cifs_sb, from_name, access, |
193 | FILE_OPEN, 0, 0, smb2_to_name, SMB2_OP_RENAME); | 197 | FILE_OPEN, 0, 0, smb2_to_name, command); |
194 | smb2_rename_path: | 198 | smb2_rename_path: |
195 | kfree(smb2_to_name); | 199 | kfree(smb2_to_name); |
196 | return rc; | 200 | return rc; |
197 | } | 201 | } |
202 | |||
203 | int | ||
204 | smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon, | ||
205 | const char *from_name, const char *to_name, | ||
206 | struct cifs_sb_info *cifs_sb) | ||
207 | { | ||
208 | return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, | ||
209 | DELETE, SMB2_OP_RENAME); | ||
210 | } | ||
211 | |||
212 | int | ||
213 | smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, | ||
214 | const char *from_name, const char *to_name, | ||
215 | struct cifs_sb_info *cifs_sb) | ||
216 | { | ||
217 | return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, | ||
218 | FILE_READ_ATTRIBUTES, SMB2_OP_HARDLINK); | ||
219 | } | ||