diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-08-05 21:15:22 +0200 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-09-29 19:04:31 +0000 |
commit | 8713d01db8bf948eb9632726f529ec4f821bb025 (patch) | |
tree | 005e84ec721d09e3b661faacbf2ca458e02e9998 | |
parent | 18bddd1059c5d1e17ad6e49c514c95484aa80a33 (diff) | |
download | linux-8713d01db8bf948eb9632726f529ec4f821bb025.tar.bz2 |
cifs: implement CIFSCreateMFSymLink()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/link.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 0473a86031a5..1b2a8c971995 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -133,6 +133,51 @@ CIFSFormatMFSymlink(u8 *buf, unsigned int buf_len, const char *link_str) return 0; } +static int +CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, + const char *fromName, const char *toName, + const struct nls_table *nls_codepage, int remap) +{ + int rc; + int oplock = 0; + __u16 netfid = 0; + u8 *buf; + unsigned int bytes_written = 0; + + buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + rc = CIFSFormatMFSymlink(buf, CIFS_MF_SYMLINK_FILE_SIZE, toName); + if (rc != 0) { + kfree(buf); + return rc; + } + + rc = CIFSSMBOpen(xid, tcon, fromName, FILE_CREATE, GENERIC_WRITE, + CREATE_NOT_DIR, &netfid, &oplock, NULL, + nls_codepage, remap); + if (rc != 0) { + kfree(buf); + return rc; + } + + rc = CIFSSMBWrite(xid, tcon, netfid, + CIFS_MF_SYMLINK_FILE_SIZE /* length */, + 0 /* offset */, + &bytes_written, buf, NULL, 0); + CIFSSMBClose(xid, tcon, netfid); + kfree(buf); + if (rc != 0) + return rc; + + if (bytes_written != CIFS_MF_SYMLINK_FILE_SIZE) + return -EIO; + + return 0; +} + +static int CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, const unsigned char *searchName, char **symlinkinfo, const struct nls_table *nls_codepage, int remap) |