xfs
[Top] [All Lists]

[PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxf

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c
From: "Kamal Dasu" <kdasu.kdev@xxxxxxxxx>
Date: Thu, 1 Mar 2012 16:11:24 -0500
Cc: "Kamal Dasu" <kdasu.kdev@xxxxxxxxx>
In-reply-to: <1330636285-11200-1-git-send-email-kdasu.kdev@xxxxxxxxx>
References: <1330636285-11200-1-git-send-email-kdasu.kdev@xxxxxxxxx>
>From the ustat man page

NOTES
       ustat() is deprecated and has only  been  provided  for  compatibility.
       All new programs should use statfs(2) instead.

Signed-off-by: Kamal Dasu <kdasu.kdev@xxxxxxxxx>
---
 libxfs/linux.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libxfs/linux.c b/libxfs/linux.c
index 2e07d54..b8cc028 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -21,7 +21,9 @@
 #include <mntent.h>
 #include <sys/stat.h>
 #undef ustat
-#include <sys/ustat.h>
+#include <sys/statfs.h>
+#include <sys/types.h>
+
 #include <sys/mount.h>
 #include <sys/ioctl.h>
 #include <sys/sysinfo.h>
@@ -50,7 +52,7 @@ int
 platform_check_ismounted(char *name, char *block, struct stat64 *s, int 
verbose)
 {
        /* Pad ust; pre-2.6.28 linux copies out too much in 32bit compat mode */
-       struct ustat    ust[2];
+       struct statfs   fst;
        struct stat64   st;
 
        if (!s) {
@@ -61,7 +63,7 @@ platform_check_ismounted(char *name, char *block, struct 
stat64 *s, int verbose)
                s = &st;
        }
 
-       if (ustat(s->st_rdev, ust) >= 0) {
+       if (statfs(block, &fst) >= 0) {
                if (verbose)
                        fprintf(stderr,
                                _("%s: %s contains a mounted filesystem\n"),
-- 
1.7.5.4


<Prev in Thread] Current Thread [Next in Thread>