[PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>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


_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux