]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/vfs/vfs.c
Convert afp_moveandrename and all called funcs to XXXat semantics if available
[netatalk.git] / libatalk / vfs / vfs.c
index 44870d076ccfff08d0fe9f99a3962e63f91b8ba7..dadedc5bbee20c21ac384b0ee7d19f435656c069 100644 (file)
 
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include <atalk/afp.h>    
 #include <atalk/adouble.h>
-#include <atalk/vfs.h>
 #include <atalk/ea.h>
 #include <atalk/acl.h>
 #include <atalk/logger.h>
 #include <atalk/util.h>
 #include <atalk/volume.h>
+#include <atalk/vfs.h>
 #include <atalk/directory.h>
 #include <atalk/unix.h>
 
@@ -86,15 +87,20 @@ for_each_adouble(const char *from, const char *name, rf_loop fn, void *data, int
 
 static int netatalk_name(const char *name)
 {
-    return strcasecmp(name,".AppleDB") &&
-        strcasecmp(name,".AppleDouble") &&
+    return strcasecmp(name,".AppleDouble") &&
+        strcasecmp(name,".AppleDB") &&
         strcasecmp(name,".AppleDesktop");
 }
 
 static int validupath_adouble(VFS_FUNC_ARGS_VALIDUPATH)
 {
-    return (vol->v_flags & AFPVOL_USEDOTS) ? 
-        netatalk_name(name) && strcasecmp(name,".Parent"): name[0] != '.';
+    if (name[0] != '.')
+        return 1;
+    
+    if (!(vol->v_flags & AFPVOL_USEDOTS))
+        return 0;
+        
+    return netatalk_name(name) && strcasecmp(name,".Parent");
 }                                           
 
 /* ----------------- */
@@ -103,7 +109,7 @@ static int RF_chown_adouble(VFS_FUNC_ARGS_CHOWN)
     struct stat st;
     char        *ad_p;
 
-    ad_p = vol->vfs->ad_path(path, ADFLAGS_HF );
+    ad_p = vol->ad_path(path, ADFLAGS_HF );
 
     if ( stat( ad_p, &st ) < 0 )
         return 0; /* ignore */
@@ -143,7 +149,7 @@ static int RF_deletecurdir_adouble(VFS_FUNC_ARGS_DELETECURDIR)
        as well. */
     if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_adouble_loop, NULL, 1, vol->v_umask))) 
         return err;
-    return netatalk_rmdir( ".AppleDouble" );
+    return netatalk_rmdir(-1, ".AppleDouble" );
 }
 
 /* ----------------- */
@@ -154,13 +160,13 @@ static int adouble_setfilmode(const char * name, mode_t mode, struct stat *st, m
 
 static int RF_setfilmode_adouble(VFS_FUNC_ARGS_SETFILEMODE)
 {
-    return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_HF ), mode, st, vol->v_umask);
+    return adouble_setfilmode(vol->ad_path(name, ADFLAGS_HF ), mode, st, vol->v_umask);
 }
 
 /* ----------------- */
 static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE)
 {
-    char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
+    char *adouble = vol->ad_path(name, ADFLAGS_DIR );
     int  dropbox = vol->v_flags;
 
     if (dir_rx_set(mode)) {
@@ -168,7 +174,7 @@ static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE)
             return -1;
     }
 
