Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / darwin / lustre_lib.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
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 #include <libcfs/kp30.h> 
35
36 #ifndef LP_POISON
37 #define LI_POISON ((int)0x5a5a5a5a)
38 #define LL_POISON ((long)0x5a5a5a5a)
39 #define LP_POISON ((void *)(long)0x5a5a5a5a)
40 #endif
41
42 #ifndef LPU64
43 #define LPU64 "%llu"
44 #define LPD64 "%lld"
45 #define LPX64 "%llx"
46 #endif
47
48 struct obd_ioctl_data;
49 #define OBD_IOC_DATA_TYPE               struct obd_ioctl_data
50
51 #define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) |                \
52                            sigmask(SIGTERM) | sigmask(SIGQUIT) |               \
53                            sigmask(SIGALRM) | sigmask(SIGHUP))
54
55 #ifdef __KERNEL__
56 static inline sigset_t l_w_e_set_sigs(sigset_t sigs)
57 {
58         sigset_t old = 0;
59
60         /* XXX Liang: how to change sigmask in Darwin8.x? 
61          * there is syscall like pthread_sigmask() but we cannot 
62          * use in kernel  */
63 #if !defined(__DARWIN8__)
64         struct proc     *p = current_proc();
65         extern int block_procsigmask(struct proc *p,  int bit);
66         old = cfs_current()->uu_sigmask;
67         block_procsigmask(p, ~sigs);
68 #endif
69
70         return old;
71 }
72 #endif
73
74 #endif
75
76