1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
21 * Basic Lustre library routines.
25 #ifndef _LINUX_LUSTRE_LIB_H
26 #define _LINUX_LUSTRE_LIB_H
29 #error Do not #include this file directly. #include <lustre_lib.h> instead
34 # include <sys/types.h>
36 # include <asm/semaphore.h>
37 # include <linux/rwsem.h>
38 # include <linux/sched.h>
39 # include <linux/signal.h>
40 # include <linux/types.h>
42 #include <linux/lustre_compat25.h>
45 #if BITS_PER_LONG > 32
46 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
47 # define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
48 # define LP_POISON ((void *)(long)0x5a5a5a5a5a5a5a5a)
50 # define LI_POISON ((int)0x5a5a5a5a)
51 # define LL_POISON ((long)0x5a5a5a5a)
52 # define LP_POISON ((void *)(long)0x5a5a5a5a)
56 #define OBD_IOC_DATA_TYPE long
58 #define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | \
59 sigmask(SIGTERM) | sigmask(SIGQUIT) | \
63 static inline sigset_t l_w_e_set_sigs(int sigs)
66 unsigned long irqflags;
68 SIGNAL_MASK_LOCK(current, irqflags);
69 old = current->blocked;
70 siginitsetinv(¤t->blocked, sigs);
72 SIGNAL_MASK_UNLOCK(current, irqflags);
79 /* initialize ost_lvb according to inode */
80 static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb)
82 lvb->lvb_size = i_size_read(inode);
83 lvb->lvb_blocks = inode->i_blocks;
84 lvb->lvb_mtime = LTIME_S(inode->i_mtime);
85 lvb->lvb_atime = LTIME_S(inode->i_atime);
86 lvb->lvb_ctime = LTIME_S(inode->i_ctime);
89 /* defined in liblustre/llite_lib.h */
92 #endif /* _LUSTRE_LIB_H */