Another interesting tidbit is in hw/9pfs/virtio-9p-proxy.c.

All filesystem methods use common v9fs_request() function,
which returns -errno.  So far so good.

Now, *all* places which call this function, does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
    }
    return retval;

and *some* does this:

    retval = v9fs_request(...);
    if (retval < 0) {
        errno = -retval;
        retval = -1;
    }
    return retval;

So basically, *all* places sets errno in case of negative
return from v9fs_request(), but only some of them make the
return value to be -1 instead of original negative value.

So I've two questions here.

1. Why some filesystem methods return -1 while some return -errno?
2. Why can't v9fs_request() set errno itself?

Thanks,

/mjt

Reply via email to