]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-vos-timestamp-handling-20041106
authorKris Van Hees <kvanhees@sinenomine.net>
Tue, 9 Nov 2004 17:13:45 +0000 (17:13 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 9 Nov 2004 17:13:45 +0000 (17:13 +0000)
FIXES 15708

fix timestamp handling on create; display "never" for copy time

(cherry picked from commit 756488a8395b5c45ceb383ca0106164e24bcb66c)

src/volser/volprocs.c
src/volser/volser_prototypes.h
src/volser/vos.c
src/volser/vsprocs.c

index 6f049b8937b97aec6813e35ce57919b33d3dddfc..95796aafb2436453601d41d48190c67d445ad5ab 100644 (file)
@@ -1540,6 +1540,10 @@ VolSetInfo(struct rx_call *acid, afs_int32 atrans,
        td->maxquota = astatus->maxquota;
     if (astatus->dayUse != -1)
        td->dayUse = astatus->dayUse;
+    if (astatus->creationDate != -1)
+       td->creationDate = astatus->creationDate;
+    if (astatus->updateDate != -1)
+       td->updateDate = astatus->updateDate;
     VUpdateVolume(&error, tv);
     tt->rxCallPtr = (struct rx_call *)0;
     if (TRELE(tt))
index 6d2de884398a01a16337ee4064de6a5c63dc2815..07c49c8a99d118d54f87e260026e3a22af8318ab 100644 (file)
@@ -17,6 +17,7 @@ struct nvldbentry;
 extern void MapPartIdIntoName(afs_int32 partId, char *partName);
 extern int yesprompt(char *str);
 extern int PrintError(char *msg, afs_int32 errcode);
+extern void init_volintInfo(struct volintInfo *vinfo);
 extern int UV_SetSecurity(register struct rx_securityClass *as,
                          afs_int32 aindex);
 extern struct rx_connection *UV_Bind(afs_int32 aserver, afs_int32 port);
index 097ec1cd1312e39406c568f8a555c95c772159ad..287745315ffcb89334fd46a19ab22235502adadd 100644 (file)
@@ -499,11 +499,15 @@ DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast,
                fprintf(STDOUT, "    Last Access %s",
                        ctime((time_t *) & pntr->accessDate));
 #endif
-           fprintf(STDOUT, "    Last Update %s",
-                   ctime((time_t *) & pntr->updateDate));
-           fprintf(STDOUT,
-                   "    %d accesses in the past day (i.e., vnode references)\n",
-                   pntr->dayUse);
+           if (!pntr->updateDate)
+               fprintf(STDOUT, "    Last Update Never\n");
+           else {
+               fprintf(STDOUT, "    Last Update %s",
+                       ctime((time_t *) & pntr->updateDate));
+               fprintf(STDOUT,
+                       "    %d accesses in the past day (i.e., vnode references)\n",
+                       pntr->dayUse);
+           }
        } else if (pntr->status == VBUSY) {
            *totalBusy += 1;
            qPut(&busyHead, pntr->volid);
@@ -652,11 +656,15 @@ XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP,
                fprintf(STDOUT, "    Last Access %s",
                        ctime((time_t *) & a_xInfoP->accessDate));
 #endif
-           fprintf(STDOUT, "    Last Update %s",
-                   ctime((time_t *) & a_xInfoP->updateDate));
-           fprintf(STDOUT,
-                   "    %d accesses in the past day (i.e., vnode references)\n",
-                   a_xInfoP->dayUse);
+           if (!a_xInfoP->updateDate)
+               fprintf(STDOUT, "    Last Update Never\n");
+           else {
+               fprintf(STDOUT, "    Last Update %s",
+                       ctime((time_t *) & a_xInfoP->updateDate));
+               fprintf(STDOUT,
+                       "    %d accesses in the past day (i.e., vnode references)\n",
+                       a_xInfoP->dayUse);
+           }
 
            /*
             * Print all the read/write and authorship stats.
@@ -1388,16 +1396,9 @@ SetFields(as)
        return (ENOENT);
     }
 
-    memset(&info, 0, sizeof(info));
+    init_volintInfo(&info);
     info.volid = volid;
     info.type = RWVOL;
-    info.dayUse = -1;
-    info.maxquota = -1;
-    info.flags = -1;
-    info.spare0 = -1;
-    info.spare1 = -1;
-    info.spare2 = -1;
-    info.spare3 = -1;
 
     if (as->parms[1].items) {
        /* -max <quota> */
index 5f499455c5ce53311baf4f683d47152b9cc9a0f6..1bd3a948c937ec1f1dff27fb2eb21a463ebeeeee 100644 (file)
@@ -406,6 +406,19 @@ PrintError(char *msg, afs_int32 errcode)
     return 0;
 }
 
+void init_volintInfo(struct volintInfo *vinfo) {
+    memset(vinfo, 0, sizeof(struct volintInfo));
+
+    vinfo->maxquota = -1;
+    vinfo->dayUse = -1;
+    vinfo->creationDate = -1;
+    vinfo->updateDate = -1;
+    vinfo->flags = -1;
+    vinfo->spare0 = -1;
+    vinfo->spare1 = -1;
+    vinfo->spare2 = -1;
+    vinfo->spare3 = -1;
+}
 
 static struct rx_securityClass *uvclass = 0;
 static int uvindex = -1;
@@ -624,8 +637,8 @@ UV_CreateVolume2(afs_int32 aserver, afs_int32 apart, char *aname,
     tid = 0;
     aconn = (struct rx_connection *)0;
     error = 0;
-    memset(&tstatus, 0, sizeof(struct volintInfo));
-    tstatus.dayUse = -1;
+
+    init_volintInfo(&tstatus);
     tstatus.maxquota = aquota;
 
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
@@ -1338,6 +1351,8 @@ UV_MoveVolume2(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart,
 
     infop = (volintInfo *) volumeInfo.volEntries_val;
     infop->maxquota = -1;      /* Else it will replace the default quota */
+    infop->creationDate = -1;  /* Else it will use the source creation date */
+    infop->updateDate = -1;    /* Else it will use the source update date */
 #endif
 
     /* create a volume on the target machine */
@@ -4237,9 +4252,7 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
        goto refail;
     }
 
-    memset(&vinfo, 0, sizeof(struct volintInfo));
-    vinfo.dayUse = -1;
-    vinfo.maxquota = -1;
+    init_volintInfo(&vinfo);
     vinfo.creationDate = newCreateDate;
     vinfo.updateDate = newUpdateDate;
     code = AFSVolSetInfo(toconn, totid, &vinfo);