2 Copyright (c) 2004 Didier Gautheron
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #endif /* HAVE_CONFIG_H */
26 #include <atalk/afp.h>
27 #include <atalk/adouble.h>
28 #include <atalk/vfs.h>
29 #include <atalk/logger.h>
30 #include <atalk/util.h>
31 #include <atalk/volume.h>
32 #include <atalk/directory.h>
38 #ifdef HAVE_NFSv4_ACLS
39 extern int remove_acl(const char *name);
47 typedef int (*rf_loop)(struct dirent *, char *, void *, int , mode_t );
49 /* ----------------------------- */
51 for_each_adouble(const char *from, const char *name, rf_loop fn, void *data, int flag, mode_t v_umask)
53 char buf[ MAXPATHLEN + 1];
60 if (NULL == ( dp = opendir( name)) ) {
62 LOG(log_error, logtype_afpd, "%s: opendir %s: %s", from, fullpathname(name),strerror(errno) );
67 strlcpy( buf, name, sizeof(buf));
68 strlcat( buf, "/", sizeof(buf) );
69 m = strchr( buf, '\0' );
71 while ((de = readdir(dp))) {
72 if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
76 strlcat(buf, de->d_name, sizeof(buf));
77 if (fn && (ret = fn(de, buf, data, flag, v_umask))) {
87 /*******************************************************************************
88 * classic adouble format
89 *******************************************************************************/
91 static int netatalk_name(const char *name)
93 return strcasecmp(name,".AppleDB") &&
94 strcasecmp(name,".AppleDouble") &&
95 strcasecmp(name,".AppleDesktop");
98 static int validupath_adouble(const struct vol *vol, const char *name)
100 return (vol->v_flags & AFPVOL_USEDOTS) ?
101 netatalk_name(name) && strcasecmp(name,".Parent"): name[0] != '.';
104 /* ----------------- */
105 static int RF_chown_adouble(const struct vol *vol, const char *path, uid_t uid, gid_t gid)
111 ad_p = vol->vfs->ad_path(path, ADFLAGS_HF );
113 if ( stat( ad_p, &st ) < 0 )
114 return 0; /* ignore */
116 return chown( ad_p, uid, gid );
119 /* ----------------- */
120 int RF_renamedir_adouble(const struct vol *vol _U_, const char *oldpath _U_, const char *newpath _U_)
125 /* ----------------- */
126 static int deletecurdir_adouble_loop(struct dirent *de, char *name, void *data _U_, int flag _U_, mode_t v_umask)
131 /* bail if the file exists in the current directory.
132 * note: this will not fail with dangling symlinks */
134 if (stat(de->d_name, &st) == 0)
135 return AFPERR_DIRNEMPT;
137 if ((err = netatalk_unlink(name)))
143 static int RF_deletecurdir_adouble(const struct vol *vol)
147 /* delete stray .AppleDouble files. this happens to get .Parent files
149 if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_adouble_loop, NULL, 1, vol->v_umask)))
151 return netatalk_rmdir( ".AppleDouble" );
154 /* ----------------- */
155 static int adouble_setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask)
157 return setfilmode(name, ad_hf_mode(mode), st, v_umask);
160 static int RF_setfilmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
162 return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_HF ), mode, st, vol->v_umask);
165 /* ----------------- */
166 static int RF_setdirunixmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
168 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
169 int dropbox = vol->v_flags;
171 if (dir_rx_set(mode)) {
172 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 )
176 if (adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0)
179 if (!dir_rx_set(mode)) {
180 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 )
186 /* ----------------- */
187 static int setdirmode_adouble_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask)
189 mode_t hf_mode = *(mode_t *)data;
192 if ( stat( name, &st ) < 0 ) {
195 LOG(log_error, logtype_afpd, "setdirmode: stat %s: %s", name, strerror(errno) );
197 else if (!S_ISDIR(st.st_mode)) {
198 if (setfilmode(name, hf_mode , &st, v_umask) < 0) {
199 /* FIXME what do we do then? */
205 static int RF_setdirmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st _U_)
207 int dropbox = vol->v_flags;
208 mode_t hf_mode = ad_hf_mode(mode);
209 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
210 char *adouble_p = ad_dir(adouble);
212 if (dir_rx_set(mode)) {
213 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0)
217 if (for_each_adouble("setdirmode", adouble_p, setdirmode_adouble_loop, &hf_mode, vol_noadouble(vol), vol->v_umask))
220 if (!dir_rx_set(mode)) {
221 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0)
227 /* ----------------- */
228 static int setdirowner_adouble_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
230 struct perm *owner = data;
232 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
233 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
234 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
235 /* return ( -1 ); Sometimes this is okay */
240 static int RF_setdirowner_adouble(const struct vol *vol, const char *name, uid_t uid, gid_t gid)
243 int noadouble = vol_noadouble(vol);
251 adouble_p = ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR ));
253 if (for_each_adouble("setdirowner", adouble_p, setdirowner_adouble_loop, &owner, noadouble, vol->v_umask))
257 * We cheat: we know that chown doesn't do anything.
259 if ( stat( ".AppleDouble", &st ) < 0) {
260 if (errno == ENOENT && noadouble)
262 LOG(log_error, logtype_afpd, "setdirowner: stat %s: %s", fullpathname(".AppleDouble"), strerror(errno) );
265 if ( gid && gid != st.st_gid && chown( ".AppleDouble", uid, gid ) < 0 && errno != EPERM ) {
266 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
267 uid, gid,fullpathname(".AppleDouble"), strerror(errno) );
268 /* return ( -1 ); Sometimes this is okay */
273 /* ----------------- */
274 static int RF_deletefile_adouble(const struct vol *vol, const char *file )
276 return netatalk_unlink(vol->vfs->ad_path( file, ADFLAGS_HF));
279 /* ----------------- */
280 int RF_renamefile_adouble(const struct vol *vol, const char *src, const char *dst)
282 char adsrc[ MAXPATHLEN + 1];
285 strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
286 if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
290 if (errno == ENOENT) {
293 if (stat(adsrc, &st)) /* source has no ressource fork, */
296 /* We are here because :
297 * -there's no dest folder.
298 * -there's no .AppleDouble in the dest folder.
299 * if we use the struct adouble passed in parameter it will not
300 * create .AppleDouble if the file is already opened, so we
301 * use a diff one, it's not a pb,ie it's not the same file, yet.
303 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
304 if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) {
305 ad_close(&ad, ADFLAGS_HF);
306 if (!unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) )
311 else { /* it's something else, bail out */
323 #ifdef HAVE_NFSv4_ACLS
324 static int RF_acl(const struct vol *vol, const char *path, int cmd, int count, ace_t *aces)
326 static char buf[ MAXPATHLEN + 1];
329 if ((stat(path, &st)) != 0)
331 if (S_ISDIR(st.st_mode)) {
332 if ((snprintf(buf, MAXPATHLEN, "%s/.AppleDouble",path)) < 0)
334 /* set acl on .AppleDouble dir first */
335 if ((acl(buf, cmd, count, aces)) != 0)
337 /* now set ACL on ressource fork */
338 if ((acl(vol->vfs->ad_path(path, ADFLAGS_DIR), cmd, count, aces)) != 0)
341 /* set ACL on ressource fork */
342 if ((acl(vol->vfs->ad_path(path, ADFLAGS_HF), cmd, count, aces)) != 0)
348 static int RF_remove_acl(const struct vol *vol, const char *path, int dir)
351 static char buf[ MAXPATHLEN + 1];
354 if ((snprintf(buf, MAXPATHLEN, "%s/.AppleDouble",path)) < 0)
356 /* remove ACL from .AppleDouble/.Parent first */
357 if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_DIR))) != AFP_OK)
359 /* now remove from .AppleDouble dir */
360 if ((ret = remove_acl(buf)) != AFP_OK)
363 /* remove ACL from ressource fork */
364 if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_HF))) != AFP_OK)
371 /*********************************************************************************
373 *********************************************************************************/
374 static int ads_chown_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
376 struct perm *owner = data;
378 if (chown( name , owner->uid, owner->gid ) < 0) {
384 static int RF_chown_ads(const struct vol *vol, const char *path, uid_t uid, gid_t gid)
395 ad_p = ad_dir(vol->vfs->ad_path(path, ADFLAGS_HF ));
397 if ( stat( ad_p, &st ) < 0 ) {
402 if (chown( ad_p, uid, gid ) < 0) {
405 return for_each_adouble("chown_ads", ad_p, ads_chown_loop, &owner, 1, vol->v_umask);
408 /* --------------------------------- */
409 static int deletecurdir_ads1_loop(struct dirent *de _U_, char *name, void *data _U_, int flag _U_, mode_t v_umask _U_)
411 return netatalk_unlink(name);
414 static int ads_delete_rf(char *name)
418 if ((err = for_each_adouble("deletecurdir", name, deletecurdir_ads1_loop, NULL, 1, 0)))
421 * it's a problem for a nfs mounted folder, there's .nfsxxx around
422 * for linux the following line solve it.
423 * but it could fail if rm .nfsxxx create a new .nfsyyy :(
425 if ((err = for_each_adouble("deletecurdir", name, deletecurdir_ads1_loop, NULL, 1, 0)))
427 return netatalk_rmdir(name);
430 static int deletecurdir_ads_loop(struct dirent *de, char *name, void *data _U_, int flag _U_, mode_t v_umask _U_)
434 /* bail if the file exists in the current directory.
435 * note: this will not fail with dangling symlinks */
437 if (stat(de->d_name, &st) == 0) {
438 return AFPERR_DIRNEMPT;
440 return ads_delete_rf(name);
443 static int RF_deletecurdir_ads(const struct vol *vol _U_)
447 /* delete stray .AppleDouble files. this happens to get .Parent files as well. */
448 if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_ads_loop, NULL, 1, 0)))
450 return netatalk_rmdir( ".AppleDouble" );
453 /* ------------------- */
459 static int ads_setfilmode_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask)
461 struct set_mode *param = data;
463 return setfilmode(name, param->mode, param->st, v_umask);
466 static int ads_setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask)
468 mode_t file_mode = ad_hf_mode(mode);
469 mode_t dir_mode = file_mode;
470 struct set_mode param;
472 if ((dir_mode & (S_IRUSR | S_IWUSR )))
474 if ((dir_mode & (S_IRGRP | S_IWGRP )))
476 if ((dir_mode & (S_IROTH | S_IWOTH )))
481 if (dir_rx_set(dir_mode)) {
482 if (chmod( name, dir_mode ) < 0)
486 param.mode = file_mode;
487 if (for_each_adouble("setfilmode_ads", name, ads_setfilmode_loop, ¶m, 0, v_umask) < 0)
490 if (!dir_rx_set(dir_mode)) {
491 if (chmod( name, dir_mode ) < 0)
498 static int RF_setfilmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
500 return ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_HF )), mode, st, vol->v_umask);
503 /* ------------------- */
504 static int RF_setdirunixmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
506 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
507 char ad_p[ MAXPATHLEN + 1];
508 int dropbox = vol->v_flags;
510 strlcpy(ad_p,ad_dir(adouble), MAXPATHLEN + 1);
512 if (dir_rx_set(mode)) {
515 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox, vol->v_umask) < 0)
518 /* .AppleDouble/.Parent */
519 if (stickydirmode(ad_p, DIRBITS | mode, dropbox, vol->v_umask) < 0)
523 if (ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0)
526 if (!dir_rx_set(mode)) {
527 if (stickydirmode(ad_p, DIRBITS | mode, dropbox, vol->v_umask) < 0)
529 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox, vol->v_umask) < 0)
535 /* ------------------- */
541 static int setdirmode_ads_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask)
544 struct dir_mode *param = data;
545 int ret = 0; /* 0 ignore error, -1 */
547 if (dir_rx_set(param->mode)) {
548 if (stickydirmode(name, DIRBITS | param->mode, param->dropbox, v_umask) < 0) {
555 if (ads_setfilmode(name, param->mode, NULL, v_umask) < 0)
558 if (!dir_rx_set(param->mode)) {
559 if (stickydirmode(name, DIRBITS | param->mode, param->dropbox, v_umask) < 0) {
569 static int RF_setdirmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st _U_)
571 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
572 char ad_p[ MAXPATHLEN + 1];
573 struct dir_mode param;
576 param.dropbox = vol->v_flags;
578 strlcpy(ad_p,ad_dir(adouble), sizeof(ad_p));
580 if (dir_rx_set(mode)) {
582 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox, vol->v_umask) < 0)
586 if (for_each_adouble("setdirmode_ads", ad_dir(ad_p), setdirmode_ads_loop, ¶m, vol_noadouble(vol), vol->v_umask))
589 if (!dir_rx_set(mode)) {
590 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox, vol->v_umask) < 0 )
596 /* ------------------- */
597 static int setdirowner_ads1_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
599 struct perm *owner = data;
601 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
602 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
603 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
604 /* return ( -1 ); Sometimes this is okay */
609 static int setdirowner_ads_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask _U_)
611 struct perm *owner = data;
613 if (for_each_adouble("setdirowner", name, setdirowner_ads1_loop, data, flag, 0) < 0)
616 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
617 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
618 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
619 /* return ( -1 ); Sometimes this is okay */
624 static int RF_setdirowner_ads(const struct vol *vol, const char *name, uid_t uid, gid_t gid)
626 int noadouble = vol_noadouble(vol);
627 char adouble_p[ MAXPATHLEN + 1];
634 strlcpy(adouble_p, ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR )), sizeof(adouble_p));
636 if (for_each_adouble("setdirowner", ad_dir(adouble_p), setdirowner_ads_loop, &owner, noadouble, 0))
640 * We cheat: we know that chown doesn't do anything.
642 if ( stat( ".AppleDouble", &st ) < 0) {
643 if (errno == ENOENT && noadouble)
645 LOG(log_error, logtype_afpd, "setdirowner: stat %s: %s", fullpathname(".AppleDouble"), strerror(errno) );
648 if ( gid && gid != st.st_gid && chown( ".AppleDouble", uid, gid ) < 0 && errno != EPERM ) {
649 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
650 uid, gid,fullpathname(".AppleDouble"), strerror(errno) );
651 /* return ( -1 ); Sometimes this is okay */
656 /* ------------------- */
657 static int RF_deletefile_ads(const struct vol *vol, const char *file )
659 char *ad_p = ad_dir(vol->vfs->ad_path(file, ADFLAGS_HF ));
661 return ads_delete_rf(ad_p);
664 /* --------------------------- */
665 int RF_renamefile_ads(const struct vol *vol, const char *src, const char *dst)
667 char adsrc[ MAXPATHLEN + 1];
670 strcpy( adsrc, ad_dir(vol->vfs->ad_path( src, 0 )));
671 if (unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) < 0) {
675 if (errno == ENOENT) {
678 if (stat(adsrc, &st)) /* source has no ressource fork, */
681 /* We are here because :
682 * -there's no dest folder.
683 * -there's no .AppleDouble in the dest folder.
684 * if we use the struct adouble passed in parameter it will not
685 * create .AppleDouble if the file is already opened, so we
686 * use a diff one, it's not a pb,ie it's not the same file, yet.
688 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
689 if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) {
690 ad_close(&ad, ADFLAGS_HF);
692 /* We must delete it */
693 RF_deletefile_ads(vol, dst );
694 if (!unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) )
699 else { /* it's something else, bail out */
711 /*************************************************************************
713 ************************************************************************/
714 static int validupath_osx(const struct vol *vol, const char *name)
716 return strncmp(name,"._", 2) && (
717 (vol->v_flags & AFPVOL_USEDOTS) ? netatalk_name(name): name[0] != '.');
720 /* ---------------- */
721 int RF_renamedir_osx(const struct vol *vol, const char *oldpath, const char *newpath)
723 /* We simply move the corresponding ad file as well */
724 char tempbuf[258]="._";
725 return rename(vol->vfs->ad_path(oldpath,0),strcat(tempbuf,newpath));
728 /* ---------------- */
729 int RF_deletecurdir_osx(const struct vol *vol)
731 return netatalk_unlink( vol->vfs->ad_path(".",0) );
734 /* ---------------- */
735 static int RF_setdirunixmode_osx(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
737 return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask);
740 /* ---------------- */
742 RF_setdirmode_osx(const struct vol *vol _U_, const char *name _U_, mode_t mode _U_, struct stat *st _U_)
747 /* ---------------- */
749 RF_setdirowner_osx(const struct vol *vol _U_, const char *path _U_, uid_t uid _U_, gid_t gid _U_)
754 /* ---------------- */
755 int RF_renamefile_osx(const struct vol *vol, const char *src, const char *dst)
757 char adsrc[ MAXPATHLEN + 1];
760 strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
762 if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
766 if (errno == ENOENT && stat(adsrc, &st)) /* source has no ressource fork, */
774 struct vfs_ops netatalk_adouble = {
775 /* ad_path: */ ad_path,
776 /* validupath: */ validupath_adouble,
777 /* rf_chown: */ RF_chown_adouble,
778 /* rf_renamedir: */ RF_renamedir_adouble,
779 /* rf_deletecurdir: */ RF_deletecurdir_adouble,
780 /* rf_setfilmode: */ RF_setfilmode_adouble,
781 /* rf_setdirmode: */ RF_setdirmode_adouble,
782 /* rf_setdirunixmode: */ RF_setdirunixmode_adouble,
783 /* rf_setdirowner: */ RF_setdirowner_adouble,
784 /* rf_deletefile: */ RF_deletefile_adouble,
785 /* rf_renamefile: */ RF_renamefile_adouble,
786 #ifdef HAVE_NFSv4_ACLS
787 /* rf_acl: */ RF_acl,
788 /* rf_remove_acl */ RF_remove_acl
792 struct vfs_ops netatalk_adouble_osx = {
793 /* ad_path: */ ad_path_osx,
794 /* validupath: */ validupath_osx,
795 /* rf_chown: */ RF_chown_adouble,
796 /* rf_renamedir: */ RF_renamedir_osx,
797 /* rf_deletecurdir: */ RF_deletecurdir_osx,
798 /* rf_setfilmode: */ RF_setfilmode_adouble,
799 /* rf_setdirmode: */ RF_setdirmode_osx,
800 /* rf_setdirunixmode:*/ RF_setdirunixmode_osx,
801 /* rf_setdirowner: */ RF_setdirowner_osx,
802 /* rf_deletefile: */ RF_deletefile_adouble,
803 /* rf_renamefile: */ RF_renamefile_osx,
806 /* samba sfm format. ad_path shouldn't be set her */
807 struct vfs_ops netatalk_adouble_sfm = {
808 /* ad_path: */ ad_path_sfm,
809 /* validupath: */ validupath_adouble,
810 /* rf_chown: */ RF_chown_ads,
811 /* rf_renamedir: */ RF_renamedir_adouble,
812 /* rf_deletecurdir: */ RF_deletecurdir_ads,
813 /* rf_setfilmode: */ RF_setfilmode_ads,
814 /* rf_setdirmode: */ RF_setdirmode_ads,
815 /* rf_setdirunixmode:*/ RF_setdirunixmode_ads,
816 /* rf_setdirowner: */ RF_setdirowner_ads,
817 /* rf_deletefile: */ RF_deletefile_ads,
818 /* rf_renamefile: */ RF_renamefile_ads,
821 /* ---------------- */
822 void initvol_vfs(struct vol *vol)
825 if (vol->v_adouble == AD_VERSION2_OSX) {
826 vol->vfs = &netatalk_adouble_osx;
828 else if (vol->v_adouble == AD_VERSION1_SFM) {
829 vol->vfs = &netatalk_adouble_sfm;
832 vol->vfs = &netatalk_adouble;
835 /* Extended Attributes */
836 if (vol->v_vfs_ea == AFPVOL_EA_SOLARIS) {
838 #ifdef HAVE_SOLARIS_EAS
839 LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with Solaris native EAs.");
841 netatalk_adouble.list_eas = sol_list_eas;
842 netatalk_adouble.get_easize = sol_get_easize;
843 netatalk_adouble.get_eacontent = sol_get_eacontent;
844 netatalk_adouble.set_ea = sol_set_ea;
845 netatalk_adouble.remove_ea = sol_remove_ea;
847 LOG(log_error, logtype_afpd, "initvol_vfs: Can't enable Solaris EA support.");
852 /* default: AFPVOL_EA_AD */
853 LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with adouble files.");
855 netatalk_adouble.set_ea = set_ea;
856 netatalk_adouble.list_eas = list_eas;
857 netatalk_adouble.get_easize = get_easize;
858 netatalk_adouble.get_eacontent = get_eacontent;
859 netatalk_adouble.remove_ea = remove_ea;