Line
Link Here
|
0 |
-- xfsprogs-3.1.10/libxfs/linux.c |
0 |
++ xfsprogs-3.1.10-statfs/libxfs/linux.c |
Lines 21-27
Link Here
|
21 |
#include <mntent.h> |
21 |
#include <mntent.h> |
22 |
#include <sys/stat.h> |
22 |
#include <sys/stat.h> |
23 |
#undef ustat |
23 |
#undef ustat |
24 |
#include <sys/ustat.h> |
24 |
#include <sys/statvfs.h> |
25 |
#include <sys/mount.h> |
25 |
#include <sys/mount.h> |
26 |
#include <sys/ioctl.h> |
26 |
#include <sys/ioctl.h> |
27 |
#include <sys/sysinfo.h> |
27 |
#include <sys/sysinfo.h> |
Lines 49-57
static int max_block_alignment;
Link Here
|
49 |
int |
49 |
int |
50 |
platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose) |
50 |
platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose) |
51 |
{ |
51 |
{ |
52 |
/* Pad ust; pre-2.6.28 linux copies out too much in 32bit compat mode */ |
52 |
struct statfs ust; |
53 |
struct ustat ust[2]; |
|
|
54 |
struct stat64 st; |
53 |
struct stat64 st; |
|
|
54 |
char mounts[MAXPATHLEN]; |
55 |
FILE* mtab; |
56 |
struct mntent* mnt; |
55 |
|
57 |
|
56 |
if (!s) { |
58 |
if (!s) { |
57 |
if (stat64(block, &st) < 0) |
59 |
if (stat64(block, &st) < 0) |
Lines 61-67
platform_check_ismounted(char *name, cha
Link Here
|
61 |
s = &st; |
63 |
s = &st; |
62 |
} |
64 |
} |
63 |
|
65 |
|
64 |
if (ustat(s->st_rdev, ust) >= 0) { |
66 |
if (strcmp(name, block) == 0) { |
|
|
67 |
/* Device node was passed as parameter. Find its mount point */ |
68 |
strcpy(mounts, (!access(PROC_MOUNTED, R_OK)) ? PROC_MOUNTED : MOUNTED); |
69 |
mtab = setmntent(mounts, "r"); |
70 |
if (mtab == NULL) { |
71 |
if (verbose) { |
72 |
fprintf(stderr, _("%s: %s contains a possibly mounted filesystem\n"), progname, name); |
73 |
} |
74 |
return 1; |
75 |
} |
76 |
else { |
77 |
mnt = getmntent(mtab); |
78 |
while (mnt != NULL) { |
79 |
if (strcmp(block, mnt->mnt_fsname) == 0) { |
80 |
if (verbose) { |
81 |
fprintf(stderr, _("%s: %s contains a mounted filesystem\n"), progname, name); |
82 |
} |
83 |
endmntent(mtab); |
84 |
return 1; |
85 |
} |
86 |
mnt = getmntent(mtab); |
87 |
} |
88 |
endmntent(mtab); |
89 |
} |
90 |
} |
91 |
else if (statfs(name, &ust) >= 0) { |
65 |
if (verbose) |
92 |
if (verbose) |
66 |
fprintf(stderr, |
93 |
fprintf(stderr, |
67 |
_("%s: %s contains a mounted filesystem\n"), |
94 |
_("%s: %s contains a mounted filesystem\n"), |