c = ENTRYSIZE - o;
if (c > l)
c = l;
+#define xPT(p,x) ((((struct prentry *)(p))->flags & htonl(PRTYPE)) == htonl(x))
#if DEBUG_SG_MAP
if (o)
fprintf(stderr, "Writing %d bytes of entry @ %#lx(+%d)\n", c,
p - o, o);
else if (c == ENTRYSIZE)
fprintf(stderr,
- "Writing %d bytes of entry @ %#lx (%d<%s>,%d)\n", c,
- p, ((struct prentry *)cp)->flags,
- (((struct prentry *)cp)->flags & PRTYPE) ==
- PRUSER ? "user" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRFREE ? "free" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRGRP ? "group" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRCONT ? "cont" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRCELL ? "cell" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRFOREIGN ? "foreign" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRINST ? "sub/super instance" : "?",
- ((struct prentry *)cp)->id);
+ "Writing %d bytes of entry @ %#lx (%d<%s>,%d)\n",
+ c, p, ntohl(((struct prentry *)cp)->flags),
+ xPT(cp,PRUSER) ? "user" : xPT(cp,PRFREE) ? "free" :
+ xPT(cp,PRGRP) ? "group" : xPT(cp,PRCONT) ? "cont" :
+ xPT(cp,PRCELL) ? "cell" : xPT(cp,PRFOREIGN) ? "foreign" :
+ xPT(cp,PRINST) ? "sub/super instance" : "?",
+ ntohl(((struct prentry *)cp)->id));
else if (c >= 8)
fprintf(stderr,
"Writing first %d bytes of entry @ %#lx (%d<%s>,%d)\n",
- c, p, ((struct prentry *)cp)->flags,
- (((struct prentry *)cp)->flags & PRTYPE) ==
- PRUSER ? "user" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRFREE ? "free" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRGRP ? "group" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRCONT ? "cont" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRCELL ? "cell" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRFOREIGN ? "foreign" : (((struct prentry *)cp)->
- flags & PRTYPE) ==
- PRINST ? "sub/super instance" : "?",
- ((struct prentry *)cp)->id);
+ c, p, ntohl(((struct prentry *)cp)->flags),
+ xPT(cp,PRUSER) ? "user" : xPT(cp,PRFREE) ? "free" :
+ xPT(cp,PRGRP) ? "group" : xPT(cp,PRCONT) ? "cont" :
+ xPT(cp,PRCELL) ? "cell" : xPT(cp,PRFOREIGN) ? "foreign" :
+ xPT(cp,PRINST) ? "sub/super instance" : "?",
+ ntohl(((struct prentry *)cp)->id));
else
fprintf(stderr, "Writing %d bytes of entry @ %#lx\n", c, p);
#endif
- if (!o && c >= 8
- && (((struct prentry *)cp)->flags & PRTYPE) == PRGRP) {
+ if (!o && c >= 8 && xPT(cp,PRGRP)) {
#if DEBUG_SG_MAP
- if (in_map(sg_found, -((struct prentry *)cp)->id))
+ if (in_map(sg_found, -ntohl(((struct prentry *)cp)->id)))
fprintf(stderr, "Unfound: Removing group %d\n",
- ((struct prentry *)cp)->id);
- if (in_map(sg_flagged, -((struct prentry *)cp)->id))
+ ntohl(((struct prentry *)cp)->id));
+ if (in_map(sg_flagged, -ntohl(((struct prentry *)cp)->id)))
fprintf(stderr, "Unflag: Removing group %d\n",
- ((struct prentry *)cp)->id);
+ ntohl(((struct prentry *)cp)->id));
#endif
sg_found =
bic_map(sg_found,
- add_map(NIL_MAP, -((struct prentry *)cp)->id));
+ add_map(NIL_MAP, -ntohl(((struct prentry *)cp)->id)));
sg_flagged =
bic_map(sg_flagged,
- add_map(NIL_MAP, -((struct prentry *)cp)->id));
+ add_map(NIL_MAP, -ntohl(((struct prentry *)cp)->id)));
}
cp += c;
p += c;
l -= c;
+#undef xPT
}
}
return (*pt_save_dbase_write) (tdb, fno, bp, pos, count);
}
nptr = tentry.next;
- while (nptr != NULL) {
+ while (nptr) {
code = pr_ReadCoEntry(at, 0, nptr, ¢ry);
if (code != 0)
return code;
if (code != 0)
return code;
#ifdef PR_REMEMBER_TIMES
- tentry.removeTime = time((afs_int32 *) 0);
+ tentry.removeTime = time(NULL);
#endif
tentryg = (struct prentryg *)&tentry;
for (i = 0; i < SGSIZE; i++) {
}
hloc = 0;
nptr = tentryg->nextsg;
- while (nptr != NULL) {
+ while (nptr) {
code = pr_ReadCoEntry(at, 0, nptr, ¢ry);
if (code != 0)
return code;
if (entry->id == aid)
return PRINCONSISTENT;
#ifdef PR_REMEMBER_TIMES
- entry->addTime = time((afs_int32 *) 0);
+ entry->addTime = time(NULL);
#endif
entryg = (struct prentryg *)entry;
for (i = 0; i < SGSIZE; i++) {
}
last = 0;
nptr = entryg->nextsg;
- while (nptr != NULL) {
+ while (nptr) {
code = pr_ReadCoEntry(tt, 0, nptr, &nentry);
if (code != 0)
return code;
memset(&aentry, 0, sizeof(aentry));
aentry.flags |= PRCONT;
aentry.id = entry->id;
- aentry.next = NULL;
+ aentry.next = 0;
aentry.entries[0] = aid;
code = pr_WriteCoEntry(tt, 0, nptr, &aentry);
if (code != 0)
}
nptr = tentryg->nextsg;
- while (nptr != NULL) {
+ while (nptr) {
didsomething = 1;
/* look through cont entries */
code = pr_ReadCoEntry(at, 0, nptr, ¢ry);
}
nptr = tentryg->nextsg;
- while (nptr != NULL) {
+ while (nptr) {
/* look through cont entries */
code = pr_ReadCoEntry(at, 0, nptr, ¢ry);
if (code != 0)
break;
}
pos = tentry.next;
- while (pos != NULL) {
+ while (pos) {
#define centry (*(struct contentry*)&tent)
code = pr_ReadCoEntry(at, 0, pos, ¢ry);
if ((centry.id != aid)