Whamcloud - gitweb
Branch HEAD
[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 # ifdef HAVE_QUOTA_SUPPORT
27 #  include <linux/quota.h>
28 # endif
29 #endif
30
31 /*
32  * asm-x86_64/processor.h on some SLES 9 distros seems to use
33  * kernel-only typedefs.  fortunately skipping it altogether is ok
34  * (for now).
35  */
36 #define __ASM_X86_64_PROCESSOR_H
37
38 #ifdef __KERNEL__
39 #include <linux/string.h>
40 #else
41 #include <string.h>
42 #include <sys/stat.h>
43 #endif
44
45 #if defined(__x86_64__) || defined(__ia64__) || defined(__ppc64__) || \
46     defined(__craynv) || defined (__mips64__)
47 typedef struct stat     lstat_t;
48 #define lstat_f         lstat
49 #define HAVE_LOV_USER_MDS_DATA
50 #elif defined(__USE_LARGEFILE64) || defined(__KERNEL__)
51 typedef struct stat64   lstat_t;
52 #define lstat_f         lstat64
53 #define HAVE_LOV_USER_MDS_DATA
54 #endif
55
56 #ifndef LPU64
57 /* this is a bit chunky */
58 #if defined(__KERNEL__)
59  #define _LWORDSIZE BITS_PER_LONG
60 #else
61  #define _LWORDSIZE __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__) || defined(CRAY_XT3)))
65 # define LPU64 "%Lu"
66 # define LPD64 "%Ld"
67 # define LPX64 "%#Lx"
68 # define LPSZ  "%lu"
69 # define LPSSZ "%ld"
70 #elif (_LWORDSIZE == 32)
71 # define LPU64 "%Lu"
72 # define LPD64 "%Ld"
73 # define LPX64 "%#Lx"
74 # define LPSZ  "%u"
75 # define LPSSZ "%d"
76 #elif (_LWORDSIZE == 64)
77 # define LPU64 "%lu"
78 # define LPD64 "%ld"
79 # define LPX64 "%#lx"
80 # define LPSZ  "%lu"
81 # define LPSSZ "%ld"
82 #endif
83
84 #undef _LWORDSIZE
85
86 #endif /* !LPU64 */
87
88 #endif /* _LUSTRE_USER_H */