Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / darwin / lustre_lib.h
1
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * Basic Lustre library routines.
22  *
23  */
24
25 #ifndef _DARWIN_LUSTRE_LIB_H
26 #define _DARWIN_LUSTRE_LIB_H
27
28 #ifndef _LUSTRE_LIB_H
29 #error Do not #include this file directly. #include <lustre_lib.h> instead
30 #endif
31
32 #include <string.h>
33 #include <libcfs/libcfs.h>
34
35 #ifndef LP_POISON
36 #define LI_POISON ((int)0x5a5a5a5a)
37 #define LL_POISON ((long)0x5a5a5a5a)
38 #define LP_POISON ((void *)(long)0x5a5a5a5a)
39 #endif
40
41 #ifndef LPU64
42 #define LPU64 "%llu"
43 #define LPD64 "%lld"
44 #define LPX64 "%llx"
45 #endif
46
47 struct obd_ioctl_data;
48 #define OBD_IOC_DATA_TYPE               struct obd_ioctl_data
49
50 #define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) |                \
51                            sigmask(SIGTERM) | sigmask(SIGQUIT) |               \
52                            sigmask(SIGALRM) | sigmask(SIGHUP))
53
54 #ifdef __KERNEL__
55 static inline sigset_t l_w_e_set_sigs(sigset_t sigs)
56 {
57         sigset_t old = 0;
58
59         /* XXX Liang: how to change sigmask in Darwin8.x? 
60          * there is syscall like pthread_sigmask() but we cannot 
61          * use in kernel  */
62 #if !defined(__DARWIN8__)
63         struct proc     *p = current_proc();
64         extern int block_procsigmask(struct proc *p,  int bit);
65         old = cfs_current()->uu_sigmask;
66         block_procsigmask(p, ~sigs);
67 #endif
68
69         return old;
70 }
71 #endif
72
73 #endif
74
75