#define Q_XQUOTARM XQM_CMD(0x6)
#define Q_XQUOTASYNC XQM_CMD(0x7)
-static const struct xlat quotacmds[] = {
- XLAT(Q_V1_QUOTAON),
- XLAT(Q_V1_QUOTAOFF),
- XLAT(Q_V1_GETQUOTA),
- XLAT(Q_V1_SETQUOTA),
- XLAT(Q_V1_SETUSE),
- XLAT(Q_V1_SYNC),
- XLAT(Q_SETQLIM),
- XLAT(Q_V1_GETSTATS),
- XLAT(Q_V1_RSQUASH),
-
- XLAT(Q_V2_GETQUOTA),
- XLAT(Q_V2_SETQUOTA),
- XLAT(Q_V2_SETUSE),
- XLAT(Q_V2_GETINFO),
- XLAT(Q_V2_SETINFO),
- XLAT(Q_V2_SETGRACE),
- XLAT(Q_V2_SETFLAGS),
- XLAT(Q_V2_GETSTATS),
-
- XLAT(Q_SYNC),
- XLAT(Q_QUOTAON),
- XLAT(Q_QUOTAOFF),
- XLAT(Q_GETFMT),
- XLAT(Q_GETINFO),
- XLAT(Q_SETINFO),
- XLAT(Q_GETQUOTA),
- XLAT(Q_SETQUOTA),
-
- XLAT(Q_XQUOTAON),
- XLAT(Q_XQUOTAOFF),
- XLAT(Q_XGETQUOTA),
- XLAT(Q_XSETQLIM),
- XLAT(Q_XGETQSTAT),
- XLAT(Q_XQUOTARM),
- XLAT(Q_XQUOTASYNC),
-
- XLAT_END
-};
+#include "xlat/quotacmds.h"
#define USRQUOTA 0
#define GRPQUOTA 1
-static const struct xlat quotatypes[] = {
- XLAT(USRQUOTA),
- XLAT(GRPQUOTA),
- XLAT_END
-};
+#include "xlat/quotatypes.h"
/* Quota format identifiers */
#define QFMT_VFS_OLD 1
#define QFMT_VFS_V0 2
-static const struct xlat quota_formats[] = {
- XLAT(QFMT_VFS_OLD),
- XLAT(QFMT_VFS_V0),
- XLAT_END
-};
+#include "xlat/quota_formats.h"
#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */
#define XFS_PROJ_QUOTA (1<<1) /* (IRIX) project quota type */
#define XFS_GROUP_QUOTA (1<<2) /* group quota type */
-static const struct xlat xfs_quota_flags[] = {
- XLAT(XFS_QUOTA_UDQ_ACCT),
- XLAT(XFS_QUOTA_UDQ_ENFD),
- XLAT(XFS_QUOTA_GDQ_ACCT),
- XLAT(XFS_QUOTA_GDQ_ENFD),
- XLAT_END
-};
-
-static const struct xlat xfs_dqblk_flags[] = {
- XLAT(XFS_USER_QUOTA),
- XLAT(XFS_PROJ_QUOTA),
- XLAT(XFS_GROUP_QUOTA),
- XLAT_END
-};
+#include "xlat/xfs_quota_flags.h"
+#include "xlat/xfs_dqblk_flags.h"
/*
* Following flags are used to specify which fields are valid
#define QIF_BTIME 16
#define QIF_ITIME 32
-static const struct xlat if_dqblk_valid[] = {
- XLAT(QIF_BLIMITS),
- XLAT(QIF_SPACE),
- XLAT(QIF_ILIMITS),
- XLAT(QIF_INODES),
- XLAT(QIF_BTIME),
- XLAT(QIF_ITIME),
- XLAT_END
-};
+#include "xlat/if_dqblk_valid.h"
struct if_dqblk
{
#define IIF_IGRACE 2
#define IIF_FLAGS 4
-static const struct xlat if_dqinfo_valid[] = {
- XLAT(IIF_BGRACE),
- XLAT(IIF_IGRACE),
- XLAT(IIF_FLAGS),
- XLAT_END
-};
+#include "xlat/if_dqinfo_valid.h"
struct if_dqinfo
{
{
struct if_dqblk dq;
- if (cmd == Q_GETQUOTA && syserror(tcp)) {
- tprintf("%#lx", data);
- break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
tprintf("{bhardlimit=%" PRIu64 ", ", dq.dqb_bhardlimit);
tprintf("bsoftlimit=%" PRIu64 ", ", dq.dqb_bsoftlimit);
tprintf("curspace=%" PRIu64 ", ", dq.dqb_curspace);
{
struct v1_dqblk dq;
- if (cmd == Q_V1_GETQUOTA && syserror(tcp)) {
- tprintf("%#lx", data);
- break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
tprintf("{bhardlimit=%u, ", dq.dqb_bhardlimit);
tprintf("bsoftlimit=%u, ", dq.dqb_bsoftlimit);
tprintf("curblocks=%u, ", dq.dqb_curblocks);
{
struct v2_dqblk dq;
- if (cmd == Q_V2_GETQUOTA && syserror(tcp)) {
- tprintf("%#lx", data);
- break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
tprintf("{ihardlimit=%u, ", dq.dqb_ihardlimit);
tprintf("isoftlimit=%u, ", dq.dqb_isoftlimit);
tprintf("curinodes=%u, ", dq.dqb_curinodes);
{
struct xfs_dqblk dq;
- if (cmd == Q_XGETQUOTA && syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprintf("{version=%d, ", dq.d_version);
tprints("flags=");
printflags(xfs_dqblk_flags,
{
u_int32_t fmt;
- if (syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &fmt))
break;
- }
- if (umove(tcp, data, &fmt) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprints("{");
printxval(quota_formats, fmt, "QFMT_VFS_???");
tprints("}");
{
struct if_dqinfo dq;
- if (cmd == Q_GETINFO && syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprintf("{bgrace=%" PRIu64 ", ", dq.dqi_bgrace);
tprintf("igrace=%" PRIu64 ", ", dq.dqi_igrace);
tprintf("flags=%#x, ", dq.dqi_flags);
{
struct v2_dqinfo dq;
- if (cmd == Q_V2_GETINFO && syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprintf("{bgrace=%u, ", dq.dqi_bgrace);
tprintf("igrace=%u, ", dq.dqi_igrace);
tprintf("flags=%#x, ", dq.dqi_flags);
{
struct v1_dqstats dq;
- if (syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprintf("{lookups=%u, ", dq.lookups);
tprintf("drops=%u, ", dq.drops);
tprintf("reads=%u, ", dq.reads);
{
struct v2_dqstats dq;
- if (syserror(tcp)) {
- tprintf("%#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
- break;
- }
tprintf("{lookups=%u, ", dq.lookups);
tprintf("drops=%u, ", dq.drops);
tprintf("reads=%u, ", dq.reads);
{
struct xfs_dqstats dq;
- if (syserror(tcp)) {
- tprintf("%#lx", data);
- break;
- }
- if (umove(tcp, data, &dq) < 0) {
- tprintf("{???} %#lx", data);
+ if (umove_or_printaddr(tcp, data, &dq))
break;
- }
tprintf("{version=%d, ", dq.qs_version);
if (abbrev(tcp)) {
tprints("...}");
{
u_int32_t flag;
- if (umove(tcp, data, &flag) < 0) {
- tprintf("{???} %#lx", data);
+ if (umove_or_printaddr(tcp, data, &flag))
break;
- }
tprints("{");
printflags(xfs_quota_flags, flag, "XFS_QUOTA_???");
tprints("}");
break;
}
default:
- tprintf("%#lx", data);
+ printaddr(data);
break;
}
}
-int
-sys_quotactl(struct tcb *tcp)
+SYS_FUNC(quotactl)
{
/*
* The Linux kernel only looks at the low 32 bits of command and id
u_int32_t type = QCMD_TYPE(qcmd);
u_int32_t id = tcp->u_arg[2];
- if (!verbose(tcp))
- return printargs(tcp);
-
if (entering(tcp)) {
printxval(quotacmds, cmd, "Q_???");
tprints("|");
case Q_V1_GETQUOTA:
case Q_V2_GETQUOTA:
case Q_GETQUOTA:
+ case Q_XGETQUOTA:
+ tprintf("%u", id);
+ break;
+ case Q_SETQLIM:
+ case Q_SETQUOTA:
case Q_V1_SETQUOTA:
- case Q_V2_SETQUOTA:
case Q_V1_SETUSE:
+ case Q_V2_SETQUOTA:
case Q_V2_SETUSE:
- case Q_SETQLIM:
- case Q_SETQUOTA:
- case Q_XGETQUOTA:
case Q_XSETQLIM:
- tprintf("%u", id);
+ tprintf("%u, ", id);
+ case Q_SETINFO:
+ case Q_V2_SETFLAGS:
+ case Q_V2_SETGRACE:
+ case Q_V2_SETINFO:
+ decode_cmd_data(tcp, cmd, tcp->u_arg[3]);
+ return RVAL_DECODED;
break;
default:
- tprintf("%#lx", tcp->u_arg[2]);
+ printaddr(tcp->u_arg[2]);
break;
}
tprints(", ");
} else {
- if (!tcp->u_arg[3])
- tprints("NULL");
- else
- decode_cmd_data(tcp, cmd, tcp->u_arg[3]);
+ decode_cmd_data(tcp, cmd, tcp->u_arg[3]);
}
return 0;
}