From 25a5c423a0d12086ab3cc390306bcd0f0324a731 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 22 Apr 2012 10:58:17 +0100 Subject: [PATCH] ptserver: Remove PR_REMEMBER_TIMES The #define PR_REMEMBER_TIMES is always true, so remove the #define, and all of the #ifdefs that it triggers Change-Id: I445a2cd8f5e5b2570e6ef1311cc6bb3d66592fdc Reviewed-on: http://gerrit.openafs.org/7264 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/ptserver/display.c | 5 ----- src/ptserver/ptserver.h | 10 ---------- src/ptserver/ptutils.c | 12 ------------ src/ptserver/utils.c | 4 ---- 4 files changed, 31 deletions(-) diff --git a/src/ptserver/display.c b/src/ptserver/display.c index eca2f9b573..2f57def343 100644 --- a/src/ptserver/display.c +++ b/src/ptserver/display.c @@ -16,8 +16,6 @@ #include "ptserver.h" #include "display.h" -#ifdef PR_REMEMBER_TIMES - static char * pr_TimeToString(time_t clock) { @@ -39,7 +37,6 @@ pr_TimeToString(time_t clock) strftime(buffer, 32, "%m/%d %H:%M:%S", tm); return buffer; } -#endif #define host(a) (hostOrder ? (a) : ntohl(a)) @@ -89,13 +86,11 @@ pr_PrintEntry(FILE *f, int hostOrder, afs_int32 ea, struct prentry *e, int inden fprintf(f, "%*s", indent, ""); fprintf(f, "Entry at %d: flags 0x%x, id %di, next %d.\n", ea, host(e->flags), host(e->id), host(e->next)); -#ifdef PR_REMEMBER_TIMES fprintf(f, "%*s", indent, ""); fprintf(f, "c:%s ", pr_TimeToString(host(e->createTime))); fprintf(f, "a:%s ", pr_TimeToString(host(e->addTime))); fprintf(f, "r:%s ", pr_TimeToString(host(e->removeTime))); fprintf(f, "n:%s\n", pr_TimeToString(host(e->changeTime))); -#endif if (host(e->flags) & PRCONT) PrintEntries(f, hostOrder, indent, e, COSIZE); else { /* regular entry */ diff --git a/src/ptserver/ptserver.h b/src/ptserver/ptserver.h index 653ae0f9d9..09251b8442 100644 --- a/src/ptserver/ptserver.h +++ b/src/ptserver/ptserver.h @@ -89,19 +89,13 @@ extern struct prheader cheader; #define PRP_GROUP_DEFAULT (PRP_STATUS_ANY | PRP_MEMBER_ANY) #define PRP_USER_DEFAULT (PRP_STATUS_ANY) -#define PR_REMEMBER_TIMES 1 - struct prentry { afs_int32 flags; /* random flags */ afs_int32 id; /* user or group id */ afs_int32 cellid; /* A foreign users's repsenting group */ afs_int32 next; /* next block same entry (or freelist) */ -#ifdef PR_REMEMBER_TIMES afs_uint32 createTime, addTime, removeTime, changeTime; afs_int32 reserved[1]; -#else - afs_int32 reserved[5]; -#endif afs_int32 entries[PRSIZE]; /* groups a user is a member of (or list of members */ afs_int32 nextID; /* id hash table next pointer */ afs_int32 nextName; /* name has table next ptr */ @@ -128,12 +122,8 @@ struct prentryg { afs_int32 id; /* user or group id */ afs_int32 cellid; /* reserved for cellID */ afs_int32 next; /* next block same entry (or freelist) */ -#ifdef PR_REMEMBER_TIMES afs_uint32 createTime, addTime, removeTime, changeTime; afs_int32 reserved[1]; -#else - afs_int32 reserved[5]; -#endif afs_int32 entries[PRSIZE]; /* groups a user is a member of (or list of members */ afs_int32 nextID; /* id hash table next pointer */ afs_int32 nextName; /* name has table next ptr */ diff --git a/src/ptserver/ptutils.c b/src/ptserver/ptutils.c index 15af3f4df4..a5971215f7 100644 --- a/src/ptserver/ptutils.c +++ b/src/ptserver/ptutils.c @@ -353,9 +353,7 @@ CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid, af newEntry = AllocBlock(at); if (!newEntry) return PRDBFAIL; -#ifdef PR_REMEMBER_TIMES tentry.createTime = time(0); -#endif if (flag & PRGRP) { tentry.flags = PRGRP; @@ -608,9 +606,7 @@ RemoveFromEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 bid) code = pr_ReadEntry(at, 0, temp, &tentry); if (code != 0) return code; -#ifdef PR_REMEMBER_TIMES tentry.removeTime = time(0); -#endif for (i = 0; i < PRSIZE; i++) { if (tentry.entries[i] == aid) { tentry.entries[i] = PRBADID; @@ -766,9 +762,7 @@ RemoveFromSGEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 bid) code = pr_ReadEntry(at, 0, temp, &tentry); if (code != 0) return code; -#ifdef PR_REMEMBER_TIMES tentry.removeTime = time(NULL); -#endif tentryg = (struct prentryg *)&tentry; for (i = 0; i < SGSIZE; i++) { if (tentryg->supergroup[i] == aid) { @@ -1007,9 +1001,7 @@ AddToEntry(struct ubik_trans *tt, struct prentry *entry, afs_int32 loc, afs_int3 if (entry->id == aid) return PRINCONSISTENT; -#ifdef PR_REMEMBER_TIMES entry->addTime = time(0); -#endif for (i = 0; i < PRSIZE; i++) { if (entry->entries[i] == aid) return PRIDEXIST; @@ -1121,9 +1113,7 @@ AddToSGEntry(struct ubik_trans *tt, struct prentry *entry, afs_int32 loc, afs_in if (entry->id == aid) return PRINCONSISTENT; -#ifdef PR_REMEMBER_TIMES entry->addTime = time(NULL); -#endif entryg = (struct prentryg *)entry; for (i = 0; i < SGSIZE; i++) { if (entryg->supergroup[i] == aid) @@ -1898,9 +1888,7 @@ ChangeEntry(struct ubik_trans *at, afs_int32 aid, afs_int32 cid, char *name, afs if (tentry.owner != cid && !IsAMemberOf(at, cid, SYSADMINID) && !IsAMemberOf(at, cid, tentry.owner) && !pr_noAuth) return PRPERM; -#ifdef PR_REMEMBER_TIMES tentry.changeTime = time(0); -#endif /* we're actually trying to change the id */ if (newid && (newid != aid)) { diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index a73c178932..34dde85a50 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -100,12 +100,10 @@ pr_WriteEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentr nentry.sibling = htonl(tentry->sibling); nentry.child = htonl(tentry->child); strncpy(nentry.name, tentry->name, PR_MAXNAMELEN); -#ifdef PR_REMEMBER_TIMES nentry.createTime = htonl(tentry->createTime); nentry.addTime = htonl(tentry->addTime); nentry.removeTime = htonl(tentry->removeTime); nentry.changeTime = htonl(tentry->changeTime); -#endif for (i = 0; i < PRSIZE; i++) nentry.entries[i] = htonl(tentry->entries[i]); tentry = &nentry; @@ -149,12 +147,10 @@ pr_ReadEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentry tentry->sibling = ntohl(nentry.sibling); tentry->child = ntohl(nentry.child); strncpy(tentry->name, nentry.name, PR_MAXNAMELEN); -#ifdef PR_REMEMBER_TIMES tentry->createTime = ntohl(nentry.createTime); tentry->addTime = ntohl(nentry.addTime); tentry->removeTime = ntohl(nentry.removeTime); tentry->changeTime = ntohl(nentry.changeTime); -#endif for (i = 0; i < PRSIZE; i++) tentry->entries[i] = ntohl(nentry.entries[i]); return (code);