X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fofork.c;h=c4901285c9e9d248692d7841cc546e986321fa55;hb=4054f4b3c85ecab060dafd46c0d3632cadbb5803;hp=f5f8a38de8d7fff65a380ac83674fe9c755c190a;hpb=b31a12f311cea4c63dcda4ca4199988bc15f3490;p=netatalk.git diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index f5f8a38d..c4901285 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -1,6 +1,4 @@ /* - * $Id: ofork.c,v 1.32 2010/03/12 15:16:49 franklahm Exp $ - * * Copyright (c) 1996 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. */ @@ -23,6 +21,7 @@ #include #include #include +#include #include "globals.h" #include "volume.h" @@ -213,7 +212,7 @@ of_alloc(struct vol *vol, ad_open really does reinitialize the structure. */ ad_init(ad, vol->v_adouble, vol->v_ad_options); - ad->ad_m_namelen = 255 +1; + ad->ad_m_namelen = UTF8FILELEN_EARLY +1; /* here's the deal: we allocate enough for the standard mac file length. * in the future, we'll reallocate in fairly large jumps in case * of long unicode names */ @@ -274,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; @@ -287,7 +286,7 @@ int of_fstatat(int dirfd, struct path *path) return ret; } -#endif /* HAVE_RENAMEAT */ +#endif /* HAVE_ATFUNCS */ /* -------------------------- stat the current directory. @@ -367,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; @@ -441,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; @@ -487,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; +} +