The Samba VFS and return values ...

Jeremy Allison jra at
Tue Apr 14 11:42:03 MDT 2015

On Tue, Apr 14, 2015 at 09:48:21AM -0700, Richard Sharpe wrote:
> Hi folks,
> I have long thought it would be good to have all Samba VFS functions
> return NTSTATUS codes (without exception.)
> Why?
> 1. Consistency. Today some return ints (< 0 for error) and set errno,
> some NTSTATUSes, some return pointers to objects and return NULL on
> error and set errno.
> 2. There have been times where I have wanted to return
> NT_STATUS_SHARING_VIOLATION from the earliest VFS function Samba
> returns, but could not because it did not return an NTSTATUS. In those
> cases I was forced to add something like #define ESHARINGVIOLATION
> 1001 and add translations to the various tables. This is ugly. I am
> sure others have been in the same position.
> Last week I posted a patch that is my first attempt at this. I
> converted realpath to returning an NTSTATUS result.

Just wanted to let you know I haven't forgotten this, it's
in my review queue :-).



> This one is important because Samba calls SMB_VFS_REALPATH first for
> every filename/pathname operation.
> The conversion was non-trivial because Samba is handling the error
> codes in special ways for some cases (eg ENOTDIR and ENOENT) so I had
> to make sure I preserved that.
> Stat is the next on on my list.
> However, before proceeding, I wanted to find out if anyone has any
> objections or suggestions on how to better achieve my goal.
> My goal is that people who write VFS modules should be able to return
> etc rather than having to define bogus errno codes ...
> -- 
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)

More information about the samba-technical mailing list