From: franklahm <fra...@us...> - 2009-10-29 13:06:31
|
Update of /cvsroot/netatalk/netatalk/libatalk/vfs In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28702/libatalk/vfs Modified Files: ea.c ea_solaris.c vfs.c Log Message: Move VFS stack from _one_ global stack to per volume stack Index: ea.c =================================================================== RCS file: /cvsroot/netatalk/netatalk/libatalk/vfs/ea.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ea.c 25 Oct 2009 05:45:59 -0000 1.12 --- ea.c 29 Oct 2009 13:06:19 -0000 1.13 *************** *** 301,305 **** /* get name of a adouble file from uname */ ! adname = ea->vol->vfs->ad_path(ea->filename, (ea->ea_flags & EA_DIR) ? ADFLAGS_DIR : 0); /* copy it so we can work with it */ strlcpy(pathbuf, adname, MAXPATHLEN + 1); --- 301,305 ---- /* get name of a adouble file from uname */ ! adname = ea->vol->ad_path(ea->filename, (ea->ea_flags & EA_DIR) ? ADFLAGS_DIR : 0); /* copy it so we can work with it */ strlcpy(pathbuf, adname, MAXPATHLEN + 1); Index: ea_solaris.c =================================================================== RCS file: /cvsroot/netatalk/netatalk/libatalk/vfs/ea_solaris.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ea_solaris.c 26 Oct 2009 13:12:00 -0000 1.2 --- ea_solaris.c 29 Oct 2009 13:06:19 -0000 1.3 *************** *** 374,376 **** --- 374,377 ---- } + return AFP_OK; } Index: vfs.c =================================================================== RCS file: /cvsroot/netatalk/netatalk/libatalk/vfs/vfs.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** vfs.c 27 Oct 2009 12:35:23 -0000 1.10 --- vfs.c 29 Oct 2009 13:06:19 -0000 1.11 *************** *** 27,31 **** #include <atalk/afp.h> #include <atalk/adouble.h> - #include <atalk/vfs.h> #include <atalk/ea.h> #include <atalk/acl.h> --- 27,30 ---- *************** *** 33,36 **** --- 32,36 ---- #include <atalk/util.h> #include <atalk/volume.h> + #include <atalk/vfs.h> #include <atalk/directory.h> #include <atalk/unix.h> *************** *** 104,108 **** char *ad_p; ! ad_p = vol->vfs->ad_path(path, ADFLAGS_HF ); if ( stat( ad_p, &st ) < 0 ) --- 104,108 ---- char *ad_p; ! ad_p = vol->ad_path(path, ADFLAGS_HF ); if ( stat( ad_p, &st ) < 0 ) *************** *** 155,159 **** static int RF_setfilmode_adouble(VFS_FUNC_ARGS_SETFILEMODE) { ! return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_HF ), mode, st, vol->v_umask); } --- 155,159 ---- static int RF_setfilmode_adouble(VFS_FUNC_ARGS_SETFILEMODE) { ! return adouble_setfilmode(vol->ad_path(name, ADFLAGS_HF ), mode, st, vol->v_umask); } *************** *** 161,165 **** static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR ); int dropbox = vol->v_flags; --- 161,165 ---- static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! char *adouble = vol->ad_path(name, ADFLAGS_DIR ); int dropbox = vol->v_flags; *************** *** 169,173 **** } ! if (adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0) return -1; --- 169,173 ---- } ! if (adouble_setfilmode(vol->ad_path(name, ADFLAGS_DIR ), mode, st, vol->v_umask) < 0) return -1; *************** *** 202,206 **** int dropbox = vol->v_flags; mode_t hf_mode = ad_hf_mode(mode); ! char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR ); char *adouble_p = ad_dir(adouble); --- 202,206 ---- int dropbox = vol->v_flags; mode_t hf_mode = ad_hf_mode(mode); ! char *adouble = vol->ad_path(name, ADFLAGS_DIR ); char *adouble_p = ad_dir(adouble); *************** *** 243,247 **** owner.gid = gid; ! adouble_p = ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR )); if (for_each_adouble("setdirowner", adouble_p, setdirowner_adouble_loop, &owner, noadouble, vol->v_umask)) --- 243,247 ---- owner.gid = gid; ! 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)) *************** *** 268,272 **** static int RF_deletefile_adouble(VFS_FUNC_ARGS_DELETEFILE) { ! return netatalk_unlink(vol->vfs->ad_path( file, ADFLAGS_HF)); } --- 268,272 ---- static int RF_deletefile_adouble(VFS_FUNC_ARGS_DELETEFILE) { ! return netatalk_unlink(vol->ad_path(file, ADFLAGS_HF)); } *************** *** 277,282 **** int err = 0; ! strcpy( adsrc, vol->vfs->ad_path( src, 0 )); ! if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) { struct stat st; --- 277,282 ---- int err = 0; ! strcpy( adsrc, vol->ad_path(src, 0 )); ! if (unix_rename( adsrc, vol->ad_path(dst, 0 )) < 0) { struct stat st; *************** *** 298,302 **** 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 )) ) err = 0; else --- 298,302 ---- if (!ad_open(dst, ADFLAGS_HF, O_RDWR | O_CREAT, 0666, &ad)) { ad_close(&ad, ADFLAGS_HF); ! if (!unix_rename( adsrc, vol->ad_path(dst, 0 )) ) err = 0; else *************** *** 390,394 **** ! ad_p = ad_dir(vol->vfs->ad_path(path, ADFLAGS_HF )); if ( stat( ad_p, &st ) < 0 ) { --- 390,394 ---- ! ad_p = ad_dir(vol->ad_path(path, ADFLAGS_HF )); if ( stat( ad_p, &st ) < 0 ) { *************** *** 495,499 **** 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); } --- 495,499 ---- static int RF_setfilmode_ads(VFS_FUNC_ARGS_SETFILEMODE) { ! return ads_setfilmode(ad_dir(vol->ad_path(name, ADFLAGS_HF )), mode, st, vol->v_umask); } *************** *** 501,505 **** static int RF_setdirunixmode_ads(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR ); char ad_p[ MAXPATHLEN + 1]; int dropbox = vol->v_flags; --- 501,505 ---- static int RF_setdirunixmode_ads(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! char *adouble = vol->ad_path(name, ADFLAGS_DIR ); char ad_p[ MAXPATHLEN + 1]; int dropbox = vol->v_flags; *************** *** 518,522 **** } ! if (ads_setfilmode(ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0) return -1; --- 518,522 ---- } ! if (ads_setfilmode(ad_dir(vol->ad_path(name, ADFLAGS_DIR)), mode, st, vol->v_umask) < 0) return -1; *************** *** 566,570 **** static int RF_setdirmode_ads(VFS_FUNC_ARGS_SETDIRMODE) { ! char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR ); char ad_p[ MAXPATHLEN + 1]; struct dir_mode param; --- 566,570 ---- static int RF_setdirmode_ads(VFS_FUNC_ARGS_SETDIRMODE) { ! char *adouble = vol->ad_path(name, ADFLAGS_DIR ); char ad_p[ MAXPATHLEN + 1]; struct dir_mode param; *************** *** 629,633 **** owner.gid = gid; ! strlcpy(adouble_p, ad_dir(vol->vfs->ad_path( name, ADFLAGS_DIR )), sizeof(adouble_p)); if (for_each_adouble("setdirowner", ad_dir(adouble_p), setdirowner_ads_loop, &owner, noadouble, 0)) --- 629,633 ---- owner.gid = gid; ! 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)) *************** *** 654,658 **** static int RF_deletefile_ads(VFS_FUNC_ARGS_DELETEFILE) { ! char *ad_p = ad_dir(vol->vfs->ad_path(file, ADFLAGS_HF )); return ads_delete_rf(ad_p); --- 654,658 ---- static int RF_deletefile_ads(VFS_FUNC_ARGS_DELETEFILE) { ! char *ad_p = ad_dir(vol->ad_path(file, ADFLAGS_HF )); return ads_delete_rf(ad_p); *************** *** 665,670 **** 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) { struct stat st; --- 665,670 ---- int err = 0; ! strcpy( adsrc, ad_dir(vol->ad_path(src, 0 ))); ! if (unix_rename( adsrc, ad_dir(vol->ad_path(dst, 0 ))) < 0) { struct stat st; *************** *** 689,693 **** /* We must delete it */ RF_deletefile_ads(vol, dst ); ! if (!unix_rename( adsrc, ad_dir(vol->vfs->ad_path( dst, 0 ))) ) err = 0; else --- 689,693 ---- /* We must delete it */ RF_deletefile_ads(vol, dst ); ! if (!unix_rename( adsrc, ad_dir(vol->ad_path(dst, 0 ))) ) err = 0; else *************** *** 720,724 **** /* We simply move the corresponding ad file as well */ char tempbuf[258]="._"; ! return rename(vol->vfs->ad_path(oldpath,0),strcat(tempbuf,newpath)); } --- 720,724 ---- /* We simply move the corresponding ad file as well */ char tempbuf[258]="._"; ! return rename(vol->ad_path(oldpath,0),strcat(tempbuf,newpath)); } *************** *** 726,730 **** static int RF_deletecurdir_osx(VFS_FUNC_ARGS_DELETECURDIR) { ! return netatalk_unlink( vol->vfs->ad_path(".",0) ); } --- 726,730 ---- static int RF_deletecurdir_osx(VFS_FUNC_ARGS_DELETECURDIR) { ! return netatalk_unlink( vol->ad_path(".",0) ); } *************** *** 732,736 **** static int RF_setdirunixmode_osx(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! return adouble_setfilmode(vol->vfs->ad_path( name, ADFLAGS_DIR ), mode, st, vol->v_umask); } --- 732,736 ---- static int RF_setdirunixmode_osx(VFS_FUNC_ARGS_SETDIRUNIXMODE) { ! return adouble_setfilmode(vol->ad_path(name, ADFLAGS_DIR ), mode, st, vol->v_umask); } *************** *** 753,759 **** int err = 0; ! strcpy( adsrc, vol->vfs->ad_path( src, 0 )); ! if (unix_rename( adsrc, vol->vfs->ad_path( dst, 0 )) < 0) { struct stat st; --- 753,759 ---- int err = 0; ! strcpy( adsrc, vol->ad_path(src, 0 )); ! if (unix_rename( adsrc, vol->ad_path(dst, 0 )) < 0) { struct stat st; *************** *** 781,802 **** /* - * 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); \ if ((ret == AFP_OK) && (err != AFP_OK)) \ ret = err; \ --- 781,796 ---- /* * 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 (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; \ *************** *** 825,836 **** 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); } --- 819,825 ---- VFS_MFUNC(ea_remove, VFS_FUNC_ARGS_EA_REMOVE, VFS_FUNC_VARS_EA_REMOVE) static int vfs_validupath(VFS_FUNC_ARGS_VALIDUPATH) { ! return vol->vfs_modules[0]->vfs_validupath(VFS_FUNC_VARS_VALIDUPATH); } *************** *** 840,844 **** */ static struct vfs_ops vfs_master_funcs = { - vfs_path, vfs_validupath, vfs_chown, --- 829,832 ---- *************** *** 866,870 **** static struct vfs_ops netatalk_adouble = { - /* vfs_path: */ ad_path, /* vfs_validupath: */ validupath_adouble, /* vfs_chown: */ RF_chown_adouble, --- 854,857 ---- *************** *** 881,885 **** static struct vfs_ops netatalk_adouble_osx = { - /* vfs_path: */ ad_path_osx, /* vfs_validupath: */ validupath_osx, /* vfs_chown: */ RF_chown_adouble, --- 868,871 ---- *************** *** 897,901 **** /* 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, --- 883,886 ---- *************** *** 916,920 **** static struct vfs_ops netatalk_ea_adouble = { - /* vfs_path: */ NULL, /* vfs_validupath: */ NULL, /* vfs_chown: */ ea_chown, --- 901,904 ---- *************** *** 939,943 **** #ifdef HAVE_SOLARIS_EAS static struct vfs_ops netatalk_ea_solaris = { - /* ad_path: */ NULL, /* validupath: */ NULL, /* rf_chown: */ NULL, --- 923,926 ---- *************** *** 967,971 **** #ifdef HAVE_NFSv4_ACLS static struct vfs_ops netatalk_solaris_acl_adouble = { - /* ad_path: */ NULL, /* validupath: */ NULL, /* rf_chown: */ NULL, --- 950,953 ---- *************** *** 992,1002 **** /* Default adouble stuff */ if (vol->v_adouble == AD_VERSION2_OSX) { ! vfs[0] = &netatalk_adouble_osx; } else if (vol->v_adouble == AD_VERSION1_SFM) { ! vfs[0] = &netatalk_adouble_sfm; } else { ! vfs[0] = &netatalk_adouble; } --- 974,984 ---- /* Default adouble stuff */ if (vol->v_adouble == AD_VERSION2_OSX) { ! vol->vfs_modules[0] = &netatalk_adouble_osx; } else if (vol->v_adouble == AD_VERSION1_SFM) { ! vol->vfs_modules[0] = &netatalk_adouble_sfm; } else { ! vol->vfs_modules[0] = &netatalk_adouble; } *************** *** 1006,1010 **** #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."); --- 988,992 ---- #ifdef HAVE_SOLARIS_EAS LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with Solaris native EAs."); ! vol->vfs_modules[1] = &netatalk_ea_solaris; #else LOG(log_error, logtype_afpd, "initvol_vfs: Can't enable Solaris EA support."); *************** *** 1015,1024 **** /* default: AFPVOL_EA_AD */ LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with adouble files."); ! vfs[1] = &netatalk_ea_adouble; } /* ACLs */ #ifdef HAVE_NFSv4_ACLS ! vfs[2] = &netatalk_solaris_acl_adouble; #endif } --- 997,1006 ---- /* default: AFPVOL_EA_AD */ LOG(log_debug, logtype_afpd, "initvol_vfs: Enabling EA support with adouble files."); ! vol->vfs_modules[1] = &netatalk_ea_adouble; } /* ACLs */ #ifdef HAVE_NFSv4_ACLS ! vol->vfs_modules[2] = &netatalk_solaris_acl_adouble; #endif } |