Whamcloud - gitweb
cc5a4f6b519e1efe1d8dca34ed922e88288e71e9
[fs/lustre-release.git] / lustre / include / linux / lustre_user.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *   This file is part of Lustre, http://www.lustre.org
5  *
6  * Lustre public user-space interface definitions.
7  */
8
9 #ifndef _LINUX_LUSTRE_USER_H
10 #define _LINUX_LUSTRE_USER_H
11
12 #ifdef HAVE_ASM_TYPES_H
13 #include <asm/types.h>
14 #else
15 #include <lustre/types.h>
16 #endif
17
18
19 #ifndef __KERNEL__
20 # define NEED_QUOTA_DEFS
21 # ifdef HAVE_QUOTA_SUPPORT
22 #  include <sys/quota.h>
23 # endif
24 #else
25 # include <linux/version.h>
26 # if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21)
27 #  define NEED_QUOTA_DEFS
28 # endif
29 # ifdef HAVE_QUOTA_SUPPORT
30 #  include <linux/quota.h>
31 # endif
32 #endif
33
34 /*
35  * asm-x86_64/processor.h on some SLES 9 distros seems to use
36  * kernel-only typedefs.  fortunately skipping it altogether is ok
37  * (for now).
38  */
39 #define __ASM_X86_64_PROCESSOR_H
40
41 #ifdef __KERNEL__
42 #include <linux/string.h>
43 #else
44 #include <string.h>
45 #include <sys/stat.h>
46 #endif
47
48 #if defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || \
49     defined(__craynv) || defined (__mips64__)
50 typedef struct stat     lstat_t;
51 #define lstat_f         lstat
52 #define HAVE_LOV_USER_MDS_DATA
53 #elif defined(__USE_LARGEFILE64) || defined(__KERNEL__)
54 typedef struct stat64   lstat_t;
55 #define lstat_f         lstat64
56 #define HAVE_LOV_USER_MDS_DATA
57 #endif
58
59 #ifndef LPU64
60 #if !defined(BITS_PER_LONG) && defined(__WORDSIZE)
61 #define BITS_PER_LONG __WORDSIZE
62 #endif
63 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
64 #if defined(__x86_64__) && defined(__KERNEL__)
65 # define LPU64 "%Lu"
66 # define LPD64 "%Ld"
67 # define LPX64 "%#Lx"
68 # define LPSZ  "%lu"
69 # define LPSSZ "%ld"
70 #elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
71 # define LPU64 "%Lu"
72 # define LPD64 "%Ld"
73 # define LPX64 "%#Lx"
74 # define LPSZ  "%u"
75 # define LPSSZ "%d"
76 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
77 # define LPU64 "%lu"
78 # define LPD64 "%ld"
79 # define LPX64 "%#lx"
80 # define LPSZ  "%lu"
81 # define LPSSZ "%ld"
82 #endif
83 #endif /* !LPU64 */
84
85 #endif /* _LUSTRE_USER_H */