]> arthur.barton.de Git - netatalk.git/blobdiff - include/atalk/adouble.h
Posix/SUS portability cleanup
[netatalk.git] / include / atalk / adouble.h
index fbf53a1c34ce2c78b6d858fbe20ae8ddacada4cb..78a35b02909ecd932bbf86d00cb5d908402e9426 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: adouble.h,v 1.53 2010-02-10 14:05:37 franklahm Exp $
+ * $Id: adouble.h,v 1.55 2010-03-30 12:55:26 franklahm Exp $
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
 #include <config.h>
 #endif
 
-/* -------------------
- * need pread() and pwrite()
- */
-#ifdef HAVE_PREAD
-
-#ifndef HAVE_PWRITE
-#undef HAVE_PREAD
-#endif
-
-#endif
-
-#ifdef HAVE_PWRITE
-#ifndef HAVE_PREAD
-#undef HAVE_PWRITE
-#endif
-#endif
-
-/*
-  Still have to figure out which platforms really
-  need _XOPEN_SOURCE defined for pread.
-*/
-#if defined(HAVE_PREAD) && !defined(SOLARIS) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(TRU64)
-#ifdef _XOPEN_SOURCE
-#undef _XOPEN_SOURCE
-#endif
-#define _XOPEN_SOURCE 500
-#endif
+#include <atalk/standards.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -78,6 +52,7 @@
 #endif
 
 #include <sys/mman.h>
+
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -232,8 +207,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 {
@@ -243,7 +218,7 @@ typedef struct adf_lock_t {
 } adf_lock_t;
 
 struct ad_fd {
-    int          adf_fd;
+    int          adf_fd;        /* -1: invalid, -2: symlink */
 
 #ifndef HAVE_PREAD
     off_t        adf_off;
@@ -335,8 +310,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
@@ -474,9 +453,11 @@ extern int ad_mode        (const char *, int);
 extern int ad_mkdir       (const char *, int);
 extern void ad_init       (struct adouble *, int, int );
 extern int ad_open        (const char *, int, int, int, struct adouble *);
+extern int ad_openat      (int dirfd, const char *, int, int, int, struct adouble *);
 extern int ad_refresh     (struct adouble *);
 extern int ad_stat        (const char *, struct stat *);
 extern int ad_metadata    (const char *, int, struct adouble *);
+extern int ad_metadataat  (int, const char *, int, struct adouble *);
 
 #define ad_open_metadata(name, flags, mode, adp)\
    ad_open(name, ADFLAGS_MD|(flags), O_RDWR |(mode), 0666, (adp))
@@ -547,7 +528,7 @@ extern void *ad_mmapwrite (struct adouble *, const u_int32_t,
 #define ad_munmap(buf, len)  (munmap((buf), (len)))
 
 /* ad_date.c */
-extern int ad_setdate (const struct adouble *, unsigned int, u_int32_t);
+extern int ad_setdate (struct adouble *, unsigned int, u_int32_t);
 extern int ad_getdate (const struct adouble *, unsigned int, u_int32_t *);
 
 /* ad_attr.c */