]> arthur.barton.de Git - netatalk.git/commitdiff
Add FCE to Makefile.am and fixes
authorFrank Lahm <franklahm@googlemail.com>
Tue, 24 May 2011 13:04:24 +0000 (15:04 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Tue, 24 May 2011 13:04:24 +0000 (15:04 +0200)
etc/afpd/.gitignore
etc/afpd/Makefile.am
etc/afpd/afp_options.c
etc/afpd/fce_api.c
etc/afpd/filedir.c

index add16d71cb657ed407fe0f06f7fdbbe8c83ba9eb..5d0c03fa85cb4a199ed3beead2cdc679b820512b 100644 (file)
@@ -1,6 +1,7 @@
 Makefile
 Makefile.in
 afpd
+fce
 hash
 test_parse_mtab
 .deps
index dd81a3f7e854021e52bb0ea8cb0c32e22ff53e1d..e1389dbcd4e77f24e30d5e4329ba0b2ede1385cd 100644 (file)
@@ -3,7 +3,7 @@
 pkgconfdir = @PKGCONFDIR@
 
 sbin_PROGRAMS = afpd
-noinst_PROGRAMS = hash
+noinst_PROGRAMS = hash fce
 
 afpd_SOURCES = \
        afp_asp.c \
@@ -23,6 +23,8 @@ afpd_SOURCES = \
        directory.c \
        enumerate.c \
        extattrs.c \
+       fce_api.c \
+       fce_util.c \
        file.c \
        filedir.c \
        fork.c \
@@ -68,10 +70,14 @@ afpd_SOURCES += acls.c
 endif
 
 
-noinst_HEADERS = auth.h afp_config.h desktop.h directory.h file.h \
+noinst_HEADERS = auth.h afp_config.h desktop.h directory.h fce_api.h fce_api_internal.h file.h \
         filedir.h fork.h globals.h icon.h mangle.h misc.h status.h switch.h \
         uam_auth.h uid.h unix.h volume.h hash.h acls.h acl_mappings.h extattrs.h \
         dircache.h afp_zeroconf.h afp_avahi.h
 
 hash_SOURCES = hash.c
 hash_CFLAGS = -DKAZLIB_TEST_MAIN -I$(top_srcdir)/include
+
+fce_SOURCES = fce_api.c fce_util.c
+fce_CFLAGS = -DFCE_TEST_MAIN -I$(top_srcdir)/include
+fce_LDADD = $(top_builddir)/libatalk/libatalk.la
index 9bb48042fa1e98ffdb5033edf70173995c310740..6fff02fd32c48a970c02745444011df9b5772109 100644 (file)
@@ -484,7 +484,7 @@ int afp_options_parseline(char *buf, struct afp_options *options)
                fce_add_udp_socket(c);
        }
        if ((c = getoption(buf, "-fcecoalesce"))) {
-               LOG(log_ote, logtype_afpd, "Fce coalesce: %s", c);
+               LOG(log_note, logtype_afpd, "Fce coalesce: %s", c);
                fce_set_coalesce(c);
        }
 
index 6443bf302c6c9484b0dbde85e8c2be1a12081f1d..aef6f1c426f2cc1bba2958f554996734b0009b8e 100755 (executable)
@@ -1,6 +1,4 @@
 /*\r
- * $Id: fce_api.c,v 0.01 2010-10-01 00:00:0 mw Exp $\r
- *\r
  * Copyright (c) 2010 Mark Williams\r
  *\r
  * File change event API for netatalk\r
@@ -406,17 +404,15 @@ int fce_register_new_file( struct path *path )
 int fce_register_file_modification( struct ofork *ofork )\r
 {\r
     char *u_name = NULL;\r
-    struct dir *dir;\r
     struct vol *vol;\r
     int ret = AFP_OK;\r
 \r
-    if (ofork == NULL || ofork->of_vol == NULL || ofork->of_dir == NULL)\r
+    if (ofork == NULL || ofork->of_vol == NULL)\r
         return AFPERR_PARAM;\r
 \r
     vol = ofork->of_vol;\r
-    dir = ofork->of_dir;\r
 \r
-    if (NULL == (u_name = mtoupath(vol, of_name(ofork), dir->d_did, utf8_encoding()))) \r
+    if (NULL == (u_name = mtoupath(vol, of_name(ofork), ofork->of_did, utf8_encoding()))) \r
     {\r
         return AFPERR_MISC;\r
     }\r
@@ -536,7 +532,7 @@ int main( int argc, char*argv[] )
         if (end_time && now >= end_time)\r
             break;\r
 \r
-        register_fce( path, event_code );\r
+        register_fce( path, 0, event_code );\r
         ev_cnt++;\r
 \r
         \r
index d3976119444440fbc07a8422b4c4c12c57bf043b..097ba114b9eaceeaf573f3b3b05c173838b14d2e 100644 (file)
@@ -602,16 +602,18 @@ int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size
 
     upath = s_path->u_name;
     if ( path_isadir( s_path) ) {
-        if (*s_path->m_name != '\0' || curdir->d_did == DIRDID_ROOT)
+        if (*s_path->m_name != '\0' || curdir->d_did == DIRDID_ROOT) {
             rc = AFPERR_ACCESS;
-    } else  {
-        /* we have to cache this, the structs are lost in deletcurdir*/
-        /* but we need the positive returncode to send our event */
-        char dname[256];
-        strncpy(dname,  curdir->d_u_name, 255 );
-        if ((rc = deletecurdir(vol)) == AFP_OK)
-            fce_register_delete_dir(dname);
-    }
+        } else {
+            /* we have to cache this, the structs are lost in deletcurdir*/
+            /* but we need the positive returncode to send our event */
+            bstring dname;
+            if ((dname = bstrcpy(curdir->d_u_name)) == NULL)
+                return AFPERR_MISC;
+            if ((rc = deletecurdir(vol)) == AFP_OK)
+                fce_register_delete_dir(cfrombstr(dname));
+            bdestroy(dname);
+        }
     } else if (of_findname(s_path)) {
         rc = AFPERR_BUSY;
     } else {
@@ -622,7 +624,7 @@ int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size
         if (s_path->st_valid && s_path->st_errno == ENOENT) {
             rc = AFPERR_NOOBJ;
         } else {
-            if ((rc = deletefile(vol, -1, upath, 1)) === AFP_OK)
+            if ((rc = deletefile(vol, -1, upath, 1)) == AFP_OK)
                                fce_register_delete_file( s_path );
 
             struct dir *cachedfile;