]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/cnid/cdb/cnid_cdb_private.h
remove gcc warnings and cleanup inline mess
[netatalk.git] / libatalk / cnid / cdb / cnid_cdb_private.h
index 4f4453adbe6718ab88b13f30b53cccf10865d086..a5a77e89f9f63f096da9db78ee39755421ee7b53 100644 (file)
@@ -1,20 +1,40 @@
 /*
- * $Id: cnid_cdb_private.h,v 1.1.4.1 2003-09-09 16:42:21 didg Exp $
+ * $Id: cnid_cdb_private.h,v 1.1.4.7.2.2 2008-11-25 15:16:34 didg Exp $
  */
 
 #ifndef LIBATALK_CDB_PRIVATE_H
 #define LIBATALK_CDB_PRIVATE_H 1
 
-#include <string.h>
-#include <sys/param.h>
-#include <sys/stat.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <netatalk/endian.h>
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
-
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif /* HAVE_FCNTL_H */
+#include <sys/param.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#include <sys/cdefs.h>
 #include <db.h>
 
+#include <atalk/logger.h>
 #include <atalk/adouble.h>
+#include <atalk/cnid.h>
+#include <atalk/util.h>
 #include "cnid_cdb.h"
 
 #define CNID_DB_MAGIC   0x434E4944U  /* CNID */
@@ -76,7 +96,6 @@ typedef struct cnid_record { /* helper for debug don't use */
 #define ROOTINFO_KEY    "\0\0\0\0"
 #define ROOTINFO_KEYLEN 4
 
-/* FIXME assume dev_t == ino_t == 8 */
 /*                         cnid   - dev        - inode     - type  - did  - name */
 #define ROOTINFO_DATA    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0RootInfo"
 #define ROOTINFO_DATALEN (3*4 +2*8  +9)
@@ -149,46 +168,8 @@ typedef struct CNID_private {
  * name namelen = strlen(name) + 1 
  */
 
-#ifndef __inline__
-#define __inline__
-#endif /* __inline__ */
-
 /* construct db_cnid data. NOTE: this is not re-entrant.  */
-#ifndef ATACC
-static __inline__ char *make_cnid_data(const struct stat *st,
-                                       const cnid_t did,
-                                       const char *name, const int len)
-{
-    static char start[CNID_HEADER_LEN + MAXPATHLEN + 1];
-    char *buf = start  +CNID_LEN;
-    u_int32_t i;
-
-    if (len > MAXPATHLEN)
-        return NULL;
-
-    memcpy(buf, &st->st_dev, sizeof(st->st_dev));
-    buf += sizeof(st->st_dev);
-
-    memcpy(buf, &st->st_ino, sizeof(st->st_ino));
-    buf += sizeof(st->st_ino);
-
-    i = S_ISDIR(st->st_mode)?1:0;
-    i = htonl(i);
-    memcpy(buf, &i, sizeof(i));
-    buf += sizeof(i);
-    
-    /* did is already in network byte order */
-    memcpy(buf, &did, sizeof(did));
-    buf += sizeof(did);
-
-    memcpy(buf, name, len);
-    *(buf + len) = '\0';
-
-    return start;
-}
-#else
-extern char *make_cnid_data __P((const struct stat *,const cnid_t ,
-                                       const char *, const int ));
-#endif
+extern unsigned char *make_cnid_data __P((const struct stat *,const cnid_t ,
+                                       const char *, const size_t ));
 
 #endif /* atalk/cnid/cnid_private.h */