mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 05:57:43 +00:00
afs: Indicate error from afs_osi_Read/Write better
Currently afs_osi_Read and afs_osi_Write just return -1 on any I/O error, even though they know the error code given from the OS VFS. Just return that code instead so the caller can see what the error was; but negate it, so it's clear that it is an error. Reviewed-on: http://gerrit.openafs.org/6412 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org> (cherry picked from commit b5ca12ac4696c4049be14974f1e946bb55e1c440) Change-Id: Ib5a674af7e0424691887b20d24782a6740d11414 Reviewed-on: http://gerrit.openafs.org/7938 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
6a48d79247
commit
3127ec4e69
@ -198,7 +198,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
goto retry_IO;
|
||||
}
|
||||
setuerror(code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -241,7 +243,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
afs_warnuser
|
||||
("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
|
||||
setuerror(code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -346,7 +346,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -387,7 +389,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
code = asize - resid;
|
||||
afile->offset += code;
|
||||
} else {
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -187,7 +187,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -216,7 +218,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
code = asize - resid;
|
||||
afile->offset += code;
|
||||
} else {
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -177,7 +177,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
goto retry_IO;
|
||||
}
|
||||
setuerror(code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -208,7 +210,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
afs_warnuser
|
||||
("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
|
||||
setuerror(code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -160,7 +160,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -191,7 +193,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
if (code == ENOSPC)
|
||||
afs_warnuser
|
||||
("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -231,7 +231,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, auio.uio_resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -267,7 +269,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
if (code == ENOSPC)
|
||||
afs_warnuser
|
||||
("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (afile->proc)
|
||||
|
@ -215,7 +215,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, auio.uio_resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -251,7 +253,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
if (code == ENOSPC)
|
||||
afs_warnuser
|
||||
("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (afile->proc)
|
||||
|
@ -160,7 +160,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -192,8 +194,11 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
afile->offset += code;
|
||||
if (afile->offset > afile->size)
|
||||
afile->size = afile->offset;
|
||||
} else
|
||||
code = -1;
|
||||
} else {
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (afile->proc)
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -163,7 +163,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32,
|
||||
(unsigned int) resid, ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -195,8 +197,11 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
afile->offset += code;
|
||||
if (afile->offset > afile->size)
|
||||
afile->size = afile->offset;
|
||||
} else
|
||||
code = -1;
|
||||
} else {
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (afile->proc)
|
||||
(*afile->proc) (afile, code);
|
||||
|
@ -396,7 +396,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
|
||||
} else {
|
||||
afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
|
||||
ICL_TYPE_INT32, code);
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -428,7 +430,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
||||
code = asize - resid;
|
||||
afile->offset += code;
|
||||
} else {
|
||||
code = -1;
|
||||
if (code > 0) {
|
||||
code *= -1;
|
||||
}
|
||||
}
|
||||
if (afile->proc) {
|
||||
(*afile->proc) (afile, code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user