-    if (adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0) 
+    if (adouble_setfilmode(vol->ad_path(name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0) 
         return -1;
 
     if (!dir_rx_set(mode)) {
@@ -201,7 +207,7 @@ static int RF_setdirmode_adouble(VFS_FUNC_ARGS_SETDIRMODE)
 {
     int   dropbox = vol->v_flags;
     mode_t hf_mode = ad_hf_mode(mode);
-    char  *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
+    char  *adouble = vol->ad_path(name, ADFLAGS_DIR );
     char  *adouble_p = ad_dir(adouble);
 
     if (dir_rx_set(mode)) {
@@ -242,7 +248,7 @@ static int RF_setdirowner_adouble(VFS_FUNC_ARGS_SETDIROWNER)
     owner.uid = uid;
     owner.gid = gid;
 
-    adouble_p = ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR ));
+    adouble_p = ad_dir(vol->ad_path(name, ADFLAGS_DIR ));
 
     if (for_each_adouble("setdirowner", adouble_p, setdirowner_adouble_loop, &owner, noadouble, vol->v_umask)) 
         return -1;
@@ -267,7 +273,7 @@ static int RF_setdirowner_adouble(VFS_FUNC_ARGS_SETDIROWNER)
 /* ----------------- */
 static int RF_deletefile_adouble(VFS_FUNC_ARGS_DELETEFILE)
 {
-       return netatalk_unlink(vol->vfs->ad_path( file, ADFLAGS_HF));
+       return netatalk_unlinkat(dirfd, vol->ad_path(file, ADFLAGS_HF));
 }
 
 /* ----------------- */
@@ -276,17 +282,17 @@ static int RF_renamefile_adouble(VFS_FUNC_ARGS_RENAMEFILE)
     char  adsrc[ MAXPATHLEN + 1];
     int   err = 0;
 
-    strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
-    if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
+    strcpy( adsrc, vol->ad_path(src, 0 ));
+    if (unix_rename(dirfd, adsrc, -1, vol->ad_path(dst, 0 )) < 0) {
         struct stat st;
 
         err = errno;
         if (errno == ENOENT) {
                struct adouble    ad;
 
-            if (stat(adsrc, &st)) /* source has no ressource fork, */
+            if (lstatat(dirfd, adsrc, &st)) /* source has no ressource fork, */
                 return 0;
-            
+
             /* We are here  because :
              * -there's no dest folder. 
              * -there's no .AppleDouble in the dest folder.
@@ -297,7 +303,7 @@ static int RF_renamefile_adouble(VFS_FUNC_ARGS_RENAMEFILE)
             ad_init(&ad, vol->v_adouble, vol->v_ad_options); 
             if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) {
                ad_close(&ad, ADFLAGS_HF);
-               if (!unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) ) 
+               if (!unix_rename(dirfd, adsrc, -1, vol->ad_path(dst, 0 )) ) 
                    err = 0;
                 else 
                    err = errno;
@@ -331,11 +337,11 @@ static int RF_solaris_acl(VFS_FUNC_ARGS_ACL)
        if ((acl(buf, cmd, count, aces)) != 0)
            return -1;
        /* now set ACL on ressource fork */
-       if ((acl(vol->vfs->ad_path(path, ADFLAGS_DIR), cmd, count, aces)) != 0)
+       if ((acl(vol->ad_path(path, ADFLAGS_DIR), cmd, count, aces)) != 0)
            return -1;
     } else
        /* set ACL on ressource fork */
-       if ((acl(vol->vfs->ad_path(path, ADFLAGS_HF), cmd, count, aces)) != 0)
+       if ((acl(vol->ad_path(path, ADFLAGS_HF), cmd, count, aces)) != 0)
            return -1;
 
     return 0;
@@ -352,14 +358,14 @@ static int RF_solaris_remove_acl(VFS_FUNC_ARGS_REMOVE_ACL)
        if (len < 0 || len >=  MAXPATHLEN)
            return AFPERR_MISC;
        /* remove ACL from .AppleDouble/.Parent first */
-       if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_DIR))) != AFP_OK)
+       if ((ret = remove_acl(vol->ad_path(path, ADFLAGS_DIR))) != AFP_OK)
            return ret;
        /* now remove from .AppleDouble dir */
        if ((ret = remove_acl(buf)) != AFP_OK)
            return ret;
     } else
        /* remove ACL from ressource fork */
-       if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_HF))) != AFP_OK)
+       if ((ret = remove_acl(vol->ad_path(path, ADFLAGS_HF))) != AFP_OK)
            return ret;
 
     return AFP_OK;
@@ -389,7 +395,7 @@ static int RF_chown_ads(VFS_FUNC_ARGS_CHOWN)
     owner.gid = gid;
 
 
-    ad_p = ad_dir(vol->vfs->ad_path(path, ADFLAGS_HF ));
+    ad_p = ad_dir(vol->ad_path(path, ADFLAGS_HF ));
 
     if ( stat( ad_p, &st ) < 0 ) {
        /* ignore */
@@ -421,7 +427,7 @@ static int ads_delete_rf(char *name)
     */
     if ((err = for_each_adouble("deletecurdir", name, deletecurdir_ads1_loop, NULL, 1, 0))) 
         return err;
-    return netatalk_rmdir(name);
+    return netatalk_rmdir(-1, name);
 }
 
 static int deletecurdir_ads_loop(struct dirent *de, char *name, void *data _U_, int flag _U_, mode_t v_umask _U_)
