]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/growfs/debug.h
simd(7): add missing aarch64 SIMD functions
[FreeBSD/FreeBSD.git] / sbin / growfs / debug.h
1 /*-
2  * SPDX-License-Identifier: BSD-4-Clause
3  *
4  * Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
5  * Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
6  * All rights reserved.
7  * 
8  * This code is derived from software contributed to Berkeley by
9  * Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt.
10  * 
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgment:
21  *      This product includes software developed by the University of
22  *      California, Berkeley and its contributors, as well as Christoph
23  *      Herrmann and Thomas-Henning von Kamptz.
24  * 4. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  * 
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  * $TSHeader: src/sbin/growfs/debug.h,v 1.2 2000/11/16 18:43:50 tom Exp $
41  *
42  */
43
44 #ifdef FS_DEBUG
45
46 /* ********************************************************** INCLUDES ***** */
47 #include <sys/param.h>
48
49 #include <ufs/ufs/dinode.h>
50 #include <ufs/ffs/fs.h>
51
52 void dbg_open(const char *);
53 void dbg_close(void);
54 void dbg_dump_hex(struct fs *, const char *, unsigned char *);
55 void dbg_dump_fs(struct fs *, const char *);
56 void dbg_dump_cg(const char *, struct cg *);
57 void dbg_dump_csum(const char *, struct csum *);
58 void dbg_dump_csum_total(const char *, struct csum_total *);
59 void dbg_dump_ufs1_ino(struct fs *, const char *, struct ufs1_dinode *);
60 void dbg_dump_ufs2_ino(struct fs *, const char *, struct ufs2_dinode *);
61 void dbg_dump_iblk(struct fs *, const char *, char *, size_t);
62 void dbg_dump_inmap(struct fs *, const char *, struct cg *);
63 void dbg_dump_frmap(struct fs *, const char *, struct cg *);
64 void dbg_dump_clmap(struct fs *, const char *, struct cg *);
65 void dbg_dump_clsum(struct fs *, const char *, struct cg *);
66 void dbg_dump_sptbl(struct fs *, const char *, struct cg *);
67
68 #define DBG_OPEN(P) dbg_open((P))
69 #define DBG_CLOSE dbg_close()
70 #define DBG_DUMP_HEX(F,C,M) dbg_dump_hex((F),(C),(M))
71 #define DBG_DUMP_FS(F,C) dbg_dump_fs((F),(C))
72 #define DBG_DUMP_CG(F,C,M) dbg_dump_cg((C),(M))
73 #define DBG_DUMP_CSUM(F,C,M) dbg_dump_csum((C),(M))
74 #define DBG_DUMP_INO(F,C,M) (F)->fs_magic == FS_UFS1_MAGIC \
75         ? dbg_dump_ufs1_ino((F),(C),(struct ufs1_dinode *)(M)) \
76         : dbg_dump_ufs2_ino((F),(C),(struct ufs2_dinode *)(M))
77 #define DBG_DUMP_IBLK(F,C,M,L) dbg_dump_iblk((F),(C),(M),(L))
78 #define DBG_DUMP_INMAP(F,C,M) dbg_dump_inmap((F),(C),(M))
79 #define DBG_DUMP_FRMAP(F,C,M) dbg_dump_frmap((F),(C),(M))
80 #define DBG_DUMP_CLMAP(F,C,M) dbg_dump_clmap((F),(C),(M))
81 #define DBG_DUMP_CLSUM(F,C,M) dbg_dump_clsum((F),(C),(M))
82 #ifdef NOT_CURRENTLY
83 #define DBG_DUMP_SPTBL(F,C,M) dbg_dump_sptbl((F),(C),(M))
84 #endif
85
86 #define DL_TRC  0x01
87 #define DL_INFO 0x02
88 extern int _dbg_lvl_;
89
90 #define DBG_FUNC(N) char __FKT__[] = {N};
91 #define DBG_ENTER if(_dbg_lvl_ & DL_TRC) {                                    \
92         fprintf(stderr, "~>%s: %s\n", __FILE__, __FKT__ );                    \
93         }
94 #define DBG_LEAVE if(_dbg_lvl_ & DL_TRC) {                                    \
95         fprintf(stderr, "~<%s[%d]: %s\n", __FILE__, __LINE__, __FKT__ );      \
96         }
97 #define DBG_TRC if(_dbg_lvl_ & DL_TRC) {                                      \
98         fprintf(stderr, "~=%s[%d]: %s\n", __FILE__, __LINE__, __FKT__ );      \
99         }
100 #define DBG_PRINT0(A) if(_dbg_lvl_ & DL_INFO) {                               \
101         fprintf(stderr, "~ %s", (A));                                         \
102         }
103 #define DBG_PRINT1(A,B) if(_dbg_lvl_ & DL_INFO) {                             \
104         fprintf(stderr, "~ ");                                                \
105         fprintf(stderr, (A), (B));                                            \
106         }
107 #define DBG_PRINT2(A,B,C) if(_dbg_lvl_ & DL_INFO) {                           \
108         fprintf(stderr, "~ ");                                                \
109         fprintf(stderr, (A), (B), (C));                                       \
110         }
111 #define DBG_PRINT3(A,B,C,D) if(_dbg_lvl_ & DL_INFO) {                         \
112         fprintf(stderr, "~ ");                                                \
113         fprintf(stderr, (A), (B), (C), (D));                                  \
114         }
115 #define DBG_PRINT4(A,B,C,D,E) if(_dbg_lvl_ & DL_INFO) {                       \
116         fprintf(stderr, "~ ");                                                \
117         fprintf(stderr, (A), (B), (C), (D), (E));                             \
118         }
119 #else /* not FS_DEBUG */
120
121 #define DBG_OPEN(P)
122 #define DBG_CLOSE
123 #define DBG_DUMP_HEX(F,C,M)
124 #define DBG_DUMP_FS(F,C)
125 #define DBG_DUMP_CG(F,C,M)
126 #define DBG_DUMP_CSUM(F,C,M)
127 #define DBG_DUMP_INO(F,C,M)
128 #define DBG_DUMP_IBLK(F,C,M,L)
129 #define DBG_DUMP_INMAP(F,C,M)
130 #define DBG_DUMP_FRMAP(F,C,M)
131 #define DBG_DUMP_CLMAP(F,C,M)
132 #define DBG_DUMP_CLSUM(F,C,M)
133 #define DBG_DUMP_SPTBL(F,C,M)
134 #define DBG_FUNC(N)
135 #define DBG_ENTER
136 #define DBG_TRC
137 #define DBG_LEAVE
138 #define DBG_PRINT0(A)
139 #define DBG_PRINT1(A,B)
140 #define DBG_PRINT2(A,B,C)
141 #define DBG_PRINT3(A,B,C,D)
142 #define DBG_PRINT4(A,B,C,D,E)
143
144 #endif /* FS_DEBUG */