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>
34 #ifdef HAVE_NFSv4_ACLS
35 extern int remove_acl(const char *name);
43 typedef int (*rf_loop)(struct dirent *, char *, void *, int , mode_t );
45 /* ----------------------------- */
47 for_each_adouble(const char *from, const char *name, rf_loop fn, void *data, int flag, mode_t v_umask)
49 char buf[ MAXPATHLEN + 1];
56 if (NULL == ( dp = opendir( name)) ) {
58 LOG(log_error, logtype_afpd, "%s: opendir %s: %s", from, fullpathname(name),strerror(errno) );
63 strlcpy( buf, name, sizeof(buf));
64 strlcat( buf, "/", sizeof(buf) );
65 m = strchr( buf, '\0' );
67 while ((de = readdir(dp))) {
68 if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
72 strlcat(buf, de->d_name, sizeof(buf));
73 if (fn && (ret = fn(de, buf, data, flag, v_umask))) {
83 /*******************************************************************************
84 * classic adouble format
85 *******************************************************************************/
87 static int netatalk_name(const char *name)
89 return strcasecmp(name,".AppleDB") &&
90 strcasecmp(name,".AppleDouble") &&
91 strcasecmp(name,".AppleDesktop");
94 static int validupath_adouble(const struct vol *vol, const char *name)
96 return (vol->v_flags & AFPVOL_USEDOTS) ?
97 netatalk_name(name) && strcasecmp(name,".Parent"): name[0] != '.';
100 /* ----------------- */
101 static int RF_chown_adouble(const struct vol *vol, const char *path, uid_t uid, gid_t gid)
107 ad_p = vol->vfs->ad_path(path, ADFLAGS_HF );
109 if ( stat( ad_p, &st ) < 0 )
110 return 0; /* ignore */
112 return chown( ad_p, uid, gid );
115 /* ----------------- */
116 int RF_renamedir_adouble(const struct vol *vol _U_, const char *oldpath _U_, const char *newpath _U_)
121 /* ----------------- */
122 static int deletecurdir_adouble_loop(struct dirent *de, char *name, void *data _U_, int flag _U_, mode_t v_umask)
127 /* bail if the file exists in the current directory.
128 * note: this will not fail with dangling symlinks */
130 if (stat(de->d_name, &st) == 0)
131 return AFPERR_DIRNEMPT;
133 if ((err = netatalk_unlink(name)))
139 static int RF_deletecurdir_adouble(const struct vol *vol)
143 /* delete stray .AppleDouble files. this happens to get .Parent files
145 if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_adouble_loop, NULL, 1, vol->v_umask)))
147 return netatalk_rmdir( ".AppleDouble" );
150 /* ----------------- */
151 static int adouble_setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask)
153 return setfilmode(name, ad_hf_mode(mode), st, v_umask);
156 static int RF_setfilmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
158 return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_HF ), mode, st, vol->v_umask);
161 /* ----------------- */
162 static int RF_setdirunixmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
164 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
165 int dropbox = vol->v_flags;
167 if (dir_rx_set(mode)) {
168 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 )
172 if (adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0)
175 if (!dir_rx_set(mode)) {
176 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 )
182 /* ----------------- */
183 static int setdirmode_adouble_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask)
185 mode_t hf_mode = *(mode_t *)data;
188 if ( stat( name, &st ) < 0 ) {
191 LOG(log_error, logtype_afpd, "setdirmode: stat %s: %s", name, strerror(errno) );
193 else if (!S_ISDIR(st.st_mode)) {
194 if (setfilmode(name, hf_mode , &st, v_umask) < 0) {
195 /* FIXME what do we do then? */
201 static int RF_setdirmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st _U_)
203 int dropbox = vol->v_flags;
204 mode_t hf_mode = ad_hf_mode(mode);
205 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
206 char *adouble_p = ad_dir(adouble);
208 if (dir_rx_set(mode)) {
209 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0)
213 if (for_each_adouble("setdirmode", adouble_p, setdirmode_adouble_loop, &hf_mode, vol_noadouble(vol), vol->v_umask))
216 if (!dir_rx_set(mode)) {
217 if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0)
223 /* ----------------- */
224 static int setdirowner_adouble_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
226 struct perm *owner = data;
228 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
229 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
230 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
231 /* return ( -1 ); Sometimes this is okay */
236 static int RF_setdirowner_adouble(const struct vol *vol, const char *name, uid_t uid, gid_t gid)
239 int noadouble = vol_noadouble(vol);
247 adouble_p = ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR ));
249 if (for_each_adouble("setdirowner", adouble_p, setdirowner_adouble_loop, &owner, noadouble, vol->v_umask))
253 * We cheat: we know that chown doesn't do anything.
255 if ( stat( ".AppleDouble", &st ) < 0) {
256 if (errno == ENOENT && noadouble)
258 LOG(log_error, logtype_afpd, "setdirowner: stat %s: %s", fullpathname(".AppleDouble"), strerror(errno) );
261 if ( gid && gid != st.st_gid && chown( ".AppleDouble", uid, gid ) < 0 && errno != EPERM ) {
262 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
263 uid, gid,fullpathname(".AppleDouble"), strerror(errno) );
264 /* return ( -1 ); Sometimes this is okay */
269 /* ----------------- */
270 static int RF_deletefile_adouble(const struct vol *vol, const char *file )
272 return netatalk_unlink(vol->vfs->ad_path( file, ADFLAGS_HF));
275 /* ----------------- */
276 int RF_renamefile_adouble(const struct vol *vol, const char *src, const char *dst)
278 char adsrc[ MAXPATHLEN + 1];
281 strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
282 if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
286 if (errno == ENOENT) {
289 if (stat(adsrc, &st)) /* source has no ressource fork, */
292 /* We are here because :
293 * -there's no dest folder.
294 * -there's no .AppleDouble in the dest folder.
295 * if we use the struct adouble passed in parameter it will not
296 * create .AppleDouble if the file is already opened, so we
297 * use a diff one, it's not a pb,ie it's not the same file, yet.
299 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
300 if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) {
301 ad_close(&ad, ADFLAGS_HF);
302 if (!unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) )
307 else { /* it's something else, bail out */
319 #ifdef HAVE_NFSv4_ACLS
320 static int RF_acl(const struct vol *vol, const char *path, int cmd, int count, ace_t *aces)
322 static char buf[ MAXPATHLEN + 1];
325 if ((stat(path, &st)) != 0)
327 if (S_ISDIR(st.st_mode)) {
328 if ((snprintf(buf, MAXPATHLEN, "%s/.AppleDouble",path)) < 0)
330 /* set acl on .AppleDouble dir first */
331 if ((acl(buf, cmd, count, aces)) != 0)
333 /* now set ACL on ressource fork */
334 if ((acl(vol->vfs->ad_path(path, ADFLAGS_DIR), cmd, count, aces)) != 0)
337 /* set ACL on ressource fork */
338 if ((acl(vol->vfs->ad_path(path, ADFLAGS_HF), cmd, count, aces)) != 0)
344 static int RF_remove_acl(const struct vol *vol, const char *path, int dir)
347 static char buf[ MAXPATHLEN + 1];
350 if ((snprintf(buf, MAXPATHLEN, "%s/.AppleDouble",path)) < 0)
352 /* remove ACL from .AppleDouble/.Parent first */
353 if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_DIR))) != AFP_OK)
355 /* now remove from .AppleDouble dir */
356 if ((ret = remove_acl(buf)) != AFP_OK)
359 /* remove ACL from ressource fork */
360 if ((ret = remove_acl(vol->vfs->ad_path(path, ADFLAGS_HF))) != AFP_OK)
367 /*********************************************************************************
369 *********************************************************************************/
370 static int ads_chown_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
372 struct perm *owner = data;
374 if (chown( name , owner->uid, owner->gid ) < 0) {
380 static int RF_chown_ads(const struct vol *vol, const char *path, uid_t uid, gid_t gid)
391 ad_p = ad_dir(vol->vfs->ad_path(path, ADFLAGS_HF ));
393 if ( stat( ad_p, &st ) < 0 ) {
398 if (chown( ad_p, uid, gid ) < 0) {
401 return for_each_adouble("chown_ads", ad_p, ads_chown_loop, &owner, 1, vol->v_umask);
404 /* --------------------------------- */
405 static int deletecurdir_ads1_loop(struct dirent *de _U_, char *name, void *data _U_, int flag _U_, mode_t v_umask _U_)
407 return netatalk_unlink(name);
410 static int ads_delete_rf(char *name)
414 if ((err = for_each_adouble("deletecurdir", name, deletecurdir_ads1_loop, NULL, 1, 0)))
417 * it's a problem for a nfs mounted folder, there's .nfsxxx around
418 * for linux the following line solve it.
419 * but it could fail if rm .nfsxxx create a new .nfsyyy :(
421 if ((err = for_each_adouble("deletecurdir", name, deletecurdir_ads1_loop, NULL, 1, 0)))
423 return netatalk_rmdir(name);
426 static int deletecurdir_ads_loop(struct dirent *de, char *name, void *data _U_, int flag _U_, mode_t v_umask _U_)
430 /* bail if the file exists in the current directory.
431 * note: this will not fail with dangling symlinks */
433 if (stat(de->d_name, &st) == 0) {
434 return AFPERR_DIRNEMPT;
436 return ads_delete_rf(name);
439 static int RF_deletecurdir_ads(const struct vol *vol _U_)
443 /* delete stray .AppleDouble files. this happens to get .Parent files as well. */
444 if ((err = for_each_adouble("deletecurdir", ".AppleDouble", deletecurdir_ads_loop, NULL, 1, 0)))
446 return netatalk_rmdir( ".AppleDouble" );
449 /* ------------------- */
455 static int ads_setfilmode_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask)
457 struct set_mode *param = data;
459 return setfilmode(name, param->mode, param->st, v_umask);
462 static int ads_setfilmode(const char * name, mode_t mode, struct stat *st, mode_t v_umask)
464 mode_t file_mode = ad_hf_mode(mode);
465 mode_t dir_mode = file_mode;
466 struct set_mode param;
468 if ((dir_mode & (S_IRUSR | S_IWUSR )))
470 if ((dir_mode & (S_IRGRP | S_IWGRP )))
472 if ((dir_mode & (S_IROTH | S_IWOTH )))
477 if (dir_rx_set(dir_mode)) {
478 if (chmod( name, dir_mode ) < 0)
482 param.mode = file_mode;
483 if (for_each_adouble("setfilmode_ads", name, ads_setfilmode_loop, ¶m, 0, v_umask) < 0)
486 if (!dir_rx_set(dir_mode)) {
487 if (chmod( name, dir_mode ) < 0)
494 static int RF_setfilmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
496 return ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_HF )), mode, st, vol->v_umask);
499 /* ------------------- */
500 static int RF_setdirunixmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
502 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
503 char ad_p[ MAXPATHLEN + 1];
504 int dropbox = vol->v_flags;
506 strlcpy(ad_p,ad_dir(adouble), MAXPATHLEN + 1);
508 if (dir_rx_set(mode)) {
511 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox, vol->v_umask) < 0)
514 /* .AppleDouble/.Parent */
515 if (stickydirmode(ad_p, DIRBITS | mode, dropbox, vol->v_umask) < 0)
519 if (ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0)
522 if (!dir_rx_set(mode)) {
523 if (stickydirmode(ad_p, DIRBITS | mode, dropbox, vol->v_umask) < 0)
525 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox, vol->v_umask) < 0)
531 /* ------------------- */
537 static int setdirmode_ads_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask)
540 struct dir_mode *param = data;
541 int ret = 0; /* 0 ignore error, -1 */
543 if (dir_rx_set(param->mode)) {
544 if (stickydirmode(name, DIRBITS | param->mode, param->dropbox, v_umask) < 0) {
551 if (ads_setfilmode(name, param->mode, NULL, v_umask) < 0)
554 if (!dir_rx_set(param->mode)) {
555 if (stickydirmode(name, DIRBITS | param->mode, param->dropbox, v_umask) < 0) {
565 static int RF_setdirmode_ads(const struct vol *vol, const char * name, mode_t mode, struct stat *st _U_)
567 char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
568 char ad_p[ MAXPATHLEN + 1];
569 struct dir_mode param;
572 param.dropbox = vol->v_flags;
574 strlcpy(ad_p,ad_dir(adouble), sizeof(ad_p));
576 if (dir_rx_set(mode)) {
578 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox, vol->v_umask) < 0)
582 if (for_each_adouble("setdirmode_ads", ad_dir(ad_p), setdirmode_ads_loop, ¶m, vol_noadouble(vol), vol->v_umask))
585 if (!dir_rx_set(mode)) {
586 if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox, vol->v_umask) < 0 )
592 /* ------------------- */
593 static int setdirowner_ads1_loop(struct dirent *de _U_, char *name, void *data, int flag _U_, mode_t v_umask _U_)
595 struct perm *owner = data;
597 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
598 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
599 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
600 /* return ( -1 ); Sometimes this is okay */
605 static int setdirowner_ads_loop(struct dirent *de _U_, char *name, void *data, int flag, mode_t v_umask _U_)
607 struct perm *owner = data;
609 if (for_each_adouble("setdirowner", name, setdirowner_ads1_loop, data, flag, 0) < 0)
612 if ( chown( name, owner->uid, owner->gid ) < 0 && errno != EPERM ) {
613 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
614 owner->uid, owner->gid, fullpathname(name), strerror(errno) );
615 /* return ( -1 ); Sometimes this is okay */
620 static int RF_setdirowner_ads(const struct vol *vol, const char *name, uid_t uid, gid_t gid)
622 int noadouble = vol_noadouble(vol);
623 char adouble_p[ MAXPATHLEN + 1];
630 strlcpy(adouble_p, ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR )), sizeof(adouble_p));
632 if (for_each_adouble("setdirowner", ad_dir(adouble_p), setdirowner_ads_loop, &owner, noadouble, 0))
636 * We cheat: we know that chown doesn't do anything.
638 if ( stat( ".AppleDouble", &st ) < 0) {
639 if (errno == ENOENT && noadouble)
641 LOG(log_error, logtype_afpd, "setdirowner: stat %s: %s", fullpathname(".AppleDouble"), strerror(errno) );
644 if ( gid && gid != st.st_gid && chown( ".AppleDouble", uid, gid ) < 0 && errno != EPERM ) {
645 LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
646 uid, gid,fullpathname(".AppleDouble"), strerror(errno) );
647 /* return ( -1 ); Sometimes this is okay */
652 /* ------------------- */
653 static int RF_deletefile_ads(const struct vol *vol, const char *file )
655 char *ad_p = ad_dir(vol->vfs->ad_path(file, ADFLAGS_HF ));
657 return ads_delete_rf(ad_p);
660 /* --------------------------- */
661 int RF_renamefile_ads(const struct vol *vol, const char *src, const char *dst)
663 char adsrc[ MAXPATHLEN + 1];
666 strcpy( adsrc, ad_dir(vol->vfs->ad_path( src, 0 )));
667 if (unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) < 0) {
671 if (errno == ENOENT) {
674 if (stat(adsrc, &st)) /* source has no ressource fork, */
677 /* We are here because :
678 * -there's no dest folder.
679 * -there's no .AppleDouble in the dest folder.
680 * if we use the struct adouble passed in parameter it will not
681 * create .AppleDouble if the file is already opened, so we
682 * use a diff one, it's not a pb,ie it's not the same file, yet.
684 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
685 if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) {
686 ad_close(&ad, ADFLAGS_HF);
688 /* We must delete it */
689 RF_deletefile_ads(vol, dst );
690 if (!unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) )
695 else { /* it's something else, bail out */
707 /*************************************************************************
709 ************************************************************************/
710 static int validupath_osx(const struct vol *vol, const char *name)
712 return strncmp(name,"._", 2) && (
713 (vol->v_flags & AFPVOL_USEDOTS) ? netatalk_name(name): name[0] != '.');
716 /* ---------------- */
717 int RF_renamedir_osx(const struct vol *vol, const char *oldpath, const char *newpath)
719 /* We simply move the corresponding ad file as well */
720 char tempbuf[258]="._";
721 return rename(vol->vfs->ad_path(oldpath,0),strcat(tempbuf,newpath));
724 /* ---------------- */
725 int RF_deletecurdir_osx(const struct vol *vol)
727 return netatalk_unlink( vol->vfs->ad_path(".",0) );
730 /* ---------------- */
731 static int RF_setdirunixmode_osx(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
733 return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask);
736 /* ---------------- */
738 RF_setdirmode_osx(const struct vol *vol _U_, const char *name _U_, mode_t mode _U_, struct stat *st _U_)
743 /* ---------------- */
745 RF_setdirowner_osx(const struct vol *vol _U_, const char *path _U_, uid_t uid _U_, gid_t gid _U_)
750 /* ---------------- */
751 int RF_renamefile_osx(const struct vol *vol, const char *src, const char *dst)
753 char adsrc[ MAXPATHLEN + 1];
756 strcpy( adsrc, vol->vfs->ad_path( src, 0 ));
758 if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) {
762 if (errno == ENOENT && stat(adsrc, &st)) /* source has no ressource fork, */
770 struct vfs_ops netatalk_adouble = {
771 /* ad_path: */ ad_path,
772 /* validupath: */ validupath_adouble,
773 /* rf_chown: */ RF_chown_adouble,
774 /* rf_renamedir: */ RF_renamedir_adouble,
775 /* rf_deletecurdir: */ RF_deletecurdir_adouble,
776 /* rf_setfilmode: */ RF_setfilmode_adouble,
777 /* rf_setdirmode: */ RF_setdirmode_adouble,
778 /* rf_setdirunixmode: */ RF_setdirunixmode_adouble,
779 /* rf_setdirowner: */ RF_setdirowner_adouble,
780 /* rf_deletefile: */ RF_deletefile_adouble,
781 /* rf_renamefile: */ RF_renamefile_adouble,
782 #ifdef HAVE_NFSv4_ACLS
783 /* rf_acl: */ RF_acl,
784 /* rf_remove_acl */ RF_remove_acl
788 struct vfs_ops netatalk_adouble_osx = {
789 /* ad_path: */ ad_path_osx,
790 /* validupath: */ validupath_osx,
791 /* rf_chown: */ RF_chown_adouble,
792 /* rf_renamedir: */ RF_renamedir_osx,
793 /* rf_deletecurdir: */ RF_deletecurdir_osx,
794 /* rf_setfilmode: */ RF_setfilmode_adouble,
795 /* rf_setdirmode: */ RF_setdirmode_osx,
796 /* rf_setdirunixmode:*/ RF_setdirunixmode_osx,
797 /* rf_setdirowner: */ RF_setdirowner_osx,
798 /* rf_deletefile: */ RF_deletefile_adouble,
799 /* rf_renamefile: */ RF_renamefile_osx,
802 /* samba sfm format. ad_path shouldn't be set her */
803 struct vfs_ops netatalk_adouble_sfm = {
804 /* ad_path: */ ad_path_sfm,
805 /* validupath: */ validupath_adouble,
806 /* rf_chown: */ RF_chown_ads,
807 /* rf_renamedir: */ RF_renamedir_adouble,
808 /* rf_deletecurdir: */ RF_deletecurdir_ads,
809 /* rf_setfilmode: */ RF_setfilmode_ads,
810 /* rf_setdirmode: */ RF_setdirmode_ads,
811 /* rf_setdirunixmode:*/ RF_setdirunixmode_ads,
812 /* rf_setdirowner: */ RF_setdirowner_ads,
813 /* rf_deletefile: */ RF_deletefile_ads,
814 /* rf_renamefile: */ RF_renamefile_ads,
817 /* ---------------- */
818 void initvol_vfs(struct vol *vol)
821 if (vol->v_adouble == AD_VERSION2_OSX) {
822 vol->vfs = &netatalk_adouble_osx;
824 else if (vol->v_adouble == AD_VERSION1_SFM) {
825 vol->vfs = &netatalk_adouble_sfm;
828 vol->vfs = &netatalk_adouble;
831 /* Extended Attributes */
832 if (vol->v_vfs_ea == AFPVOL_EA_SOLARIS) {
834 #ifdef HAVE_SOLARIS_EAS
835 LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with Solaris native EAs.");
837 netatalk_adouble.list_eas = sol_list_eas;
838 netatalk_adouble.get_easize = sol_get_easize;
839 netatalk_adouble.get_eacontent = sol_get_eacontent;
840 netatalk_adouble.set_ea = sol_set_ea;
841 netatalk_adouble.remove_ea = sol_remove_ea;
843 LOG(log_error, logtype_afpd, "initvol_vfs: Can't enable Solaris EA support.");
848 /* default: AFPVOL_EA_AD */
849 LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with adouble files.");
851 netatalk_adouble.set_ea = set_ea;
852 netatalk_adouble.list_eas = list_eas;
853 netatalk_adouble.get_easize = get_easize;
854 netatalk_adouble.get_eacontent = get_eacontent;
855 netatalk_adouble.remove_ea = remove_ea;