vfs_fruit: convert adouble accessor macros to functions
authorRalph Boehme <slow@samba.org>
Fri, 24 May 2019 15:50:52 +0000 (17:50 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 12 Jul 2019 21:31:29 +0000 (21:31 +0000)
The functions will be moved to a different compilation unit in a subsequent
commit and struct adouble will become a private struct so callers can't access
it directly.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_fruit.c

index 0be7f20e9af147ef81d93e067f0d3845dd114073..dc44ebdfbcaac81e690730bde8fedab996b790d9 100644 (file)
@@ -367,12 +367,6 @@ typedef enum {ADOUBLE_META, ADOUBLE_RSRC} adouble_type_t;
 #define AD_XATTR_HDR_SIZE     36
 #define AD_XATTR_MAX_HDR_SIZE 65536
 
-/* Accessor macros */
-#define ad_getentrylen(ad,eid)     ((ad)->ad_eid[(eid)].ade_len)
-#define ad_getentryoff(ad,eid)     ((ad)->ad_eid[(eid)].ade_off)
-#define ad_setentrylen(ad,eid,len) ((ad)->ad_eid[(eid)].ade_len = (len))
-#define ad_setentryoff(ad,eid,off) ((ad)->ad_eid[(eid)].ade_off = (off))
-
 /*
  * Both struct ad_xattr_header and struct ad_xattr_entry describe the in memory
  * representation as well as the on-disk format.
@@ -538,6 +532,25 @@ static AfpInfo *afpinfo_new(TALLOC_CTX *ctx);
 static ssize_t afpinfo_pack(const AfpInfo *ai, char *buf);
 static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx, const void *data);
 
+static size_t ad_getentrylen(const struct adouble *ad, int eid)
+{
+       return ad->ad_eid[eid].ade_len;
+}
+
+static size_t ad_getentryoff(const struct adouble *ad, int eid)
+{
+       return ad->ad_eid[eid].ade_off;
+}
+
+static size_t ad_setentrylen(struct adouble *ad, int eid, size_t len)
+{
+       return ad->ad_eid[eid].ade_len = len;
+}
+
+static size_t ad_setentryoff(struct adouble *ad, int eid, size_t off)
+{
+       return ad->ad_eid[eid].ade_off = off;
+}
 
 /**
  * Return a pointer to an AppleDouble entry