public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: [PATCH v3 3/3] statvfs: f_type: NEWS & test
Date: Mon, 3 Jul 2023 16:59:22 +0200	[thread overview]
Message-ID: <a9431732555c1de953667ffc339acd8655504323.1688396342.git.nabijaczleweli@nabijaczleweli.xyz> (raw)
In-Reply-To: <ca240bb2a47373f3d98a4c05c6d2b87a001f1cbe.1688396342.git.nabijaczleweli@nabijaczleweli.xyz>

[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]

Also fix tst-statvfs so that it actually fails;
as it stood, all it did was return 0 always.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 NEWS             |  5 +++++
 io/tst-statvfs.c | 19 +++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 709ee40e50..fc2392f168 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,11 @@ Major new features:
 * The strlcpy and strlcat functions have been added.  They are derived
   from OpenBSD, and are expected to be added to a future POSIX version.
 
+* struct statvfs now has an f_type member, equal to the f_type statfs member;
+  on the Hurd this was always available under a reserved name,
+  and under Linux a spare has been allocated: it was always zero
+  in previous versions of glibc, and zero is not a valid result.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * In the Linux kernel for the hppa/parisc architecture some of the
diff --git a/io/tst-statvfs.c b/io/tst-statvfs.c
index 227c62d7da..b38ecae466 100644
--- a/io/tst-statvfs.c
+++ b/io/tst-statvfs.c
@@ -1,5 +1,7 @@
 #include <stdio.h>
+#include <sys/statfs.h>
 #include <sys/statvfs.h>
+#include <support/check.h>
 
 
 /* This test cannot detect many errors.  But it will fail if the
@@ -11,17 +13,18 @@ do_test (int argc, char *argv[])
   for (int i = 1; i < argc; ++i)
     {
       struct statvfs st;
-      if (statvfs (argv[i], &st) != 0)
-        printf ("%s: failed (%m)\n", argv[i]);
-      else
-        printf ("%s: free: %llu, mandatory: %s\n", argv[i],
-                (unsigned long long int) st.f_bfree,
+      struct statfs stf;
+      TEST_COMPARE (statvfs (argv[i], &st), 0);
+      TEST_COMPARE (statfs (argv[i], &stf), 0);
+      TEST_COMPARE (st.f_type, stf.f_type);
+      printf ("%s: free: %llu, mandatory: %s\n", argv[i],
+              (unsigned long long int) st.f_bfree,
 #ifdef ST_MANDLOCK
-                (st.f_flag & ST_MANDLOCK) ? "yes" : "no"
+              (st.f_flag & ST_MANDLOCK) ? "yes" : "no"
 #else
-                "no"
+              "no"
 #endif
-                );
+              );
     }
   return 0;
 }
-- 
2.39.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2023-07-03 14:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 14:59 [PATCH v3 1/3] hurd: statvfs: __f_type -> f_type наб
2023-07-03 14:59 ` [PATCH v3 2/3] linux: statvfs: allocate spare for f_type наб
2023-07-21 13:03   ` Adhemerval Zanella Netto
2023-07-21 15:34     ` наб
2023-07-23 19:10       ` Adhemerval Zanella Netto
2023-07-03 14:59 ` наб [this message]
2023-07-21 13:04   ` [PATCH v3 3/3] statvfs: f_type: NEWS & test Adhemerval Zanella Netto
2023-08-15  9:15   ` Florian Weimer
2023-08-15 11:54     ` Adhemerval Zanella Netto
2023-08-15 12:41       ` Florian Weimer
2023-08-15 12:48         ` Adhemerval Zanella Netto
2023-08-15 13:07         ` наб
2023-08-15 14:23           ` Florian Weimer
2023-08-15 14:37             ` наб
2023-08-15 15:09               ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9431732555c1de953667ffc339acd8655504323.1688396342.git.nabijaczleweli@nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).