From patchwork Tue Aug 3 15:06:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Metzmacher X-Patchwork-Id: 116793 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o73FHjOH015870 for ; Tue, 3 Aug 2010 15:18:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932161Ab0HCPRb (ORCPT ); Tue, 3 Aug 2010 11:17:31 -0400 Received: from mo-p05-ob.rzone.de ([81.169.146.181]:26893 "EHLO mo-p05-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932133Ab0HCPR3 (ORCPT ); Tue, 3 Aug 2010 11:17:29 -0400 X-RZG-AUTH: :IXQkeEW8Yfo/5haL0ckzWIsAYh739YBunhBBa3aCCCbZv/tD854XGrpZ X-RZG-CLASS-ID: mo05 Received: from localhost.localdomain (xdsl-87-79-184-42.netcologne.de [87.79.184.42]) by post.strato.de (jimi mo39) (RZmta 23.4) with (DHE-RSA-AES256-SHA encrypted) ESMTP id q0292dm73DmAJp ; Tue, 3 Aug 2010 17:06:25 +0200 (MEST) From: Stefan Metzmacher To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Stefan Metzmacher Subject: [PATCH 8/8] cifs: implement CIFSCreateMFSymLink() Date: Tue, 3 Aug 2010 17:06:00 +0200 Message-Id: <1280847960-16371-9-git-send-email-metze@samba.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280847960-16371-1-git-send-email-metze@samba.org> References: <1280847960-16371-1-git-send-email-metze@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 03 Aug 2010 15:18:21 +0000 (UTC) diff --git a/fs/cifs/link.c b/fs/cifs/link.c index b281d26..93d2dfd 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -135,10 +135,39 @@ CIFSFormatMFSymlink(u8 *buf, unsigned int buf_len, const char *link_str) static int CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, const char *fromName, const char *toName, - const struct nls_table *nls_codepage) + const struct nls_table *nls_codepage, int remap) { - int rc = -EOPNOTSUPP; - return rc; + int rc; + int oplock = 0; + __u16 netfid = 0; + u8 buf[CIFS_MF_SYMLINK_FILE_SIZE]; + unsigned int bytes_written = 0; + + rc = CIFSFormatMFSymlink(buf, sizeof(buf), toName); + if (rc != 0) { + return rc; + } + + rc = CIFSSMBOpen(xid, tcon, fromName, FILE_CREATE, GENERIC_WRITE, + CREATE_NOT_DIR, &netfid, &oplock, NULL, + nls_codepage, remap); + if (rc != 0) { + return rc; + } + + rc = CIFSSMBWrite(xid, tcon, netfid, + sizeof(buf) /* length */, + 0 /* offset */, + &bytes_written, buf, NULL, 0); + CIFSSMBClose(xid, tcon, netfid); + if (rc != 0) { + return rc; + } + + if (bytes_written != sizeof(buf)) + return -EIO; + + return 0; } static int @@ -416,7 +445,9 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) /* BB what if DFS and this volume is on different share? BB */ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) rc = CIFSCreateMFSymLink(xid, pTcon, full_path, symname, - cifs_sb->local_nls); + cifs_sb->local_nls, + cifs_sb->mnt_cifs_flags & + CIFS_MOUNT_MAP_SPECIAL_CHR); else if (pTcon->unix_ext) rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname, cifs_sb->local_nls);