<div dir="ltr">I haven't checked decoding of successful quotaclt-xfs(,-v) because for now I don't know how to solve or workaround the alignment problems described in my status report #4. I'm doing research but I' m not sure what I can find eventually (considering there is already a structure <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">fs_quota_statv with appropriate layout)</span>. Any suggestions or guidance?</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 15, 2018 at 3:58 PM Zhibin Li <<a href="mailto:08826794brmt@gmail.com" target="_blank">08826794brmt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">* quotactl-xfs.c: Fix disorder of PRINT_FIELD_U and check_quota function<br>
invocations; use check_quota function for invalid commands; remove unused<br>
variable rc.<br>
(invalid_cmd): New variable.<br>
---<br>
 tests/quotactl-xfs.c | 39 ++++++++++++++++++++++++---------------<br>
 1 file changed, 24 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/tests/quotactl-xfs.c b/tests/quotactl-xfs.c<br>
index fab451e2..c08b1584 100644<br>
--- a/tests/quotactl-xfs.c<br>
+++ b/tests/quotactl-xfs.c<br>
@@ -142,14 +142,14 @@ print_xquota_stat(int rc, void *ptr, void *arg)<br>
 # if VERBOSE<br>
        printf(", qs_flags=");<br>
        printflags(xfs_quota_flags, qs->qs_flags, "XFS_QUOTA_???");<br>
+       PRINT_FIELD_U(", ", *qs, qs_incoredqs);<br>
        PRINT_FIELD_U(", qs_uquota={", qs->qs_uquota, qfs_ino);<br>
        PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nblks);<br>
        PRINT_FIELD_U(", ", qs->qs_uquota, qfs_nextents);<br>
        PRINT_FIELD_U("}, qs_gquota={", qs->qs_gquota, qfs_ino);<br>
        PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nblks);<br>
        PRINT_FIELD_U(", ", qs->qs_gquota, qfs_nextents);<br>
-       PRINT_FIELD_U("}, ", *qs, qs_incoredqs);<br>
-       PRINT_FIELD_D(", ", *qs, qs_btimelimit);<br>
+       PRINT_FIELD_D("}, ", *qs, qs_btimelimit);<br>
        PRINT_FIELD_D(", ", *qs, qs_itimelimit);<br>
        PRINT_FIELD_D(", ", *qs, qs_rtbtimelimit);<br>
        PRINT_FIELD_U(", ", *qs, qs_bwarnlimit);<br>
@@ -207,7 +207,7 @@ main(void)<br>
        char bogus_addr_str[sizeof(void *) * 2 + sizeof("0x")];<br>
        char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];<br>
<br>
-       long rc;<br>
+       static char invalid_cmd[1024];<br>
        TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_disk_quota, xdq);<br>
        TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_quota_stat, xqstat);<br>
        TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_quota_statv, xqstatv);<br>
@@ -234,12 +234,12 @@ main(void)<br>
                    "|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD"<br>
                    "|XFS_QUOTA_PDQ_ENFD|0xdeadbec0]");<br>
<br>
-       rc = syscall(__NR_quotactl, QCMD(Q_XQUOTAON, 0xfacefeed), bogus_dev,<br>
-                    bogus_id, bogus_addr);<br>
-       printf("quotactl(QCMD(Q_XQUOTAON, %#x /* ???QUOTA */)"<br>
-              ", %s, %p) = %s\n",<br>
-              QCMD_TYPE(QCMD(Q_XQUOTAON, 0xfacefeed)),<br>
-              bogus_dev_str, bogus_addr, sprintrc(rc));<br>
+       snprintf(invalid_cmd, sizeof(invalid_cmd),<br>
+                "QCMD(Q_XQUOTAON, %#x /* ???QUOTA */)",<br>
+                QCMD_TYPE(QCMD(Q_XQUOTAON, 0xfacefeed)));<br>
+       check_quota(CQF_ID_SKIP,<br>
+                   QCMD(Q_XQUOTAON, 0xfacefeed), invalid_cmd,<br>
+                   bogus_dev, bogus_dev_str, bogus_addr);<br>
<br>
<br>
        /* Q_XQUOTAOFF */<br>
@@ -264,11 +264,11 @@ main(void)<br>
        /* Q_XGETQUOTA */<br>
<br>
        /* Trying our best to get successful result */<br>
-       check_quota(CQF_ADDR_CB, ARG_STR(QCMD(Q_GETQUOTA, USRQUOTA)),<br>
+       check_quota(CQF_ADDR_CB, ARG_STR(QCMD(Q_XGETQUOTA, USRQUOTA)),<br>
                    ARG_STR("/dev/sda1"), getuid(), xdq, print_xdisk_quota,<br>
                    (intptr_t) 1);<br>
<br>
-       check_quota(CQF_ADDR_CB, ARG_STR(QCMD(Q_GETQUOTA, GRPQUOTA)),<br>
+       check_quota(CQF_ADDR_CB, ARG_STR(QCMD(Q_XGETQUOTA, GRPQUOTA)),<br>
                    ARG_STR(NULL), -1, xdq, print_xdisk_quota, (intptr_t) 2);<br>
<br>
<br>
@@ -298,21 +298,30 @@ main(void)<br>
                    ARG_STR("/dev/sda1"), xqstat, print_xquota_stat, (intptr_t) 1);<br>
<br>
        check_quota(CQF_ID_SKIP | CQF_ADDR_CB,<br>
-                   ARG_STR(QCMD(Q_XGETQSTATV, PRJQUOTA)),<br>
+                   ARG_STR(QCMD(Q_XGETQSTAT, USRQUOTA)),<br>
+                   ARG_STR("NULL"), xqstat, print_xquota_stat, (intptr_t) 2);<br>
+<br>
+       check_quota(CQF_ID_SKIP,<br>
+                   ARG_STR(QCMD(Q_XGETQSTAT, PRJQUOTA)),<br>
                    unterminated, unterminated_str,<br>
-                   xqstat + 1, print_xquota_stat, (intptr_t) 2);<br>
+                   xqstat + 1);<br>
<br>
<br>
        /* Q_XGETQSTATV */<br>
<br>
        check_quota(CQF_ID_SKIP | CQF_ADDR_CB,<br>
-                   ARG_STR(QCMD(Q_XGETQSTAT, USRQUOTA)),<br>
-                   ARG_STR("/dev/sda1"), xqstatv, print_xquota_statv, 1);<br>
+                   ARG_STR(QCMD(Q_XGETQSTATV, USRQUOTA)),<br>
+                   ARG_STR("/dev/sda1"), xqstatv, print_xquota_statv, (intptr_t) 1);<br>
<br>
        check_quota(CQF_ID_SKIP | CQF_ADDR_CB,<br>
                    ARG_STR(QCMD(Q_XGETQSTATV, GRPQUOTA)),<br>
                    ARG_STR(NULL), xqstatv, print_xquota_statv, (intptr_t) 2);<br>
<br>
+       check_quota(CQF_ID_SKIP,<br>
+                   ARG_STR(QCMD(Q_XGETQSTATV, PRJQUOTA)),<br>
+                   unterminated, unterminated_str,<br>
+                   xqstatv + 1);<br>
+<br>
<br>
        /* Q_XQUOTARM */<br>
<br>
-- <br>
2.14.4<br>
<br>
</blockquote></div>