newfs: useless/bogus check if new last block can be accessed?
iedowse at maths.tcd.ie
Sat May 10 06:09:32 PDT 2003
In message <20030509223931.A75707 at FreeBSD.org>, Juli Mallett writes:
>* Ian Dowse <iedowse at maths.tcd.ie> [ Date: 2003-05-09 ]
>> Something like the patch below should do the trick for now. This
>> puts back the old exit code and sector number information, but
>> relies on the undocumented (?) behaviour of bwrite() leaving a
>> sensible value in errno.
>That looks pretty sane. And bwrite is undocumented. All contracts
>are explicit for now. Once it's documented that changes.
Actually, the patch isn't quite right, as errno won't be set if
there was a short write instead of an error. Unfortunately, there
is no way to fix this without changing the libufs API, since bwrite()
maps short writes to a -1 return value, so the caller can't tell
whether errno is valid.
I think bwrite() either needs to have the same semantics as pwrite(2),
or else libufs should have the ability to display or return an error
message. To avoid loss of previous functionality, the error message
would need to at least include the errno string, so the string
currently written to d_error is not sufficient.
What is using libufs's bwrite()? Would it be better to just make
errors fatal for now so that a useful diagnostic can be printed?
More information about the freebsd-fs