X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fofork.c;h=ed5f732814e7dd5d35ad2aa088c319a2f3d3d8e6;hp=a69a73c56c5de3d015f07858ea6d0e9b029ad3a9;hb=5116ed2346ea7ee6e5a9858dee94f3eacdc00d7e;hpb=954f1435c53be3c861e662d9a6699227c612de57 diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index a69a73c5..ed5f7328 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -26,6 +26,7 @@ #include "volume.h" #include "directory.h" #include "fork.h" +#include "fce_api.h" /* we need to have a hashed list of oforks (by dev inode). just hash * by first letter. */ @@ -272,7 +273,7 @@ int of_stat(struct path *path) } -#ifdef HAVE_RENAMEAT +#ifdef HAVE_ATFUNCS int of_fstatat(int dirfd, struct path *path) { int ret; @@ -285,7 +286,7 @@ int of_fstatat(int dirfd, struct path *path) return ret; } -#endif /* HAVE_RENAMEAT */ +#endif /* HAVE_ATFUNCS */ /* -------------------------- stat the current directory. @@ -365,7 +366,7 @@ struct ofork *of_findname(struct path *path) * @param dirfd (r) directory fd * @param path (rw) pointer to struct path */ -#ifdef HAVE_RENAMEAT +#ifdef HAVE_ATFUNCS struct ofork *of_findnameat(int dirfd, struct path *path) { struct ofork *of; @@ -439,6 +440,12 @@ int of_closefork(struct ofork *ofork) } } } + + /* Somone has used write_fork, we assume file was changed, register it to file change event api */ + if (ofork->of_flags & AFPFORK_MODIFIED) { + fce_register_file_modification(ofork); + } + ret = 0; if ( ad_close( ofork->of_ad, adflags ) < 0 ) { ret = -1; @@ -485,3 +492,23 @@ void of_closevol(const struct vol *vol) return; } +/* ---------------------- + close all forks for a volume +*/ +void of_close_all_forks(void) +{ + int refnum; + + if (!oforks) + return; + + for ( refnum = 0; refnum < nforks; refnum++ ) { + if (oforks[ refnum ] != NULL) { + if (of_closefork( oforks[ refnum ]) < 0 ) { + LOG(log_error, logtype_afpd, "of_close_all_forks: %s", strerror(errno) ); + } + } + } + return; +} +