[PATCH v2] New VFS module vfs_fruit

Jeremy Allison jra at samba.org
Tue Jul 8 16:27:03 MDT 2014


On Tue, Jul 08, 2014 at 11:29:55AM +0200, Ralph Böhme wrote:
> Hi
> 
> thanks to Volker's feedback off-list, here's an updated patchset
> adding {} to all one-line if's and else's.
> 
> Review appreciated.

Just a few comments.

-------------------------------------------------------
+/**
+ * Prepend "._" to a path
+ **/
+static int adouble_path(TALLOC_CTX *ctx, const char *path_in, char **path_out)

Could be rewritten to use the existing:

parent_dirname() function (avoid code duplication).
-------------------------------------------------------

+/**
+ * Allocate and initialize an AfpInfo struct
+ *
+ * All fields are initialised in network byte order
+ **/
+static AfpInfo *afpinfo_new(TALLOC_CTX *ctx)
+{
+       AfpInfo *ai = talloc_zero(ctx, AfpInfo);
+       if (ai == NULL) {
+               return NULL;
+       }
+       ai->afpi_Signature = htonl(AFP_Signature);
+       ai->afpi_Version = htonl(AFP_Version);
+       ai->afpi_BackupTime = AD_DATE_START;
+       return ai;
+}

In Samba we usually keep in-memory values
as native host order, then convert to
network order at wire marshalling/demarshalling
time. Check out these macros for network byte
order:

RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering

-------------------------------------------------------

+#else
+                       /* FIXME: direct Solaris xattr syscall */
+                       fd = attropen(adpath, AFPRESOURCE_EA_NETATALK,
+                                     mode, 0);
+#endif
+               } else {
+                       /* FIXME: direct open(), don't have an fsp */
+                       fd = open(adpath, mode);
+               }

These direct calls mean the module isn't stackable.
That's not fatal, but it needs to be called out in
the docs (apologies if you already do this).
-------------------------------------------------------

This module is certainly coming along. I'm very
interested in getting it merged, and I'd also love
to hear about the requirements you found to modify
or extend the VFS to fit your needs better !

Cheers,

	Jeremy.


More information about the samba-technical mailing list