Questions regarding vfs module development
jra at samba.org
Wed Jun 8 18:27:41 UTC 2016
On Wed, Jun 08, 2016 at 12:15:40PM -0600, Trever L. Adams wrote:
> On 06/08/2016 12:07 PM, Jeremy Allison wrote:
> > On Wed, Jun 08, 2016 at 11:37:04AM -0600, Trever L. Adams wrote:
> >> I am looking at https://github.com/fumiyas/samba-virusfilter. I am
> >> interested in this for my own use and would love to help update it. I
> >> have a few questions. Of course, all the work I am doing, I hope to get
> >> committed to the authors tree.
> >> 1) Is it okay to use basename and dirname (POSIX.1-2001, POSIX.1-2008)
> >> in vfs modules or does there need to be ifdefs/autoconf/waf magic
> >> involved? If it is not okay, are there functions that do similar in samba?
> > Don't use basename/dirname. Inside smbd use parent_dirname() instead, which
> > does a combination of basename/dirname.
> bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
> const char **name)
> So, as I read the code, dir would be smb_fname->base_name and dirname
> results would be in parent while name would be basename reults. Do I
> have that correctly? Additionally, unlike POSIX definition it appears
> that this function does NOT modify the original under any circumstances
> and I must also TALLOC_FREE the results. Is this correct?
You only have to free parent, not name. name points to a
substring in the talloc'ed parent return.
More information about the samba-technical