Whamcloud - gitweb
LU-5396 all: use NULL instead of 0
[fs/lustre-release.git] / libcfs / include / libcfs / types.h
index 45018ee..b4fd790 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * 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) 2012, 2014, Intel Corporation.
  */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
 #ifndef _LIBCFS_TYPES_H
 #define _LIBCFS_TYPES_H
 
-/*
- * This file was inttroduced to resolve XT3 (Catamount) build issues.
- * The orignal idea was to move <lustre/types.h> here however at
- * the time of this writing
- * it's unclear what external dependencies are tied
- * to that file (It's not just some source file #including it)
- * there is some build/packaging infrastructure that includes it.
- * Hopefully that will be resolved shortly, that file will
- * be removed, its contents copied here and this comment can be deleted.
- */
+#include <linux/types.h>
+
+#ifndef __KERNEL__
+# include <limits.h> /* LONG_MAX */
+# include <stdbool.h> /* bool */
+#endif /* !__KERNEL__ */
+
+#if defined(_ASM_GENERIC_INT_L64_H)
+# define LPF64 "l"
+#elif defined(_ASM_GENERIC_INT_LL64_H)
+# define LPF64 "ll"
+#elif !defined(LPF64)
+# error "cannot define LPF64"
+#endif /* !LPF64 */
+
+#define LPU64 "%"LPF64"u"
+#define LPD64 "%"LPF64"d"
+#define LPX64 "%#"LPF64"x"
+#define LPX64i "%"LPF64"x"
+#define LPO64 "%#"LPF64"o"
 
-#include <lustre/types.h>
+#define LPLU "%lu"
+#define LPLD "%ld"
+#define LPLX "%#lx"
+#define LPPID "%d"
 
+#ifndef BITS_PER_LONG
+# if LONG_MAX == 9223372036854775807
+#  define BITS_PER_LONG 64
+# elif LONG_MAX == 2147483647
+#  define BITS_PER_LONG 32
+# else /* LONG_MAX == 2147483647 */
+#  error "cannot define BITS_PER_LONG"
+# endif /* LONG_MAX != 2147483647 */
+#endif /* !BITS_PER_LONG */
+
+#if BITS_PER_LONG == 64
+# define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
+# define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
+# define LP_POISON ((void *)(long)0x5a5a5a5a5a5a5a5a)
+#elif BITS_PER_LONG == 32
+# define LI_POISON ((int)0x5a5a5a5a)
+# define LL_POISON ((long)0x5a5a5a5a)
+# define LP_POISON ((void *)(long)0x5a5a5a5a)
+#else /* BITS_PER_LONG == 32 */
+# error "cannot define L{I,L,P}_POISON"
+#endif /* BITS_PER_LONG != 32 */
+
+typedef unsigned long ulong_ptr_t;
+typedef long long_ptr_t;
+
+#ifndef __KERNEL__
+/* Sparse annotation. */
+#define __user
 #endif
+
+#endif /* _LIBCFS_TYPES_H */