Whamcloud - gitweb
b=17670
[fs/lustre-release.git] / libcfs / include / libcfs / posix / libcfs.h
index b50554f..37072e0 100644 (file)
@@ -43,6 +43,7 @@
 #ifndef __LIBCFS_POSIX_LIBCFS_H__
 #define __LIBCFS_POSIX_LIBCFS_H__
 
+#include <errno.h>
 #include <sys/errno.h>
 #include <string.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <assert.h>
+#include <sys/ioctl.h>
 #include <sys/signal.h>
 #include <signal.h>
 #include <sys/time.h>
 #include <time.h>
+#include <getopt.h>
+#include <signal.h>
+#include <pwd.h>
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <ctype.h>
+
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #ifdef HAVE_LIBPTHREAD
 #include <pthread.h>
@@ -292,7 +307,7 @@ struct radix_tree_node {
         unsigned long index;
         void *item;
 };
+
 #define RADIX_TREE_INIT(mask)  {               \
                 NOT_IMPLEMENTED                 \
 }
@@ -319,7 +334,7 @@ static inline int radix_tree_insert(struct radix_tree_root *root,
         node->index = idx;
         node->item = item;
         list_add_tail(&node->_node, &root->list);
-        root->rnode = (void *)1001; 
+        root->rnode = (void *)1001;
         return 0;
 }
 
@@ -331,7 +346,8 @@ static inline struct radix_tree_node *radix_tree_lookup0(struct radix_tree_root
         if (list_empty(&root->list))
                 return NULL;
 
-        list_for_each_entry(node, &root->list, _node)
+        cfs_list_for_each_entry_typed(node, &root->list,
+                                      struct radix_tree_node, _node)
                 if (node->index == idx)
                         return node;
 
@@ -395,4 +411,9 @@ static inline void radix_tree_preload_end(void)
 
 typedef ssize_t (*read_actor_t)();
 
+#define CFS_IFSHIFT 12
+
+#define CFS_IFTODT(type)           (((type) & S_IFMT) >> CFS_IFSHIFT)
+#define CFS_DTTOIF(dirtype)        ((dirtype) << CFS_IFSHIFT)
+
 #endif