diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-10 08:14:18 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-07-27 16:17:47 -0400 |
commit | f958ca5d88e6071767b10549d544b3475dfb6996 (patch) | |
tree | 4e64f85c54c287b98740936b27a96b27cac4e110 /fs | |
parent | a0e731839dd461eee0fe2dc026e0965e961e2730 (diff) |
CIFS: Move rmdir code to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsglob.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 15 | ||||
-rw-r--r-- | fs/cifs/inode.c | 15 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 1 |
5 files changed, 24 insertions, 13 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 939f91aac162..977dc0e85ccb 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -253,6 +253,9 @@ struct smb_version_operations { | |||
253 | void (*mkdir_setinfo)(struct inode *, const char *, | 253 | void (*mkdir_setinfo)(struct inode *, const char *, |
254 | struct cifs_sb_info *, struct cifs_tcon *, | 254 | struct cifs_sb_info *, struct cifs_tcon *, |
255 | const unsigned int); | 255 | const unsigned int); |
256 | /* remove directory */ | ||
257 | int (*rmdir)(const unsigned int, struct cifs_tcon *, const char *, | ||
258 | struct cifs_sb_info *); | ||
256 | }; | 259 | }; |
257 | 260 | ||
258 | struct smb_version_values { | 261 | struct smb_version_values { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 5e128fb2b618..f1bbf8305d3a 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -297,8 +297,7 @@ extern int CIFSSMBUnixSetPathInfo(const unsigned int xid, | |||
297 | extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon, | 297 | extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon, |
298 | const char *name, struct cifs_sb_info *cifs_sb); | 298 | const char *name, struct cifs_sb_info *cifs_sb); |
299 | extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, | 299 | extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, |
300 | const char *name, const struct nls_table *nls_codepage, | 300 | const char *name, struct cifs_sb_info *cifs_sb); |
301 | int remap_special_chars); | ||
302 | extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon, | 301 | extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon, |
303 | const char *name, __u16 type, | 302 | const char *name, __u16 type, |
304 | const struct nls_table *nls_codepage, | 303 | const struct nls_table *nls_codepage, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index eb74cceef480..074923ce593d 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -948,15 +948,15 @@ DelFileRetry: | |||
948 | } | 948 | } |
949 | 949 | ||
950 | int | 950 | int |
951 | CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, | 951 | CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon, const char *name, |
952 | const char *dirName, const struct nls_table *nls_codepage, | 952 | struct cifs_sb_info *cifs_sb) |
953 | int remap) | ||
954 | { | 953 | { |
955 | DELETE_DIRECTORY_REQ *pSMB = NULL; | 954 | DELETE_DIRECTORY_REQ *pSMB = NULL; |
956 | DELETE_DIRECTORY_RSP *pSMBr = NULL; | 955 | DELETE_DIRECTORY_RSP *pSMBr = NULL; |
957 | int rc = 0; | 956 | int rc = 0; |
958 | int bytes_returned; | 957 | int bytes_returned; |
959 | int name_len; | 958 | int name_len; |
959 | int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; | ||
960 | 960 | ||
961 | cFYI(1, "In CIFSSMBRmDir"); | 961 | cFYI(1, "In CIFSSMBRmDir"); |
962 | RmDirRetry: | 962 | RmDirRetry: |
@@ -966,14 +966,15 @@ RmDirRetry: | |||
966 | return rc; | 966 | return rc; |
967 | 967 | ||
968 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 968 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
969 | name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, dirName, | 969 | name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name, |
970 | PATH_MAX, nls_codepage, remap); | 970 | PATH_MAX, cifs_sb->local_nls, |
971 | remap); | ||
971 | name_len++; /* trailing null */ | 972 | name_len++; /* trailing null */ |
972 | name_len *= 2; | 973 | name_len *= 2; |
973 | } else { /* BB improve check for buffer overruns BB */ | 974 | } else { /* BB improve check for buffer overruns BB */ |
974 | name_len = strnlen(dirName, PATH_MAX); | 975 | name_len = strnlen(name, PATH_MAX); |
975 | name_len++; /* trailing null */ | 976 | name_len++; /* trailing null */ |
976 | strncpy(pSMB->DirName, dirName, name_len); | 977 | strncpy(pSMB->DirName, name, name_len); |
977 | } | 978 | } |
978 | 979 | ||
979 | pSMB->BufferFormat = 0x04; | 980 | pSMB->BufferFormat = 0x04; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index d7e74b1268cb..7354877fa3bd 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1426,7 +1426,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1426 | unsigned int xid; | 1426 | unsigned int xid; |
1427 | struct cifs_sb_info *cifs_sb; | 1427 | struct cifs_sb_info *cifs_sb; |
1428 | struct tcon_link *tlink; | 1428 | struct tcon_link *tlink; |
1429 | struct cifs_tcon *pTcon; | 1429 | struct cifs_tcon *tcon; |
1430 | struct TCP_Server_Info *server; | ||
1430 | char *full_path = NULL; | 1431 | char *full_path = NULL; |
1431 | struct cifsInodeInfo *cifsInode; | 1432 | struct cifsInodeInfo *cifsInode; |
1432 | 1433 | ||
@@ -1446,10 +1447,16 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1446 | rc = PTR_ERR(tlink); | 1447 | rc = PTR_ERR(tlink); |
1447 | goto rmdir_exit; | 1448 | goto rmdir_exit; |
1448 | } | 1449 | } |
1449 | pTcon = tlink_tcon(tlink); | 1450 | tcon = tlink_tcon(tlink); |
1451 | server = tcon->ses->server; | ||
1452 | |||
1453 | if (!server->ops->rmdir) { | ||
1454 | rc = -ENOSYS; | ||
1455 | cifs_put_tlink(tlink); | ||
1456 | goto rmdir_exit; | ||
1457 | } | ||
1450 | 1458 | ||
1451 | rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls, | 1459 | rc = server->ops->rmdir(xid, tcon, full_path, cifs_sb); |
1452 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
1453 | cifs_put_tlink(tlink); | 1460 | cifs_put_tlink(tlink); |
1454 | 1461 | ||
1455 | if (!rc) { | 1462 | if (!rc) { |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 861e2df0c37d..3129ac74b819 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -643,6 +643,7 @@ struct smb_version_operations smb1_operations = { | |||
643 | .echo = CIFSSMBEcho, | 643 | .echo = CIFSSMBEcho, |
644 | .mkdir = CIFSSMBMkDir, | 644 | .mkdir = CIFSSMBMkDir, |
645 | .mkdir_setinfo = cifs_mkdir_setinfo, | 645 | .mkdir_setinfo = cifs_mkdir_setinfo, |
646 | .rmdir = CIFSSMBRmDir, | ||
646 | }; | 647 | }; |
647 | 648 | ||
648 | struct smb_version_values smb1_values = { | 649 | struct smb_version_values smb1_values = { |