Whamcloud - gitweb
LU-513 Make cfs_wait_event_interruptible_exclusive really exclusive
[fs/lustre-release.git] / libcfs / include / libcfs / libcfs.h
index 08be620..863ca3a 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011 Whamcloud, Inc.
+ *
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -103,6 +106,10 @@ static inline int __is_po2(unsigned long long val)
 
 #include <libcfs/list.h>
 
+#ifndef cfs_for_each_possible_cpu
+#  error cfs_for_each_possible_cpu is not supported by kernel!
+#endif
+
 /* libcfs tcpip */
 int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
 int libcfs_ipif_enumerate(char ***names);
@@ -130,8 +137,10 @@ struct lc_watchdog *lc_watchdog_add(int time,
                                     void *data);
 
 /* Enables a watchdog and resets its timer. */
-void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms);
-void lc_watchdog_touch(struct lc_watchdog *lcw);
+void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout);
+#define CFS_GET_TIMEOUT(svc) (max_t(int, obd_timeout,                   \
+                          AT_OFF ? 0 : at_get(&svc->srv_at_estimate)) * \
+                          svc->srv_watchdog_factor)
 
 /* Disable a watchdog; touch it to restart it. */
 void lc_watchdog_disable(struct lc_watchdog *lcw);
@@ -218,9 +227,11 @@ int cfs_daemonize_ctxt(char *str);
 cfs_sigset_t cfs_get_blocked_sigs(void);
 cfs_sigset_t cfs_block_allsigs(void);
 cfs_sigset_t cfs_block_sigs(cfs_sigset_t bits);
+cfs_sigset_t cfs_block_sigsinv(unsigned long sigs);
 void cfs_restore_sigs(cfs_sigset_t);
 int cfs_signal_pending(void);
 void cfs_clear_sigpending(void);
+
 /*
  * XXX Liang:
  * these macros should be removed in the future,
@@ -254,10 +265,15 @@ void cfs_stack_trace_fill(struct cfs_stack_trace *trace);
  */
 void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no);
 
+#ifndef O_NOACCESS
+#define O_NOACCESS O_NONBLOCK
+#endif
+
 /*
  * Universal open flags.
  */
-#define CFS_O_ACCMODE           0003
+#define CFS_O_NOACCESS          0003
+#define CFS_O_ACCMODE           CFS_O_NOACCESS
 #define CFS_O_CREAT             0100
 #define CFS_O_EXCL              0200
 #define CFS_O_NOCTTY            0400
@@ -278,11 +294,27 @@ int cfs_oflags2univ(int flags);
 /* convert universal open flags to local open flags */
 int cfs_univ2oflags(int flags);
 
+/*
+ * Random number handling
+ */
+
+/* returns a random 32-bit integer */
+unsigned int cfs_rand(void);
+/* seed the generator */
+void cfs_srand(unsigned int, unsigned int);
+void cfs_get_random_bytes(void *buf, int size);
+
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
 #include <libcfs/libcfs_ioctl.h>
 #include <libcfs/libcfs_prim.h>
 #include <libcfs/libcfs_time.h>
+#include <libcfs/libcfs_string.h>
+#include <libcfs/libcfs_kernelcomm.h>
+#include <libcfs/libcfs_workitem.h>
+#include <libcfs/libcfs_hash.h>
+#include <libcfs/libcfs_fail.h>
+#include <libcfs/params_tree.h>
 
 /* container_of depends on "likely" which is defined in libcfs_private.h */
 static inline void *__container_of(void *ptr, unsigned long shift)