| 1248 | } |
| 1249 | |
| 1250 | func (c *Client) SymLink(srcPath, dstPath string) error { |
| 1251 | fullSrcPath := c.absPath(srcPath) |
| 1252 | fullDstPath := c.absPath(dstPath) |
| 1253 | parentDir := gopath.Dir(fullDstPath) |
| 1254 | filename := gopath.Base(fullDstPath) |
| 1255 | |
| 1256 | info, err := c.lookupPath(parentDir) |
| 1257 | if err != nil { |
| 1258 | return err |
| 1259 | } |
| 1260 | |
| 1261 | parentIno := info.Inode |
| 1262 | info, err = c.mw.Create_ll(parentIno, filename, proto.Mode(os.ModeSymlink|os.ModePerm), 0, 0, []byte(fullSrcPath), fullDstPath, false) |
| 1263 | if err != nil { |
| 1264 | log.LogErrorf("Symlink: parent(%v) NewName(%v) err(%v)\n", parentIno, filename, err) |
| 1265 | return err |
| 1266 | } |
| 1267 | |
| 1268 | c.ic.Put(info) |
| 1269 | log.LogDebugf("Symlink: src_path(%s) dst_path(%s)\n", fullSrcPath, fullDstPath) |
| 1270 | |
| 1271 | return nil |
| 1272 | } |
| 1273 | |
| 1274 | func (c *Client) Link(srcPath, dstPath string) error { |
| 1275 | fullSrcPath := c.absPath(srcPath) |