code:geterror - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
- 将 块设备返回的IO错误 传递给 user结构,由 user结构 返回给用户
- 若 设备提示错误(b->flags & B_ERROR != 0) ,错误代码却为0 (bp->b_error==0),则传递给user结构 EIO错误
5329
5330 /*
5331 * Pick up the device’s error number and pass it to the
5332 * user; if there is an error but the number is 0 set a
5333 * generalised code. Actually the latter is always true
5334 * because devices don’t yet return specific errors.
5335 */
5336 geterror(abp)
5337 struct buf *abp;
5338 {
5339 register struct buf *bp;
5340
5341 bp = abp;
5342 if (bp->b_flags&B_ERROR)
5343 if ((u.u_error = bp->b_error)==0)
5345 }
5346 /* ------------------------- */
5347
5348
5349