/// <summary>Add the given symbolic link to the fs.</summary> /// <remarks>Add the given symbolic link to the fs. Record it in the edits log.</remarks> /// <exception cref="System.IO.IOException"/> private static INodeSymlink AddSymlink(FSDirectory fsd, string path, INodesInPath iip, string target, PermissionStatus dirPerms, bool createParent, bool logRetryCache ) { long mtime = Time.Now(); byte[] localName = iip.GetLastLocalName(); if (createParent) { KeyValuePair <INodesInPath, string> e = FSDirMkdirOp.CreateAncestorDirectories(fsd , iip, dirPerms); if (e == null) { return(null); } iip = INodesInPath.Append(e.Key, null, localName); } string userName = dirPerms.GetUserName(); long id = fsd.AllocateNewInodeId(); PermissionStatus perm = new PermissionStatus(userName, null, FsPermission.GetDefault ()); INodeSymlink newNode = UnprotectedAddSymlink(fsd, iip.GetExistingINodes(), localName , id, target, mtime, mtime, perm); if (newNode == null) { NameNode.stateChangeLog.Info("addSymlink: failed to add " + path); return(null); } fsd.GetEditLog().LogSymlink(path, target, mtime, mtime, newNode, logRetryCache); if (NameNode.stateChangeLog.IsDebugEnabled()) { NameNode.stateChangeLog.Debug("addSymlink: " + path + " is added"); } return(newNode); }