Writing own VFS module (return values and errno)

Timo Neuvonen timo-news at tee-en.net
Sun Jan 29 17:58:13 GMT 2006

"Gerald (Jerry) Carter" <jerry at samba.org> wrote:
> Timo Neuvonen wrote:

> > I haven't found any documentation about the return values.
> I would assume they match the POSIX system calls by the same
> name I expect.  I'm not 100% positive though.  A -1 indicates
> error and errno should be set approriately.

Now, when I undestand a little bit more about this matter, I try to reshape
my question. I'm sorry if this isn't any more considered enough
Samba-related stuff...

When the actual rename function is working ok (returns 0), but the
additional code I've put into the VFS module thereafter fails, does it
really make any _practical_ difference which value I give to 'errno'? I
mean, should it be possible to at least try to control what kind of error
message is displayed to the workstation user?

There is propably a problem of missing documentation of Microsoft when it
comes to Windows workstations, but is Nautilus file browser with Samba
client for example supposed to try to show different error messages
depending on the errno value returned by low-level Samba functions? What
I've tried so far (Nautilus 2.10.0 on FC4 Linux + Samba 3.0.14a), the error
message seems always be the same "You do not have the permissions necessary
to rename xx" (*. This happens with the correct errno value EACCESS that
Samba returns due to lack of permissions, and at least with values ENOSYS
and ECANCELED I've tried by now.

Is there some errno value I could use in rename function of my own, that is
at least _expected_ to appear to the user like something else, maybe like
"unknown error" or "rename operation failed with unpredictable results". I
understand that the final verbal message may be produced by some completely
different software but Samba, but are these different error codes passed at
all to the user's client software, or are they effectively only for internal
use of Samba?

*) Actually, there seems to be at least one exception to this rule: Right
after restarting Samba, the message always says "Sorry, couldn't rename xx
to yy". I don't know what causes this, but at least this very first rename
attempt after Samba restart never reaches the DEBUG line in my own VFS
module at all...


More information about the samba-technical mailing list