aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-08-05 15:15:22 -0400
committerSteve French <sfrench@us.ibm.com>2010-09-29 15:04:31 -0400
commit8713d01db8bf948eb9632726f529ec4f821bb025 (patch)
tree005e84ec721d09e3b661faacbf2ca458e02e9998 /fs/cifs
parent18bddd1059c5d1e17ad6e49c514c95484aa80a33 (diff)
cifs: implement CIFSCreateMFSymLink()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/link.c45
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)
133 return 0; 133 return 0;
134} 134}
135 135
136static int
137CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon,
138 const char *fromName, const char *toName,
139 const struct nls_table *nls_codepage, int remap)
140{
141 int rc;
142 int oplock = 0;
143 __u16 netfid = 0;
144 u8 *buf;
145 unsigned int bytes_written = 0;
146
147 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
148 if (!buf)
149 return -ENOMEM;
150
151 rc = CIFSFormatMFSymlink(buf, CIFS_MF_SYMLINK_FILE_SIZE, toName);
152 if (rc != 0) {
153 kfree(buf);
154 return rc;
155 }
156
157 rc = CIFSSMBOpen(xid, tcon, fromName, FILE_CREATE, GENERIC_WRITE,
158 CREATE_NOT_DIR, &netfid, &oplock, NULL,
159 nls_codepage, remap);
160 if (rc != 0) {
161 kfree(buf);
162 return rc;
163 }
164
165 rc = CIFSSMBWrite(xid, tcon, netfid,
166 CIFS_MF_SYMLINK_FILE_SIZE /* length */,
167 0 /* offset */,
168 &bytes_written, buf, NULL, 0);
169 CIFSSMBClose(xid, tcon, netfid);
170 kfree(buf);
171 if (rc != 0)
172 return rc;
173
174 if (bytes_written != CIFS_MF_SYMLINK_FILE_SIZE)
175 return -EIO;
176
177 return 0;
178}
179
180static int
136CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, 181CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
137 const unsigned char *searchName, char **symlinkinfo, 182 const unsigned char *searchName, char **symlinkinfo,
138 const struct nls_table *nls_codepage, int remap) 183 const struct nls_table *nls_codepage, int remap)