]> arthur.barton.de Git - netatalk.git/commitdiff
Add FPSyncFork, set command 76 to afp_null, move everything from switch.c to auth.c
authorfranklahm <franklahm>
Wed, 25 Feb 2009 16:14:08 +0000 (16:14 +0000)
committerfranklahm <franklahm>
Wed, 25 Feb 2009 16:14:08 +0000 (16:14 +0000)
etc/afpd/auth.c
etc/afpd/fork.c
etc/afpd/fork.h
etc/afpd/switch.c

index 35878b889d73f02959adb53c5722a773f5b8d7a6..398eee2e6e371f4cf339d934aa86a53fe13015f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth.c,v 1.56 2009-02-16 13:49:20 franklahm Exp $
+ * $Id: auth.c,v 1.57 2009-02-25 16:14:08 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -206,7 +206,10 @@ static int set_auth_switch(int expired)
            uam_afpserver_action(72, UAM_AFPSERVER_POSTAUTH, afp_listextattr, NULL);
 #endif
         case 31:
-           uam_afpserver_action(AFP_ENUMERATE_EXT2, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext2, NULL); 
+           uam_afpserver_action(AFP_ENUMERATE_EXT2, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext2, NULL);
+           uam_afpserver_action(76, UAM_AFPSERVER_POSTAUTH, afp_null, NULL);
+           uam_afpserver_action(78, UAM_AFPSERVER_POSTAUTH, afp_syncdir, NULL);
+           uam_afpserver_action(79, UAM_AFPSERVER_POSTAUTH, afp_syncfork, NULL);
         case 30:
            uam_afpserver_action(AFP_ENUMERATE_EXT, UAM_AFPSERVER_POSTAUTH, afp_enumerate_ext, NULL); 
            uam_afpserver_action(AFP_BYTELOCK_EXT,  UAM_AFPSERVER_POSTAUTH, afp_bytelock_ext, NULL); 
index 54aa0ede26316268f48efab4e3902c630e4d70fa..a0bce01f2e3c896aaa54f2481c114af55189aa01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: fork.c,v 1.57 2008-12-03 18:35:44 didg Exp $
+ * $Id: fork.c,v 1.58 2009-02-25 16:14:08 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1098,6 +1098,39 @@ int      ibuflen _U_, *rbuflen;
     return( AFP_OK );
 }
 
+/*
+  There is a lot to tell about fsync, fdatasync, F_FULLFSYNC.
+  fsync(2) on OSX is implemented differently than on other platforms.
+  see: http://mirror.linux.org.au/pub/linux.conf.au/2007/video/talks/278.pdf.
+ */
+int afp_syncfork(obj, ibuf, ibuflen, rbuf, rbuflen )
+    AFPObj  *obj;
+    char    *ibuf, *rbuf _U_;
+    int     ibuflen _U_, *rbuflen;
+{
+    struct ofork        *ofork;
+    u_int16_t           ofrefnum;
+
+    *rbuflen = 0;
+    ibuf += 2;
+
+    memcpy(&ofrefnum, ibuf, sizeof(ofrefnum));
+    ibuf += sizeof( ofrefnum );
+
+    if (NULL == ( ofork == of_find( ofrefnum )) ) {
+        LOG(log_error, logtype_afpd, "afpd_syncfork: of_find(%d) could not locate fork", ofrefnum );
+        return( AFPERR_PARAM );
+    }
+
+    if ( flushfork( ofork ) < 0 ) {
+       LOG(log_error, logtype_afpd, "flushfork(%s): %s", of_name(ofork), strerror(errno) );
+       return AFPERR_MISC;
+    }
+
+    return( AFP_OK );
+}
+
+
 /* this is very similar to closefork */
 int flushfork( ofork )
 struct ofork   *ofork;
@@ -1114,7 +1147,7 @@ struct ofork      *ofork;
     }
 
     if ( ad_reso_fileno( ofork->of_ad ) != -1 &&  /* HF */
-           (ofork->of_flags & AFPFORK_RSRC)) {
+        (ofork->of_flags & AFPFORK_RSRC)) {
 
         /* read in the rfork length */
         ad_refresh(ofork->of_ad);
index 4263a7c71122f8358419ab6d47ab2eb3cbc23993..a63073d665d00cef9efe836a43f11471f0361499 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: fork.h,v 1.11 2008-12-03 18:35:44 didg Exp $
+ * $Id: fork.h,v 1.12 2009-02-25 16:14:08 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -89,4 +89,5 @@ extern int    afp_closefork __P((AFPObj *, char *, int, char *, int *));
 extern int     afp_bytelock_ext __P((AFPObj *, char *, int, char *, int *));
 extern int     afp_read_ext __P((AFPObj *, char *, int, char *, int *));
 extern int     afp_write_ext __P((AFPObj *, char *, int, char *, int *));
+extern int      afp_syncfork __P((AFPObj *, char *, int, char *, int *));
 #endif
index fd9770841910f6da250aaa334c8371281bcc81e6..09f97d036f6b5126ddee4b921243491add863776 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: switch.c,v 1.15 2009-02-02 11:55:01 franklahm Exp $
+ * $Id: switch.c,v 1.16 2009-02-25 16:14:08 franklahm Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -155,7 +155,7 @@ int (*postauth_switch[])() = {
     NULL, NULL, NULL, NULL,
     NULL, NULL, NULL, NULL,                                    /*  64 -  71 */
     NULL, NULL, NULL, NULL,
-    NULL, NULL, afp_syncdir, NULL,                             /*  72 -  79 */
+    NULL, NULL, NULL, NULL,                                    /*  72 -  79 */
     NULL, NULL, NULL, NULL,
     NULL, NULL, NULL, NULL,                                    /*  80 -  87 */
     NULL, NULL, NULL, NULL,