]> arthur.barton.de Git - netatalk.git/commitdiff
locking: use 64 bit offset instead of 32 bit on 64 bit platforms
authorFrank Lahm <franklahm@googlemail.com>
Mon, 15 Aug 2011 11:51:14 +0000 (13:51 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 15 Aug 2011 11:51:14 +0000 (13:51 +0200)
etc/afpd/fork.c
etc/afpd/fork.h
include/atalk/adouble.h
libatalk/adouble/ad_lock.c

index 00436dbc01ab8dd4f29e654e9fd533eea7c99ab7..4c70cdbed7935ad3ee80e11606b63d34c43ce8b6 100644 (file)
@@ -159,14 +159,14 @@ static int sum_neg(int is64, off_t offset, off_t reqcount)
 
 /* -------------------------
 */
-static int setforkmode(struct adouble *adp, int eid, int ofrefnum, int what)
+static int setforkmode(struct adouble *adp, int eid, int ofrefnum, off_t what)
 {
     return ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, what, 1, ofrefnum);
 }
 
 /* -------------------------
 */
-int getforkmode(struct adouble *adp, int eid, int what)
+int getforkmode(struct adouble *adp, int eid, off_t what)
 {
     return ad_testlock(adp, eid,  what);
 }
index ae22b8f7f6b52c1b161808ac027b07948680af97..0ad46a9779ff519afcac78183db69c9c8e24e33a 100644 (file)
@@ -82,7 +82,7 @@ extern int of_fstatat(int dirfd, struct path *path);
 
 /* in fork.c */
 extern int          flushfork    (struct ofork *);
-extern int          getforkmode  (struct adouble *, int , int );
+extern int          getforkmode  (struct adouble *, int , off_t );
 
 /* FP functions */
 int afp_openfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
index 18422eca680dc89c2950813d36cfe7ff97b50073..278dd4ba26ccffaed8044cdaab0cd1b90a398ac9 100644 (file)
@@ -232,8 +232,8 @@ typedef u_int32_t cnid_t;
  */
 
 struct ad_entry {
-    u_int32_t   ade_off;
-    u_int32_t   ade_len;
+    off_t   ade_off;
+    ssize_t   ade_len;
 };
 
 typedef struct adf_lock_t {
@@ -335,8 +335,12 @@ struct adouble_fops {
 /* synchronization locks */
 #define AD_FILELOCK_BASE (0x80000000)
 #else
+#if _FILE_OFFSET_BITS == 64
+#define AD_FILELOCK_BASE (0x7FFFFFFFFFFFFFFFULL - 9)
+#else
 #define AD_FILELOCK_BASE (0x7FFFFFFF -9)
 #endif
+#endif
 
 /* FIXME:
  * AD_FILELOCK_BASE case
index 30a1303340c6fdef00a885c63d0ea00f5a7b8199..e2139e5850b7ed4eacd1dd09dd5f88ce37d31cc5 100644 (file)
 #endif /* HAVE_CONFIG_H */
 
 #include <atalk/adouble.h>
+#include <atalk/logger.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <inttypes.h>
 
 #include <string.h>
 
@@ -224,9 +226,9 @@ static int adf_findxlock(struct ad_fd *ad,
        translate a data fork lock to an offset
 */
 
-static off_t df2off(int off)
+static off_t df2off(off_t off)
 {
-int start = off;
+    off_t start = off;
        if (off == AD_FILELOCK_OPEN_WR)
                start = LOCK_DATA_WR;
        else if (off == AD_FILELOCK_OPEN_RD)
@@ -244,9 +246,9 @@ int start = off;
        translate a resource fork lock to an offset
 */
 
-static off_t hf2off(int off)
+static off_t hf2off(off_t off)
 {
-int start = off;
+    off_t start = off;
        if (off == AD_FILELOCK_OPEN_WR)
                start = LOCK_RSRC_WR;
        else if (off == AD_FILELOCK_OPEN_RD)