Great analysis.
Early in owfs development I tried using the return value to give an idea of
the error, but found that:
1. There was a poor mapping of 1-wire problems to traditional POSIX error
codes.
2. It's hard to be certain of the cause of an error in a complex
transaction.
3. There didn't seem to be a large audience for the information.
In the end, changing more of the low-level 1-wire routines to return just
good or bad made the code simpler. Bad gets assigned INVAL.
By default, most of the path parsing errors return NODEV or ISDIR depending
on the context.
Actual problems reading or writing a value return INVAL
Trying to read or write an unreadable or unwritable value returns NOTSUP.
I'm sure it's not completely consistent (as Jan pointed out), especially
since there has been no feedback or seemingly interest to date.
That aid, I'm glad to make any changes. Clearly changing the error codes
won't break anything.
Do you have an idea of what information you want from the error code?
On Wed, Aug 17, 2011 at 1:55 PM, Jan Kandziora <j...@gmx.de> wrote:
> Am Mittwoch, 17. August 2011, 01:17:59 schrieb ekgnkb3d:
> > Hi all,
> > after some tests with the owcapi I found out, that for example the
> OW_get()
> > [...]
> > did I made something wrong, or is there another method of determining a
> > reason for an error?
> >
> OWFS is useable as a filesystem so errno has to match the filesystem
> semantics. Otherwise utilities which work on files get confused. Personally
> I
> too wish some cases had been distiguishable without breaking something
> else.
>
>
> > returns -1 with an errno of "2" in the following cases:
> > - invalid directory path, like "uncaxxched/"
> >
> Clearly a "no such file or directory".
>
>
> > - wrong CRC in unique-id of the device
> >
> That device number can't exist, so "no such file or directory".
>
> Both above cases can be handled by owfs without doing any bus transfer.
> They
> should not happen with a tested application.
>
>
> > - device is not reachable
> >
> I find EIO better in that case, but Paul sure has a reason why it is ENOENT
> here, too.
>
>
> Kind regards
>
> Jan
>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers