Translate faultcode_t return values from vm routines into errno codes.

This commit is contained in:
Nickolai Zeldovich 2002-07-22 19:32:34 +00:00
parent 73cdd10a1b
commit 9cd177c636

View File

@ -81,6 +81,25 @@ AFS_TRYUP(lock)
#endif
/* Translate a faultcode_t as returned by some of the vm routines
* into a suitable errno value.
*/
static int
afs_fc2errno(faultcode_t fc)
{
switch (FC_CODE(fc)) {
case 0:
return 0;
case FC_OBJERR:
return FC_ERRNO(fc);
default:
return EIO;
}
}
extern struct as kas; /* kernel addr space */
extern unsigned char *afs_indexFlags;
extern afs_lock_t afs_xdcache;
@ -1151,7 +1170,8 @@ struct AFS_UCRED *acred;
data = segmap_getmap(segkmap, AFSTOV(avc), pageBase);
#endif
#ifndef AFS_SUN5_ENV
code = as_fault(&kas, data+pageOffset, tsize, F_SOFTLOCK, mode);
code = afs_fc2errno(as_fault(&kas, data+pageOffset, tsize,
F_SOFTLOCK, mode));
if (code == 0) {
AFS_UIOMOVE(data+pageOffset, tsize, arw, auio, code);
as_fault(&kas, data+pageOffset, tsize, F_SOFTUNLOCK, mode);
@ -1213,7 +1233,8 @@ struct AFS_UCRED *acred;
AFS_GUNLOCK();
}
if (!created)
code = segmap_fault(kas.a_hat, segkmap, raddr, rsize, F_SOFTLOCK, mode);
code = afs_fc2errno(segmap_fault(kas.a_hat, segkmap, raddr,
rsize, F_SOFTLOCK, mode));
}
if (code == 0) {
AFS_UIOMOVE(data+pageOffset, tsize, arw, auio, code);