#endif
{
afs_int32 code;
+ afs_int32 code_checkcode = 0;
struct brequest *tb;
struct vrequest treq;
#ifdef AFS_SGI65_ENV
tb->flags |= BUWAIT;
afs_osi_Sleep(tb);
}
- code = tb->code;
+ code = tb->code_raw;
+ code_checkcode = tb->code_checkcode;
afs_BRelease(tb);
}
#endif
/* printf("avc->vc_error=%d\n", avc->vc_error); */
code = avc->vc_error;
+ code_checkcode = 0;
avc->vc_error = 0;
}
ReleaseWriteLock(&avc->lock);
}
AFS_DISCON_UNLOCK();
afs_PutFakeStat(&fakestat);
- code = afs_CheckCode(code, &treq, 5);
+
+ if (code_checkcode) {
+ code = code_checkcode;
+ } else {
+ code = afs_CheckCode(code, &treq, 5);
+ }
return code;
}
afs_ucred_t *cred; /* credentials to use for operation */
afs_size_t size_parm[BPARMS]; /* random parameters */
void *ptr_parm[BPARMS]; /* pointer parameters */
- afs_int32 code; /* return code */
+ afs_int32 code_raw; /* return code from AFS routines */
+ afs_int32 code_checkcode; /* the afs_CheckCode-translated code */
short refCount; /* use counter for this structure */
char opcode; /* what to do (store, fetch, etc) */
char flags; /* free, etc */
#endif
/* now set final return code, and wakeup anyone waiting */
if ((ab->flags & BUVALID) == 0) {
- ab->code = afs_CheckCode(code, &treq, 43); /* set final code, since treq doesn't go across processes */
+
+ /* To explain code_raw/code_checkcode:
+ * Anyone that's waiting won't have our treq, so they won't be able to
+ * call afs_CheckCode themselves on the return code we provide here.
+ * But if we give back only the afs_CheckCode value, they won't know
+ * what the "raw" value was. So give back both values, so the waiter
+ * can know the "raw" value for interpreting the value internally, as
+ * well as the afs_CheckCode value to give to the OS. */
+ ab->code_raw = code;
+ ab->code_checkcode = afs_CheckCode(code, &treq, 43);
+
ab->flags |= BUVALID;
if (ab->flags & BUWAIT) {
ab->flags &= ~BUWAIT;
/* now set final return code, and wakeup anyone waiting */
if ((ab->flags & BUVALID) == 0) {
/* set final code, since treq doesn't go across processes */
- ab->code = afs_CheckCode(code, &treq, 43);
+ ab->code_raw = code;
+ ab->code_checkcode = afs_CheckCode(code, &treq, 43);
ab->flags |= BUVALID;
if (ab->flags & BUWAIT) {
ab->flags &= ~BUWAIT;
tb->ptr_parm[1] = apparm1;
tb->ptr_parm[2] = apparm2;
tb->flags = 0;
- tb->code = 0;
+ tb->code_raw = tb->code_checkcode = 0;
tb->ts = afs_brs_count++;
/* if daemons are waiting for work, wake them up */
if (afs_brsDaemons > 0) {