]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/fprint.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
37 ASSERT(bitoffs(bit
) == 0);
38 ASSERT(size
== bitsz(char));
40 for (i
= 0, p
= (char *)obj
+ byteize(bit
);
41 i
< count
&& !seenint();
43 if (*p
== '\\' || *p
== '\'' || *p
== '"' || *p
== '\?')
45 else if (isgraph((int)*p
) || *p
== ' ')
47 else if (*p
== '\a' || *p
== '\b' || *p
== '\f' || *p
== '\n' ||
48 *p
== '\r' || *p
== '\t' || *p
== '\v')
49 dbprintf("\\%c", *p
+ ('a' - '\a'));
51 dbprintf("\\%03o", *p
& 0xff);
73 for (i
= 0, bitpos
= bit
;
74 i
< count
&& !seenint();
75 i
++, bitpos
+= size
) {
76 val
= getbitval(obj
, bitpos
, size
,
77 (arg
& FTARG_SIGNED
) ? BVSIGNED
: BVUNSIGNED
);
78 if ((arg
& FTARG_SKIPZERO
) && val
== 0)
80 isnull
= (arg
& FTARG_SIGNED
) || size
== 64 ?
81 val
== -1LL : val
== ((1LL << size
) - 1LL);
82 if ((arg
& FTARG_SKIPNULL
) && isnull
)
84 if (array
&& count
> 1)
85 dbprintf("%d:", i
+ base
);
86 if ((arg
& FTARG_DONULL
) && isnull
)
89 dbprintf(fmtstr
, val
);
91 dbprintf(fmtstr
, (int32_t)val
);
110 print_sarray(obj
, bit
, count
, size
, base
, array
,
111 (const field_t
*)fmtstr
, (arg
& FTARG_SKIPNMS
) != 0);
132 ASSERT(bitoffs(bit
) == 0);
133 for (i
= 0, bitpos
= bit
;
134 i
< count
&& !seenint();
135 i
++, bitpos
+= size
) {
137 dbprintf("%d:", i
+ base
);
138 t
= (time_t)getbitval((char *)obj
+ byteize(bitpos
), 0,
139 sizeof(int32_t) * 8, BVSIGNED
);
141 dbprintf("%24.24s", c
);
160 char bp
[40]; /* UUID string is 36 chars + trailing '\0' */
164 ASSERT(bitoffs(bit
) == 0);
165 for (p
= (uuid_t
*)((char *)obj
+ byteize(bit
)), i
= 0;
166 i
< count
&& !seenint();
169 dbprintf("%d:", i
+ base
);
170 platform_uuid_unparse(p
, bp
);
179 * CRC is correct is the current buffer it is being pulled out
180 * of is not marked with a EFSCORRUPTED error.
198 switch (iocur_crc_valid()) {
209 ok
= "unknown state";
213 for (i
= 0, bitpos
= bit
;
214 i
< count
&& !seenint();
215 i
++, bitpos
+= size
) {
217 dbprintf("%d:", i
+ base
);
218 val
= getbitval(obj
, bitpos
, size
, BVUNSIGNED
);
220 dbprintf(fmtstr
, val
, ok
);
222 dbprintf(fmtstr
, (int32_t)val
, ok
);