#ifndef __LIBCFS_CURPROC_H__
#define __LIBCFS_CURPROC_H__
-#if !defined(HAVE_UIDGID_HEADER) || !defined(__KERNEL__)
+#ifndef HAVE_UIDGID_HEADER
#ifndef _LINUX_UIDGID_H
#define _LINUX_UIDGID_H
#define GLOBAL_ROOT_UID 0
#define GLOBAL_ROOT_GID 0
-#ifndef __KERNEL__
-struct user_namespace {
- unsigned int pad;
-};
-
-extern struct user_namespace init_user_ns;
-#endif
-
static inline uid_t __kuid_val(kuid_t uid)
{
return uid;
#include <libcfs/types.h>
#include <libcfs/list.h>
-#ifdef __KERNEL__
-# include <libcfs/linux/libcfs.h>
-#else /* !__KERNEL__ */
-# include <assert.h>
-# include <ctype.h>
-# include <errno.h>
-# include <fcntl.h>
-# include <limits.h>
-# include <signal.h>
-# include <stdarg.h>
-# include <stdbool.h>
-# include <stddef.h>
-# include <stdint.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-# include <time.h>
-# include <sys/ioctl.h>
-# include <sys/socket.h>
-# include <sys/stat.h>
-# include <sys/time.h>
-# include <sys/types.h>
+#ifndef __KERNEL__
# include <libcfs/user-time.h>
-#endif /* __KERNEL__ */
-
-#include "curproc.h"
+# else /* __KERNEL__ */
+# include <libcfs/linux/libcfs.h>
+# include "curproc.h"
#define LIBCFS_VERSION "0.5.0"
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) ((sizeof (a)) / (sizeof ((a)[0])))
-#endif
-
-#if !defined(swap)
-#define swap(x,y) do { typeof(x) z = x; x = y; y = z; } while (0)
-#endif
-
-#if !defined(container_of)
-/* given a pointer @ptr to the field @member embedded into type (usually
- * struct) @type, return pointer to the embedding instance of @type. */
-#define container_of(ptr, type, member) \
- ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
-#endif
-
static inline int __is_po2(unsigned long long val)
{
return !(val & (val - 1));
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
/* Sparse annotations */
-#ifdef __KERNEL__
-# if !defined(__must_hold)
-# ifdef __CHECKER__
-# define __must_hold(x) __attribute__((context(x, 1, 1)))
-# else /* __CHECKER__ */
-# define __must_hold(x)
-# endif /* !__CHECKER__ */
-# endif /* !__must_hold */
-#else /* __KERNEL__ */
-# define __acquires(x)
-# define __releases(x)
-# define __must_hold(x)
-#endif /* !__KERNEL__ */
-
-/*
- * Lustre Error Checksum: calculates checksum
- * of Hex number by XORing each bit.
- */
-#define LERRCHKSUM(hexnum) (((hexnum) & 0xf) ^ ((hexnum) >> 4 & 0xf) ^ \
- ((hexnum) >> 8 & 0xf))
-
-/*
- * Some (nomina odiosa sunt) platforms define NULL as naked 0. This confuses
- * Lustre RETURN(NULL) macro.
- */
-#if defined(NULL)
-#undef NULL
-#endif
-
-#define NULL ((void *)0)
-
-#ifdef __KERNEL__
+#if !defined(__must_hold)
+# ifdef __CHECKER__
+# define __must_hold(x) __attribute__((context(x, 1, 1)))
+# else /* __CHECKER__ */
+# define __must_hold(x)
+# endif /* !__CHECKER__ */
+#endif /* !__must_hold */
/* libcfs watchdogs */
struct lc_watchdog;
/* Clean up the watchdog */
void lc_watchdog_delete(struct lc_watchdog *lcw);
-#endif /* __KERNEL__ */
-
/* need both kernel and user-land acceptor */
#define LNET_ACCEPTOR_MIN_RESERVED_PORT 512
#define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023
/* seed the generator */
void cfs_srand(unsigned int, unsigned int);
void cfs_get_random_bytes(void *buf, int size);
+#endif /* __KERNEL__ */
#include <libcfs/byteorder.h>
#include <libcfs/libcfs_debug.h>
#ifndef HAVE_LIBCFS_CPT
-#ifndef __KERNEL__
-typedef struct nodemask { DECLARE_BITMAP(bits, 1); } nodemask_t;
-typedef struct cpumask { DECLARE_BITMAP(bits, 1); } cpumask_t;
-
-#define node_set(node, dst) __node_set((node), &(dst))
-static __always_inline void __node_set(int node, nodemask_t *dstp)
-{
- set_bit(node, dstp->bits);
-}
-#endif /* __KERNEL__ */
-
struct cfs_cpt_table {
/* # of CPU partitions */
int ctb_nparts;
#endif /* __KERNEL__ */
+/*
+ * Lustre Error Checksum: calculates checksum
+ * of Hex number by XORing each bit.
+ */
+#define LERRCHKSUM(hexnum) (((hexnum) & 0xf) ^ ((hexnum) >> 4 & 0xf) ^ \
+ ((hexnum) >> 8 & 0xf))
+
#define CWARN(format, ...) CDEBUG_LIMIT(D_WARNING, format, ## __VA_ARGS__)
#define CERROR(format, ...) CDEBUG_LIMIT(D_ERROR, format, ## __VA_ARGS__)
#define CNETERR(format, a...) CDEBUG_LIMIT(D_NETERROR, format, ## a)
#define CFS_FAULT_CHECK(id) \
CFS_FAIL_CHECK(CFS_FAULT | (id))
-#ifdef __KERNEL__
/* The idea here is to synchronise two threads to force a race. The
* first thread that calls this with a matching fail_loc is put to
* sleep. The next thread that calls with the same fail_loc wakes up
}
}
#define CFS_RACE(id) cfs_race(id)
-#else
-/* sigh. an expedient fix until CFS_RACE is fixed up */
-#define CFS_RACE(foo) do {} while(0)
-#endif
#endif /* _LIBCFS_FAIL_H */
return cfs_size_round(strlen(fset) + 1);
}
-/* roundup \a val to power2 */
-static inline size_t cfs_power2_roundup(size_t val)
-{
- if (val != LOWEST_BIT_SET(val)) { /* not a power of 2 already */
- do {
- val &= ~LOWEST_BIT_SET(val);
- } while (val != LOWEST_BIT_SET(val));
- /* ...and round up */
- val <<= 1;
- }
- return val;
-}
-
#define LOGL(var,len,ptr) \
do { \
if (var) \
#ifndef __KERNEL__
-#define ONE_BILLION ((u_int64_t)1000000000)
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+
+#define ONE_BILLION ((uint64_t)1000000000)
#define ONE_MILLION 1000000
/*
* overflow, they don't skip entries, so the queue has the same
* apparent capacity at all times */
- count = cfs_power2_roundup(count);
+ count = roundup_pow_of_two(count);
if (callback != LNET_EQ_HANDLER_NONE && count != 0) {
CWARN("EQ callback is guaranteed to get every event, "
#include <errno.h>
#include <getopt.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>
+#include <sys/ioctl.h>
#include <time.h>
#include <lustre/lustreapi.h>
* Lustre is a trademark of Sun Microsystems, Inc.
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
* Author: Robert Read <rread@clusterfs.com>
*/
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <libcfs/util/parser.h>
#include <lnet/lnetctl.h>
#include "obdctl.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
+#include <ctype.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
+#include <signal.h>
#include <sys/time.h>
#include <sys/xattr.h>
#include <sys/syscall.h>
#include <sys/types.h>
+
#include <libcfs/util/string.h>
#include <lustre/lustre_idl.h>
#include <lustre/lustreapi.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <sys/statfs.h>
-#include <sys/types.h>
#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/types.h>
#include <sys/xattr.h>
+#include <time.h>
#include <fnmatch.h>
#include <libgen.h> /* for dirname() */
#ifdef HAVE_LINUX_UNISTD_H
* Author: Henri Doreau <henri.doreau@cea.fr>
*/
+#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
* @{
*/
+#include <errno.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_ENDIAN_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
* Author: Robert Read <rread@clusterfs.com>
*/
+#include <errno.h>
+#include <fcntl.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <getopt.h>
+#include <sys/ioctl.h>
#include <time.h>
#include "obdctl.h"
#include <getopt.h>
#include <stdarg.h>
#include <fcntl.h>
+#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#define _SPL_ZFS_H
#define _SPL_SIGNAL_H
#endif
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include <lustre_disk.h>
#include <lustre_param.h>
* Author: Nikita Danilov <nikita@clusterfs.com>
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <linux/types.h>
+#define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
#define __REQ_LAYOUT_USER__ (1)
#define EXPORT_SYMBOL(s)
* Lustre is a trademark of Sun Microsystems, Inc.
*/
+#include <errno.h>
#include <stdio.h>
+#include <string.h>
+
#include <lustre/lustre_idl.h>
#include <lustre/lustre_lfsck_user.h>
#include <lustre_disk.h>