MCPcopy
hub / github.com/cubefs/cubefs / SymLink

Method SymLink

client/gosdk/cfs_client.go:1250–1272  ·  view source on GitHub ↗
(srcPath, dstPath string)

Source from the content-addressed store, hash-verified

1248}
1249
1250func (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
1274func (c *Client) Link(srcPath, dstPath string) error {
1275 fullSrcPath := c.absPath(srcPath)

Callers

nothing calls this directly

Calls 8

absPathMethod · 0.95
lookupPathMethod · 0.95
ModeFunction · 0.92
LogErrorfFunction · 0.92
LogDebugfFunction · 0.92
DirMethod · 0.80
Create_llMethod · 0.80
PutMethod · 0.65

Tested by

no test coverage detected