From 756488a8395b5c45ceb383ca0106164e24bcb66c Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Sat, 6 Nov 2004 07:02:44 +0000 Subject: [PATCH] vos-timestamp-handling-20041106 FIXES 15708 fix timestamp handling on create; display "never" for copy time --- src/volser/volprocs.c | 4 ++++ src/volser/volser_prototypes.h | 1 + src/volser/vos.c | 37 +++++++++++++++++----------------- src/volser/vsprocs.c | 23 ++++++++++++++++----- 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 6f049b893..95796aafb 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -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)) diff --git a/src/volser/volser_prototypes.h b/src/volser/volser_prototypes.h index 6d2de8843..07c49c8a9 100644 --- a/src/volser/volser_prototypes.h +++ b/src/volser/volser_prototypes.h @@ -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); diff --git a/src/volser/vos.c b/src/volser/vos.c index 097ec1cd1..287745315 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -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 */ diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 5f499455c..1bd3a948c 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -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); -- 2.39.5