Whamcloud - gitweb
7bbcca722634a0d0c18751dd6a6c82194408e1d7
[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)
50 typedef struct stat     lstat_t;
51 #define HAVE_LOV_USER_MDS_DATA
52 #elif defined(__USE_LARGEFILE64) || defined(__KERNEL__)
53 typedef struct stat64   lstat_t;
54 #define HAVE_LOV_USER_MDS_DATA
55 #endif
56
57 #ifndef LPU64
58 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
59 #if defined(__x86_64__) && defined(__KERNEL__)
60 # define LPU64 "%Lu"
61 # define LPD64 "%Ld"
62 # define LPX64 "%#Lx"
63 # define LPSZ  "%lu"
64 # define LPSSZ "%ld"
65 #elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
66 # define LPU64 "%Lu"
67 # define LPD64 "%Ld"
68 # define LPX64 "%#Lx"
69 # define LPSZ  "%u"
70 # define LPSSZ "%d"
71 #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
72 # define LPU64 "%lu"
73 # define LPD64 "%ld"
74 # define LPX64 "%#lx"
75 # define LPSZ  "%lu"
76 # define LPSSZ "%ld"
77 #endif
78 #endif /* !LPU64 */
79
80 #endif /* _LUSTRE_USER_H */