Windows: cm_SymLink export created cm_scache_t
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 2 Sep 2011 17:54:01 +0000 (13:54 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Mon, 5 Sep 2011 13:46:24 +0000 (06:46 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/cm_vnodeops.c
src/WINNT/afsd/cm_vnodeops.h

index 2073c25..c6d29fc 100644 (file)
@@ -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))
index 2abcf6b..63f7b67 100644 (file)
@@ -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);
+            }
         }
     }
 
index 70afb6e..fcabb74 100644 (file)
@@ -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,