From 9b0cb614387403ff433cf39f84c13b626b1b9bdc Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 2 Sep 2011 13:54:01 -0400 Subject: [PATCH] Windows: cm_SymLink export created cm_scache_t Permit the caller to request the cm_scache_t that represents the created symlink or mount point object. Change-Id: Ida8fdc4214844dad009362877f125aa5d20120a1 Reviewed-on: http://gerrit.openafs.org/5355 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_ioctl.c | 4 ++-- src/WINNT/afsd/cm_vnodeops.c | 12 ++++++++++-- src/WINNT/afsd/cm_vnodeops.h | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 2073c25d38..c6d29fc4a9 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -2058,7 +2058,7 @@ cm_IoctlCreateMountPoint(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scac tattr.unixModeBits = 0644; tattr.clientModTime = time(NULL); - code = cm_SymLink(dscp, leaf, mpInfo, 0, &tattr, userp, reqp); + code = cm_SymLink(dscp, leaf, mpInfo, 0, &tattr, userp, reqp, NULL); } if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH)) @@ -2129,7 +2129,7 @@ cm_IoctlSymlink(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scache_t *dsc tattr.mask = CM_ATTRMASK_UNIXMODEBITS; tattr.unixModeBits = 0755; - code = cm_SymLink(dscp, leaf, cp, 0, &tattr, userp, reqp); + code = cm_SymLink(dscp, leaf, cp, 0, &tattr, userp, reqp, NULL); } if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH)) diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index 2abcf6bbc4..63f7b675c9 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -3195,7 +3195,7 @@ long cm_Link(cm_scache_t *dscp, clientchar_t *cnamep, cm_scache_t *sscp, long fl } long cm_SymLink(cm_scache_t *dscp, clientchar_t *cnamep, fschar_t *contentsp, long flags, - cm_attr_t *attrp, cm_user_t *userp, cm_req_t *reqp) + cm_attr_t *attrp, cm_user_t *userp, cm_req_t *reqp, cm_scache_t **scpp) { cm_conn_t *connp; long code; @@ -3211,6 +3211,9 @@ long cm_SymLink(cm_scache_t *dscp, clientchar_t *cnamep, fschar_t *contentsp, lo cm_dirOp_t dirop; fschar_t *fnamep = NULL; + if (scpp) + *scpp = NULL; + /* Check for RO volume */ if (dscp->flags & CM_SCACHEFLAG_RO) return CM_ERROR_READONLY; @@ -3299,7 +3302,12 @@ long cm_SymLink(cm_scache_t *dscp, clientchar_t *cnamep, fschar_t *contentsp, lo userp, reqp, 0); } lock_ReleaseWrite(&scp->rw); - cm_ReleaseSCache(scp); + + if (scpp) { + *scpp = scp; + } else { + cm_ReleaseSCache(scp); + } } } diff --git a/src/WINNT/afsd/cm_vnodeops.h b/src/WINNT/afsd/cm_vnodeops.h index 70afb6ec4f..fcabb74384 100644 --- a/src/WINNT/afsd/cm_vnodeops.h +++ b/src/WINNT/afsd/cm_vnodeops.h @@ -142,7 +142,8 @@ extern long cm_Link(cm_scache_t *dscp, clientchar_t *namep, cm_scache_t *sscp, long flags, cm_user_t *userp, cm_req_t *reqp); extern long cm_SymLink(cm_scache_t *dscp, clientchar_t *namep, fschar_t *contentsp, - long flags, cm_attr_t *attrp, cm_user_t *userp, cm_req_t *reqp); + long flags, cm_attr_t *attrp, cm_user_t *userp, cm_req_t *reqp, + cm_scache_t **scpp); extern long cm_AssembleLink(cm_scache_t *linkScp, fschar_t *pathSuffixp, cm_scache_t **newRootScpp, cm_space_t **newSpaceBufferp,