@@ -440,11 +446,12 @@ static int deletecurdir_ads_loop(struct dirent *de, char *name, void *data _U_,
 static int RF_deletecurdir_ads(VFS_FUNC_ARGS_DELETECURDIR)
 {
     int err;
-    
+
     /* delete stray .AppleDouble files. this happens to get .Parent files as well. */
     if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_ads_loop, NULL, 1, 0))) 
         return err;
-    return netatalk_rmdir( ".AppleDouble" );
+
+    return netatalk_rmdir(-1, ".AppleDouble" );
 }
 
 /* ------------------- */
@@ -494,13 +501,13 @@ static int ads_setfilmode(const char * name, mode_t mode, struct stat *st, mode_
 
 static int RF_setfilmode_ads(VFS_FUNC_ARGS_SETFILEMODE)
 {
-    return ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_HF )), mode, st, vol->v_umask);
+    return ads_setfilmode(ad_dir(vol->ad_path(name, ADFLAGS_HF )), mode, st, vol->v_umask);
 }
 
 /* ------------------- */
 static int RF_setdirunixmode_ads(VFS_FUNC_ARGS_SETDIRUNIXMODE)
 {
-    char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
+    char *adouble = vol->ad_path(name, ADFLAGS_DIR );
     char   ad_p[ MAXPATHLEN + 1];
     int dropbox = vol->v_flags;
 
@@ -517,7 +524,7 @@ static int RF_setdirunixmode_ads(VFS_FUNC_ARGS_SETDIRUNIXMODE)
             return -1;
     }
 
