1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
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.
23 #ifndef _LUSTRE_DEBUG_H
24 #define _LUSTRE_DEBUG_H
26 #include <lustre_net.h>
28 #if defined(__linux__)
29 #include <linux/lustre_debug.h>
30 #elif defined(__APPLE__)
31 #include <darwin/lustre_debug.h>
32 #elif defined(__WINNT__)
33 #include <winnt/lustre_debug.h>
35 #error Unsupported operating system.
38 #define ASSERT_MAX_SIZE_MB 60000ULL
39 #define ASSERT_PAGE_INDEX(index, OP) \
40 do { if (index > ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT)) { \
41 CERROR("bad page index %lu > %Lu\n", index, \
42 ASSERT_MAX_SIZE_MB << (20 - CFS_PAGE_SHIFT)); \
43 libcfs_debug = ~0UL; \
47 #define ASSERT_FILE_OFFSET(offset, OP) \
48 do { if (offset > ASSERT_MAX_SIZE_MB << 20) { \
49 CERROR("bad file offset %Lu > %Lu\n", offset, \
50 ASSERT_MAX_SIZE_MB << 20); \
51 libcfs_debug = ~0UL; \
56 int dump_lniobuf(struct niobuf_local *lnb);
57 int dump_rniobuf(struct niobuf_remote *rnb);
58 int dump_ioo(struct obd_ioobj *nb);
59 int dump_req(struct ptlrpc_request *req);
60 int dump_obdo(struct obdo *oa);
61 void dump_lsm(int level, struct lov_stripe_md *lsm);
62 int block_debug_setup(void *addr, int len, __u64 off, __u64 id);
63 int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id);