Unify different generic PRINT_FIELD_* implementations
Create a new header print_fields.h and move generic PRINT_FIELD_* macros there. * print_fields.h: New file. * Makefile.am (strace_SOURCES): Add it. * netlink_sock_diag.c: Include "print_fields.h". (PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_COOKIE, PRINT_FIELD_FLAGS, PRINT_FIELD_XVAL): Move to print_fields.h file. * quota.c: Include "print_fields.h". (PRINT_FIELD_D): Move to print_fields.h file. (PRINT_FIELD_U, PRINT_FIELD_X): Remove. * statx.c: Include "print_fields.h". (PRINT_FIELD_U): Remove. (SYS_FUNC(statx)): Update PRINT_FIELD_U callers. * tests/quotactl.h: Include "print_fields.h". * tests/quotactl-xfs.c: Update callers of PRINT_FIELD_* macros. * tests/quotactl.c: Likewise. (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): Remove. * tests/test_nlattr.h: Include "print_fields.h". (PRINT_FIELD_U, PRINT_FIELD_X): Remove. * tests/xstatx.c: Include "print_fields.h". (PRINT_FIELD_U): Remove. (print_stat): Update PRINT_FIELD_U callers. * tests/tests.h [!STRACE_PRINTF] (STRACE_PRINTF): Define to printf.
This commit is contained in:
parent
373ff8cc4f
commit
26954f7753
@ -192,6 +192,7 @@ strace_SOURCES = \
|
||||
poll.c \
|
||||
prctl.c \
|
||||
print_dev_t.c \
|
||||
print_fields.h \
|
||||
print_mq_attr.c \
|
||||
print_msgbuf.c \
|
||||
print_sg_req_info.c \
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "defs.h"
|
||||
#include "netlink.h"
|
||||
#include "nlattr.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/inet_diag.h>
|
||||
@ -65,31 +66,6 @@
|
||||
#include "xlat/unix_diag_attrs.h"
|
||||
#include "xlat/unix_diag_show.h"
|
||||
|
||||
#define PRINT_FIELD_U(prefix_, where_, field_) \
|
||||
tprintf("%s%s=%llu", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_X(prefix_, where_, field_) \
|
||||
tprintf("%s%s=%#llx", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_COOKIE(prefix_, where_, field_) \
|
||||
tprintf("%s%s=[%llu, %llu]", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_[0]), \
|
||||
zero_extend_signed_to_ull((where_).field_[1]))
|
||||
|
||||
#define PRINT_FIELD_FLAGS(prefix_, where_, field_, xlat_, dflt_) \
|
||||
do { \
|
||||
tprintf("%s%s=", (prefix_), #field_); \
|
||||
printflags((xlat_), (where_).field_, (dflt_)); \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_FIELD_XVAL(prefix_, where_, field_, xlat_, dflt_) \
|
||||
do { \
|
||||
tprintf("%s%s=", (prefix_), #field_); \
|
||||
printxval((xlat_), (where_).field_, (dflt_)); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
decode_family(struct tcb *const tcp, const uint8_t family,
|
||||
const kernel_ulong_t addr, const kernel_ulong_t len)
|
||||
|
68
print_fields.h
Normal file
68
print_fields.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017 Dmitry V. Levin <ldv@altlinux.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef STRACE_PRINT_FIELDS_H
|
||||
#define STRACE_PRINT_FIELDS_H
|
||||
|
||||
/*
|
||||
* The printf-like function to use in header files
|
||||
* shared between strace and its tests.
|
||||
*/
|
||||
#ifndef STRACE_PRINTF
|
||||
# define STRACE_PRINTF tprintf
|
||||
#endif
|
||||
|
||||
#define PRINT_FIELD_D(prefix_, where_, field_) \
|
||||
STRACE_PRINTF("%s%s=%lld", (prefix_), #field_, \
|
||||
sign_extend_unsigned_to_ll((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_U(prefix_, where_, field_) \
|
||||
STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_X(prefix_, where_, field_) \
|
||||
STRACE_PRINTF("%s%s=%#llx", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_COOKIE(prefix_, where_, field_) \
|
||||
STRACE_PRINTF("%s%s=[%llu, %llu]", (prefix_), #field_, \
|
||||
zero_extend_signed_to_ull((where_).field_[0]), \
|
||||
zero_extend_signed_to_ull((where_).field_[1]))
|
||||
|
||||
#define PRINT_FIELD_FLAGS(prefix_, where_, field_, xlat_, dflt_) \
|
||||
do { \
|
||||
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
|
||||
printflags((xlat_), (where_).field_, (dflt_)); \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_FIELD_XVAL(prefix_, where_, field_, xlat_, dflt_) \
|
||||
do { \
|
||||
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
|
||||
printxval((xlat_), (where_).field_, (dflt_)); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !STRACE_PRINT_FIELDS_H */
|
13
quota.c
13
quota.c
@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
#define SUBCMDMASK 0x00ff
|
||||
#define SUBCMDSHIFT 8
|
||||
@ -153,18 +154,6 @@ struct fs_quota_statv {
|
||||
uint64_t qs_pad2[8];
|
||||
};
|
||||
|
||||
#define PRINT_FIELD_D(prefix, where, field) \
|
||||
tprintf("%s%s=%lld", (prefix), #field, \
|
||||
sign_extend_unsigned_to_ll((where).field))
|
||||
|
||||
#define PRINT_FIELD_U(prefix, where, field) \
|
||||
tprintf("%s%s=%llu", (prefix), #field, \
|
||||
zero_extend_signed_to_ull((where).field))
|
||||
|
||||
#define PRINT_FIELD_X(prefix, where, field) \
|
||||
tprintf("%s%s=%#llx", (prefix), #field, \
|
||||
zero_extend_signed_to_ull((where).field))
|
||||
|
||||
static int
|
||||
decode_cmd_data(struct tcb *tcp, uint32_t id, uint32_t cmd, kernel_ulong_t data)
|
||||
{
|
||||
|
22
statx.c
22
statx.c
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "print_fields.h"
|
||||
#include "statx.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
@ -54,9 +55,6 @@ SYS_FUNC(statx)
|
||||
printflags(statx_masks, tcp->u_arg[3], "STATX_???");
|
||||
tprints(", ");
|
||||
} else {
|
||||
#define PRINT_FIELD_U(field) \
|
||||
tprintf(", %s=%llu", #field, (unsigned long long) stx.field)
|
||||
|
||||
#define PRINT_FIELD_TIME(field) \
|
||||
do { \
|
||||
tprintf(", " #field "={tv_sec=%" PRId64 \
|
||||
@ -74,13 +72,13 @@ SYS_FUNC(statx)
|
||||
printflags(statx_masks, stx.stx_mask, "STATX_???");
|
||||
|
||||
if (!abbrev(tcp))
|
||||
PRINT_FIELD_U(stx_blksize);
|
||||
PRINT_FIELD_U(", ", stx, stx_blksize);
|
||||
|
||||
tprints(", stx_attributes=");
|
||||
printflags(statx_attrs, stx.stx_attributes, "STATX_ATTR_???");
|
||||
|
||||
if (!abbrev(tcp)) {
|
||||
PRINT_FIELD_U(stx_nlink);
|
||||
PRINT_FIELD_U(", ", stx, stx_nlink);
|
||||
printuid(", stx_uid=", stx.stx_uid);
|
||||
printuid(", stx_gid=", stx.stx_gid);
|
||||
}
|
||||
@ -89,12 +87,12 @@ SYS_FUNC(statx)
|
||||
print_symbolic_mode_t(stx.stx_mode);
|
||||
|
||||
if (!abbrev(tcp))
|
||||
PRINT_FIELD_U(stx_ino);
|
||||
PRINT_FIELD_U(", ", stx, stx_ino);
|
||||
|
||||
PRINT_FIELD_U(stx_size);
|
||||
PRINT_FIELD_U(", ", stx, stx_size);
|
||||
|
||||
if (!abbrev(tcp)) {
|
||||
PRINT_FIELD_U(stx_blocks);
|
||||
PRINT_FIELD_U(", ", stx, stx_blocks);
|
||||
|
||||
tprints(", stx_attributes_mask=");
|
||||
printflags(statx_attrs, stx.stx_attributes_mask,
|
||||
@ -104,10 +102,10 @@ SYS_FUNC(statx)
|
||||
PRINT_FIELD_TIME(stx_btime);
|
||||
PRINT_FIELD_TIME(stx_ctime);
|
||||
PRINT_FIELD_TIME(stx_mtime);
|
||||
PRINT_FIELD_U(stx_rdev_major);
|
||||
PRINT_FIELD_U(stx_rdev_minor);
|
||||
PRINT_FIELD_U(stx_dev_major);
|
||||
PRINT_FIELD_U(stx_dev_minor);
|
||||
PRINT_FIELD_U(", ", stx, stx_rdev_major);
|
||||
PRINT_FIELD_U(", ", stx, stx_rdev_minor);
|
||||
PRINT_FIELD_U(", ", stx, stx_dev_major);
|
||||
PRINT_FIELD_U(", ", stx, stx_dev_minor);
|
||||
} else {
|
||||
tprints(", ...");
|
||||
}
|
||||
|
@ -97,29 +97,29 @@ print_xdisk_quota(int rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_D("{", dq, d_version);
|
||||
PRINT_FIELD_D("{", *dq, d_version);
|
||||
printf(", d_flags=");
|
||||
printflags(xfs_dqblk_flags, (uint8_t) dq->d_flags, "XFS_???_QUOTA");
|
||||
|
||||
PRINT_FIELD_X(", ", dq, d_fieldmask);
|
||||
PRINT_FIELD_U(", ", dq, d_id);
|
||||
PRINT_FIELD_U(", ", dq, d_blk_hardlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_blk_softlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_ino_hardlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_ino_softlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_bcount);
|
||||
PRINT_FIELD_U(", ", dq, d_icount);
|
||||
PRINT_FIELD_X(", ", *dq, d_fieldmask);
|
||||
PRINT_FIELD_U(", ", *dq, d_id);
|
||||
PRINT_FIELD_U(", ", *dq, d_blk_hardlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_blk_softlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_ino_hardlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_ino_softlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_bcount);
|
||||
PRINT_FIELD_U(", ", *dq, d_icount);
|
||||
|
||||
# if VERBOSE
|
||||
PRINT_FIELD_D(", ", dq, d_itimer);
|
||||
PRINT_FIELD_D(", ", dq, d_btimer);
|
||||
PRINT_FIELD_U(", ", dq, d_iwarns);
|
||||
PRINT_FIELD_U(", ", dq, d_bwarns);
|
||||
PRINT_FIELD_U(", ", dq, d_rtb_hardlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_rtb_softlimit);
|
||||
PRINT_FIELD_U(", ", dq, d_rtbcount);
|
||||
PRINT_FIELD_D(", ", dq, d_rtbtimer);
|
||||
PRINT_FIELD_U(", ", dq, d_rtbwarns);
|
||||
PRINT_FIELD_D(", ", *dq, d_itimer);
|
||||
PRINT_FIELD_D(", ", *dq, d_btimer);
|
||||
PRINT_FIELD_U(", ", *dq, d_iwarns);
|
||||
PRINT_FIELD_U(", ", *dq, d_bwarns);
|
||||
PRINT_FIELD_U(", ", *dq, d_rtb_hardlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_rtb_softlimit);
|
||||
PRINT_FIELD_U(", ", *dq, d_rtbcount);
|
||||
PRINT_FIELD_D(", ", *dq, d_rtbtimer);
|
||||
PRINT_FIELD_U(", ", *dq, d_rtbwarns);
|
||||
# else
|
||||
printf(", ...");
|
||||
# endif /* !VERBOSE */
|
||||
@ -137,23 +137,23 @@ print_xquota_stat(int rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_D("{", qs, qs_version);
|
||||
PRINT_FIELD_D("{", *qs, qs_version);
|
||||
|
||||
# if VERBOSE
|
||||
printf(", qs_flags=");
|
||||
printflags(xfs_quota_flags, qs->qs_flags, "XFS_QUOTA_???");
|
||||
PRINT_FIELD_U(", qs_uquota={", &qs->qs_uquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", &qs->qs_uquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", &qs->qs_uquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_gquota={", &qs->qs_gquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", &qs->qs_gquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", &qs->qs_gquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, ", qs, qs_incoredqs);
|
||||
PRINT_FIELD_D(", ", qs, qs_btimelimit);
|
||||
PRINT_FIELD_D(", ", qs, qs_itimelimit);
|
||||
PRINT_FIELD_D(", ", qs, qs_rtbtimelimit);
|
||||
PRINT_FIELD_U(", ", qs, qs_bwarnlimit);
|
||||
PRINT_FIELD_U(", ", qs, qs_iwarnlimit);
|
||||
PRINT_FIELD_U(", qs_uquota={", qs->qs_uquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_gquota={", qs->qs_gquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, ", *qs, qs_incoredqs);
|
||||
PRINT_FIELD_D(", ", *qs, qs_btimelimit);
|
||||
PRINT_FIELD_D(", ", *qs, qs_itimelimit);
|
||||
PRINT_FIELD_D(", ", *qs, qs_rtbtimelimit);
|
||||
PRINT_FIELD_U(", ", *qs, qs_bwarnlimit);
|
||||
PRINT_FIELD_U(", ", *qs, qs_iwarnlimit);
|
||||
# else
|
||||
printf(", ...");
|
||||
# endif /* !VERBOSE */
|
||||
@ -171,26 +171,26 @@ print_xquota_statv(int rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_D("{", qs, qs_version);
|
||||
PRINT_FIELD_D("{", *qs, qs_version);
|
||||
|
||||
# if VERBOSE
|
||||
printf(", qs_flags=");
|
||||
printflags(xfs_quota_flags, qs->qs_flags, "XFS_QUOTA_???");
|
||||
PRINT_FIELD_U(", ", qs, qs_incoredqs);
|
||||
PRINT_FIELD_U(", qs_uquota={", &qs->qs_uquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", &qs->qs_uquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", &qs->qs_uquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_gquota={", &qs->qs_gquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", &qs->qs_gquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", &qs->qs_gquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_pquota={", &qs->qs_pquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", &qs->qs_pquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", &qs->qs_pquota, qfs_nextents);
|
||||
PRINT_FIELD_D("}, ", qs, qs_btimelimit);
|
||||
PRINT_FIELD_D(", ", qs, qs_itimelimit);
|
||||
PRINT_FIELD_D(", ", qs, qs_rtbtimelimit);
|
||||
PRINT_FIELD_U(", ", qs, qs_bwarnlimit);
|
||||
PRINT_FIELD_U(", ", qs, qs_iwarnlimit);
|
||||
PRINT_FIELD_U(", ", *qs, qs_incoredqs);
|
||||
PRINT_FIELD_U(", qs_uquota={", qs->qs_uquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_gquota={", qs->qs_gquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nextents);
|
||||
PRINT_FIELD_U("}, qs_pquota={", qs->qs_pquota, qfs_ino);
|
||||
PRINT_FIELD_U(", ", qs->qs_pquota, qfs_nblks);
|
||||
PRINT_FIELD_U(", ", qs->qs_pquota, qfs_nextents);
|
||||
PRINT_FIELD_D("}, ", *qs, qs_btimelimit);
|
||||
PRINT_FIELD_D(", ", *qs, qs_itimelimit);
|
||||
PRINT_FIELD_D(", ", *qs, qs_rtbtimelimit);
|
||||
PRINT_FIELD_U(", ", *qs, qs_bwarnlimit);
|
||||
PRINT_FIELD_U(", ", *qs, qs_iwarnlimit);
|
||||
# else
|
||||
printf(", ...");
|
||||
# endif /* !VERBOSE */
|
||||
|
@ -88,16 +88,16 @@ print_dqblk(long rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_U("{", db, dqb_bhardlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_bsoftlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_curspace);
|
||||
PRINT_FIELD_U(", ", db, dqb_ihardlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_isoftlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_curinodes);
|
||||
PRINT_FIELD_U("{", *db, dqb_bhardlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_bsoftlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_curspace);
|
||||
PRINT_FIELD_U(", ", *db, dqb_ihardlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_isoftlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_curinodes);
|
||||
|
||||
# if VERBOSE
|
||||
PRINT_FIELD_U(", ", db, dqb_btime);
|
||||
PRINT_FIELD_U(", ", db, dqb_itime);
|
||||
PRINT_FIELD_U(", ", *db, dqb_btime);
|
||||
PRINT_FIELD_U(", ", *db, dqb_itime);
|
||||
|
||||
printf(", dqb_valid=");
|
||||
printflags(if_dqblk_valid, db->dqb_valid, "QIF_???");
|
||||
@ -118,23 +118,23 @@ print_nextdqblk(long rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_U("{", db, dqb_bhardlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_bsoftlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_curspace);
|
||||
PRINT_FIELD_U(", ", db, dqb_ihardlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_isoftlimit);
|
||||
PRINT_FIELD_U(", ", db, dqb_curinodes);
|
||||
PRINT_FIELD_U("{", *db, dqb_bhardlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_bsoftlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_curspace);
|
||||
PRINT_FIELD_U(", ", *db, dqb_ihardlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_isoftlimit);
|
||||
PRINT_FIELD_U(", ", *db, dqb_curinodes);
|
||||
|
||||
# if VERBOSE
|
||||
PRINT_FIELD_U(", ", db, dqb_btime);
|
||||
PRINT_FIELD_U(", ", db, dqb_itime);
|
||||
PRINT_FIELD_U(", ", *db, dqb_btime);
|
||||
PRINT_FIELD_U(", ", *db, dqb_itime);
|
||||
|
||||
printf(", dqb_valid=");
|
||||
printflags(if_dqblk_valid, db->dqb_valid, "QIF_???");
|
||||
|
||||
PRINT_FIELD_U(", ", db, dqb_id);
|
||||
PRINT_FIELD_U(", ", *db, dqb_id);
|
||||
# else
|
||||
PRINT_FIELD_U(", ", db, dqb_id);
|
||||
PRINT_FIELD_U(", ", *db, dqb_id);
|
||||
printf(", ...");
|
||||
# endif /* !VERBOSE */
|
||||
printf("}");
|
||||
@ -151,8 +151,8 @@ print_dqinfo(long rc, void *ptr, void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
PRINT_FIELD_U("{", di, dqi_bgrace);
|
||||
PRINT_FIELD_U(", ", di, dqi_igrace);
|
||||
PRINT_FIELD_U("{", *di, dqi_bgrace);
|
||||
PRINT_FIELD_U(", ", *di, dqi_igrace);
|
||||
|
||||
printf(", dqi_flags=");
|
||||
printflags(if_dqinfo_flags, di->dqi_flags, "DQF_???");
|
||||
|
@ -34,6 +34,7 @@
|
||||
# include <inttypes.h>
|
||||
# include <stdarg.h>
|
||||
# include <stdio.h>
|
||||
# include "print_fields.h"
|
||||
|
||||
# ifdef HAVE_LINUX_QUOTA_H
|
||||
/* Broken in CentOS 5: has extern spinlock_t dq_data_lock; declaration */
|
||||
@ -57,18 +58,6 @@
|
||||
# define PRJQUOTA 2
|
||||
# endif
|
||||
|
||||
# define PRINT_FIELD_D(prefix, where, field) \
|
||||
printf("%s%s=%lld", (prefix), #field, \
|
||||
sign_extend_unsigned_to_ll((where)->field))
|
||||
|
||||
# define PRINT_FIELD_U(prefix, where, field) \
|
||||
printf("%s%s=%llu", (prefix), #field, \
|
||||
zero_extend_signed_to_ull((where)->field))
|
||||
|
||||
# define PRINT_FIELD_X(prefix, where, field) \
|
||||
printf("%s%s=%#llx", (prefix), #field, \
|
||||
zero_extend_signed_to_ull((where)->field))
|
||||
|
||||
typedef void (*print_cb)(long rc, void *addr, void *arg);
|
||||
|
||||
enum check_quotactl_flag_bits {
|
||||
|
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "tests.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -178,9 +179,3 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type)
|
||||
} \
|
||||
printf("]")); \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_FIELD_U(prefix_, where_, field_) \
|
||||
printf("%s%s=%u", (prefix_), #field_, ((where_).field_))
|
||||
|
||||
#define PRINT_FIELD_X(prefix_, where_, field_) \
|
||||
printf("%s%s=%#x", (prefix_), #field_, ((where_).field_))
|
||||
|
@ -37,6 +37,14 @@
|
||||
# include "kernel_types.h"
|
||||
# include "gcc_compat.h"
|
||||
|
||||
/*
|
||||
* The printf-like function to use in header files
|
||||
* shared between strace and its tests.
|
||||
*/
|
||||
#ifndef STRACE_PRINTF
|
||||
# define STRACE_PRINTF printf
|
||||
#endif
|
||||
|
||||
/* Tests of "strace -v" are expected to define VERBOSE to 1. */
|
||||
#ifndef VERBOSE
|
||||
# define VERBOSE 0
|
||||
|
@ -48,6 +48,7 @@
|
||||
# include <unistd.h>
|
||||
# include <sys/sysmacros.h>
|
||||
|
||||
# include "print_fields.h"
|
||||
# include "statx.h"
|
||||
|
||||
# ifndef STRUCT_STAT
|
||||
@ -200,9 +201,6 @@ print_stat(const STRUCT_STAT *st)
|
||||
static void
|
||||
print_stat(const STRUCT_STAT *st)
|
||||
{
|
||||
# define PRINT_FIELD_U(field) \
|
||||
printf(", %s=%llu", #field, (unsigned long long) st->field)
|
||||
|
||||
# define PRINT_FIELD_U32_UID(field) \
|
||||
do { \
|
||||
if (st->field == (uint32_t) -1) \
|
||||
@ -225,12 +223,12 @@ print_stat(const STRUCT_STAT *st)
|
||||
printf("{stx_mask=");
|
||||
printflags(statx_masks, st->stx_mask, "STATX_???");
|
||||
|
||||
PRINT_FIELD_U(stx_blksize);
|
||||
PRINT_FIELD_U(", ", *st, stx_blksize);
|
||||
|
||||
printf(", stx_attributes=");
|
||||
printflags(statx_attrs, st->stx_attributes, "STATX_ATTR_???");
|
||||
|
||||
PRINT_FIELD_U(stx_nlink);
|
||||
PRINT_FIELD_U(", ", *st, stx_nlink);
|
||||
PRINT_FIELD_U32_UID(stx_uid);
|
||||
PRINT_FIELD_U32_UID(stx_gid);
|
||||
|
||||
@ -239,9 +237,9 @@ print_stat(const STRUCT_STAT *st)
|
||||
printf("|");
|
||||
print_perms(st->stx_mode);
|
||||
|
||||
PRINT_FIELD_U(stx_ino);
|
||||
PRINT_FIELD_U(stx_size);
|
||||
PRINT_FIELD_U(stx_blocks);
|
||||
PRINT_FIELD_U(", ", *st, stx_ino);
|
||||
PRINT_FIELD_U(", ", *st, stx_size);
|
||||
PRINT_FIELD_U(", ", *st, stx_blocks);
|
||||
|
||||
printf(", stx_attributes_mask=");
|
||||
printflags(statx_attrs, st->stx_attributes_mask, "STATX_ATTR_???");
|
||||
@ -250,10 +248,10 @@ print_stat(const STRUCT_STAT *st)
|
||||
PRINT_FIELD_TIME(stx_btime);
|
||||
PRINT_FIELD_TIME(stx_ctime);
|
||||
PRINT_FIELD_TIME(stx_mtime);
|
||||
PRINT_FIELD_U(stx_rdev_major);
|
||||
PRINT_FIELD_U(stx_rdev_minor);
|
||||
PRINT_FIELD_U(stx_dev_major);
|
||||
PRINT_FIELD_U(stx_dev_minor);
|
||||
PRINT_FIELD_U(", ", *st, stx_rdev_major);
|
||||
PRINT_FIELD_U(", ", *st, stx_rdev_minor);
|
||||
PRINT_FIELD_U(", ", *st, stx_dev_major);
|
||||
PRINT_FIELD_U(", ", *st, stx_dev_minor);
|
||||
printf("}");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user