-    if (ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0)
+    if (ads_setfilmode(ad_dir(vol->ad_path(name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0)
         return -1;
 
     if (!dir_rx_set(mode)) {
@@ -565,7 +572,7 @@ static int setdirmode_ads_loop(struct dirent *de _U_, char *name, void *data, in
 
 static int RF_setdirmode_ads(VFS_FUNC_ARGS_SETDIRMODE)
 {
-    char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
+    char *adouble = vol->ad_path(name, ADFLAGS_DIR );
     char   ad_p[ MAXPATHLEN + 1];
     struct dir_mode param;
 
@@ -628,7 +635,7 @@ static int RF_setdirowner_ads(VFS_FUNC_ARGS_SETDIROWNER)
     owner.uid = uid;
     owner.gid = gid;
 
-    strlcpy(adouble_p, ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR )), sizeof(adouble_p));
+    strlcpy(adouble_p, ad_dir(vol->ad_path(name, ADFLAGS_DIR )), sizeof(adouble_p));
 
     if (for_each_adouble("setdirowner", ad_dir(adouble_p), setdirowner_ads_loop, &owner, noadouble, 0)) 
         return -1;
@@ -653,9 +660,31 @@ static int RF_setdirowner_ads(VFS_FUNC_ARGS_SETDIROWNER)
 /* ------------------- */
 static int RF_deletefile_ads(VFS_FUNC_ARGS_DELETEFILE)
 {
-    char *ad_p = ad_dir(vol->vfs->ad_path(file, ADFLAGS_HF ));
+    int ret = 0;
+    int cwd = -1;
+    char *ad_p;
+
+    ad_p = ad_dir(vol->ad_path(file, ADFLAGS_HF ));
+
+    if (dirfd != -1) {
+        if (((cwd = open(".", O_RDONLY)) == -1) || (fchdir(dirfd) != 0)) {
+            ret = AFPERR_MISC;
+            goto exit;
+        }
+    }
+
+    ret = ads_delete_rf(ad_p);
+
+    if (dirfd != -1 && fchdir(cwd) != 0) {
+        LOG(log_error, logtype_afpd, "RF_deletefile_ads: cant chdir back. exit!");
+        exit(EXITERR_SYS);
+    }
+
+exit:
+    if (cwd != -1)
+        close(cwd);
 
-    return ads_delete_rf(ad_p);
+    return ret;
 }
 
 /* --------------------------- */
@@ -664,15 +693,15 @@ static int RF_renamefile_ads(VFS_FUNC_ARGS_RENAMEFILE)
     char  adsrc[ MAXPATHLEN + 1];
     int   err = 0;
 
-    strcpy( adsrc, ad_dir(vol->vfs->ad_path( src, 0 )));
-    if (unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) < 0) {
+    strcpy( adsrc, ad_dir(vol->ad_path(src, 0 )));
+    if (unix_rename(dirfd, adsrc, -1, ad_dir(vol->ad_path(dst, 0 ))) < 0) {
         struct stat st;
 
         err = errno;
         if (errno == ENOENT) {
                struct adouble    ad;
 
-            if (stat(adsrc, &st)) /* source has no ressource fork, */
+            if (lstatat(dirfd, adsrc, &st)) /* source has no ressource fork, */
                 return 0;
             
             /* We are here  because :
@@ -687,8 +716,8 @@ static int RF_renamefile_ads(VFS_FUNC_ARGS_RENAMEFILE)
                ad_close(&ad, ADFLAGS_HF);
 
                /* We must delete it */
-               RF_deletefile_ads(vol, dst );
-               if (!unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) ) 
+               RF_deletefile_ads(vol, -1, dst );
+               if (!unix_rename(dirfd, adsrc, -1, ad_dir(vol->ad_path(dst, 0 ))) ) 
                    err = 0;
                 else 
                    err = errno;
@@ -719,19 +748,19 @@ static int RF_renamedir_osx(VFS_FUNC_ARGS_RENAMEDIR)
 {
     /* We simply move the corresponding ad file as well */
     char   tempbuf[258]="._";
-    return rename(vol->vfs->ad_path(oldpath,0),strcat(tempbuf,newpath));
+    return unix_rename(dirfd, vol->ad_path(oldpath,0), -1, strcat(tempbuf,newpath));
 }
 
 /* ---------------- */
 static int RF_deletecurdir_osx(VFS_FUNC_ARGS_DELETECURDIR)
 {
-    return netatalk_unlink( vol->vfs->ad_path(".",0) );
+    return netatalk_unlink( vol->ad_path(".",0) );
 }
 
 /* ---------------- */
 static int RF_setdirunixmode_osx(VFS_FUNC_ARGS_SETDIRUNIXMODE)
 {
-    return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask);
+    return adouble_setfilmode(vol->ad_path(name, ADFLAGS_DIR ), mode, st, vol->v_umask);
 }
 
 /* ---------------- */
@@ -752,13 +781,13 @@ static int RF_renamefile_osx(VFS_FUNC_ARGS_RENAMEFILE)
     char  adsrc[ MAXPATHLEN + 1];
     int   err = 0;
 
-    strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
+    strcpy( adsrc, vol->ad_path(src, 0 ));
 
-    if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
+    if (unix_rename(dirfd, adsrc, -1, vol->ad_path(dst, 0 )) < 0) {
         struct stat st;
 
         err = errno;
-        if (errno == ENOENT && stat(adsrc, &st)) /* source has no ressource fork, */
+        if (errno == ENOENT && lstatat(dirfd, adsrc, &st)) /* source has no ressource fork, */
             return 0;
         errno = err;
         return -1;
@@ -779,25 +808,19 @@ static int RF_renamefile_osx(VFS_FUNC_ARGS_RENAMEFILE)
  * following funcs are called in order to give them a chance.
  */
 
-/* 
- * Currently the maximum will be:
- * main adouble module + EA module + ACL module + NULL = 4.
- * NULL is an end of array marker.
- */
-static struct vfs_ops *vfs[4] = { NULL };
-
 /* 
  * Define most VFS funcs with macros as they all do the same.
  * Only "ad_path" and "validupath" will NOT do stacking and only
  * call the func from the first module.
  */
+
 #define VFS_MFUNC(name, args, vars) \
     static int vfs_ ## name(args) \
     { \
         int i = 0, ret = AFP_OK, err; \
-        while (vfs[i]) { \
-            if (vfs[i]->vfs_ ## name) { \
-                err = vfs[i]->vfs_ ## name (vars); \
+        while (vol->vfs_modules[i]) { \
+            if (vol->vfs_modules[i]->vfs_ ## name) { \
+                err = vol->vfs_modules[i]->vfs_ ## name (vars); \
                 if ((ret == AFP_OK) && (err != AFP_OK)) \
                     ret = err; \
             } \
@@ -824,14 +847,9 @@ VFS_MFUNC(ea_list, VFS_FUNC_ARGS_EA_LIST, VFS_FUNC_VARS_EA_LIST)
 VFS_MFUNC(ea_set, VFS_FUNC_ARGS_EA_SET, VFS_FUNC_VARS_EA_SET)
 VFS_MFUNC(ea_remove, VFS_FUNC_ARGS_EA_REMOVE, VFS_FUNC_VARS_EA_REMOVE)
 
-static char *vfs_path(const char *path, int flags)
-{
-    return vfs[0]->ad_path(path, flags);
-}
-
 static int vfs_validupath(VFS_FUNC_ARGS_VALIDUPATH)
 {
-    return vfs[0]->vfs_validupath(VFS_FUNC_VARS_VALIDUPATH);
+    return vol->vfs_modules[0]->vfs_validupath(VFS_FUNC_VARS_VALIDUPATH);
 }
 
 /*
@@ -839,7 +857,6 @@ static int vfs_validupath(VFS_FUNC_ARGS_VALIDUPATH)
  * These funcs are defined via the macros above.
  */
 static struct vfs_ops vfs_master_funcs = {
-    vfs_path,
     vfs_validupath,
     vfs_chown,
     vfs_renamedir,
@@ -865,7 +882,6 @@ static struct vfs_ops vfs_master_funcs = {
  */
 
 static struct vfs_ops netatalk_adouble = {
-    /* vfs_path:          */ ad_path,
     /* vfs_validupath:    */ validupath_adouble,
     /* vfs_chown:         */ RF_chown_adouble,
     /* vfs_renamedir:     */ RF_renamedir_adouble,
@@ -876,11 +892,11 @@ static struct vfs_ops netatalk_adouble = {
     /* vfs_setdirowner:   */ RF_setdirowner_adouble,
     /* vfs_deletefile:    */ RF_deletefile_adouble,
     /* vfs_renamefile:    */ RF_renamefile_adouble,
+    /* vfs_copyfile:      */ NULL,
     NULL
 };
 
 static struct vfs_ops netatalk_adouble_osx = {
-    /* vfs_path:          */ ad_path_osx,
     /* vfs_validupath:    */ validupath_osx,
     /* vfs_chown:         */ RF_chown_adouble,
     /* vfs_renamedir:     */ RF_renamedir_osx,
@@ -891,12 +907,12 @@ static struct vfs_ops netatalk_adouble_osx = {
     /* vfs_setdirowner:   */ RF_setdirowner_osx,
     /* vfs_deletefile:    */ RF_deletefile_adouble,
     /* vfs_renamefile:    */ RF_renamefile_osx,
+    /* vfs_copyfile:      */ NULL,
     NULL
 };
 
 /* samba sfm format. ad_path shouldn't be set her */
 static struct vfs_ops netatalk_adouble_sfm = {
-    /* vfs_path:          */ ad_path_sfm,
     /* vfs_validupath:    */ validupath_adouble,
     /* vfs_chown:         */ RF_chown_ads,
     /* vfs_renamedir:     */ RF_renamedir_adouble,
@@ -907,6 +923,7 @@ static struct vfs_ops netatalk_adouble_sfm = {
     /* vfs_setdirowner:   */ RF_setdirowner_ads,
     /* vfs_deletefile:    */ RF_deletefile_ads,
     /* vfs_renamefile:    */ RF_renamefile_ads,
+    /* vfs_copyfile:      */ NULL,
     NULL
 };
 
@@ -915,7 +932,6 @@ static struct vfs_ops netatalk_adouble_sfm = {
  */
 
 static struct vfs_ops netatalk_ea_adouble = {
-    /* vfs_path:          */ NULL,
     /* vfs_validupath:    */ NULL,
     /* vfs_chown:         */ ea_chown,
     /* vfs_renamedir:     */ NULL, /* ok */
@@ -936,9 +952,7 @@ static struct vfs_ops netatalk_ea_adouble = {
     /* vfs_remove         */ remove_ea
 };
 
-#ifdef HAVE_SOLARIS_EAS
-static struct vfs_ops netatalk_ea_solaris = {
-    /* ad_path:           */ NULL,
+static struct vfs_ops netatalk_ea_sys = {
     /* validupath:        */ NULL,
     /* rf_chown:          */ NULL,
     /* rf_renamedir:      */ NULL,
@@ -949,16 +963,15 @@ static struct vfs_ops netatalk_ea_solaris = {
     /* rf_setdirowner:    */ NULL,
     /* rf_deletefile:     */ NULL,
     /* rf_renamefile:     */ NULL,
-    /* vfs_copyfile:      */ NULL,
+    /* vfs_copyfile:      */ sys_ea_copyfile,
     /* rf_acl:            */ NULL,
     /* rf_remove_acl      */ NULL,
-    /* ea_getsize         */ sol_get_easize,
-    /* ea_getcontent      */ sol_get_eacontent,
-    /* ea_list            */ sol_list_eas,
-    /* ea_set             */ sol_set_ea,
-    /* ea_remove          */ sol_remove_ea
+    /* ea_getsize         */ sys_get_easize,
+    /* ea_getcontent      */ sys_get_eacontent,
+    /* ea_list            */ sys_list_eas,
+    /* ea_set             */ sys_set_ea,
+    /* ea_remove          */ sys_remove_ea
 };
-#endif
 
 /* 
  * Tertiary VFS modules for ACLs
@@ -966,7 +979,6 @@ static struct vfs_ops netatalk_ea_solaris = {
 
 #ifdef HAVE_NFSv4_ACLS
 static struct vfs_ops netatalk_solaris_acl_adouble = {
-    /* ad_path:           */ NULL,
     /* validupath:        */ NULL,
     /* rf_chown:          */ NULL,
     /* rf_renamedir:      */ NULL,
@@ -979,7 +991,7 @@ static struct vfs_ops netatalk_solaris_acl_adouble = {
     /* rf_renamefile:     */ NULL,
     /* vfs_copyfile       */ NULL,
     /* rf_acl:            */ RF_solaris_acl,
-    /* rf_remove_acl      */ RF_remove_acl,
+    /* rf_remove_acl      */ RF_solaris_remove_acl,
     NULL
 };
 #endif
@@ -991,34 +1003,31 @@ void initvol_vfs(struct vol *vol)
 
     /* Default adouble stuff */
     if (vol->v_adouble == AD_VERSION2_OSX) {
-        vfs[0] = &netatalk_adouble_osx;
+        vol->vfs_modules[0] = &netatalk_adouble_osx;
+        vol->ad_path = ad_path_osx;
     }
     else if (vol->v_adouble == AD_VERSION1_SFM) {
-        vfs[0] = &netatalk_adouble_sfm;
+        vol->vfs_modules[0] = &netatalk_adouble_sfm;
+        vol->ad_path = ad_path_sfm;
     }
     else {
-        vfs[0] = &netatalk_adouble;
+        vol->vfs_modules[0] = &netatalk_adouble;
+        vol->ad_path = ad_path;
     }
 
     /* Extended Attributes */
-    if (vol->v_vfs_ea == AFPVOL_EA_SOLARIS) {
-
-#ifdef HAVE_SOLARIS_EAS
-        LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with Solaris native EAs.");
-        vfs[1] = &netatalk_ea_solaris;
-#else
-        LOG(log_error, logtype_afpd, "initvol_vfs: Can't enable Solaris EA support.");
-        goto enable_adea;
-#endif
+    if (vol->v_vfs_ea == AFPVOL_EA_SYS) {
+        LOG(log_debug, logtype_afpd, "initvol_vfs: enabling EA support with native EAs");
+        vol->vfs_modules[1] = &netatalk_ea_sys;
+    } else if (vol->v_vfs_ea == AFPVOL_EA_AD) {
+        LOG(log_debug, logtype_afpd, "initvol_vfs: enabling EA support with adouble files");
+        vol->vfs_modules[1] = &netatalk_ea_adouble;
     } else {
-    enable_adea:
-        /* default: AFPVOL_EA_AD */
-        LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with adouble files.");
-        vfs[1] = &netatalk_ea_adouble;
+        LOG(log_debug, logtype_afpd, "initvol_vfs: volume without EA support");
     }
 
     /* ACLs */
 #ifdef HAVE_NFSv4_ACLS
-    vfs[2] = &netatalk_solaris_acl_adouble;
+    vol->vfs_modules[2] = &netatalk_solaris_acl_adouble;
 #endif
 }