--- a/fsr/xfs_fsr.c +++ a/fsr/xfs_fsr.c @@ -44,6 +44,10 @@ #define _PATH_FSRLAST "/var/tmp/.fsrlast_xfs" #define _PATH_PROC_MOUNTS "/proc/mounts" +#ifndef _PATH_MOUNTED +#define _PATH_MOUNTED MOUNTED +#endif + char *progname; --- a/include/platform_defs.h.in +++ a/include/platform_defs.h.in @@ -68,6 +68,32 @@ typedef __u64 __bitwise __be64; typedef struct filldir filldir_t; +#ifndef __uint8_t +#define __uint8_t uint8_t +#endif +#ifndef __uint16_t +#define __uint16_t uint16_t +#endif +#ifndef __uint32_t +#define __uint32_t uint32_t +#endif +#ifndef __uint64_t +#define __uint64_t uint64_t +#endif + +#ifndef __int8_t +#define __int8_t int8_t +#endif +#ifndef __int16_t +#define __int16_t int16_t +#endif +#ifndef __int32_t +#define __int32_t int32_t +#endif +#ifndef __int64_t +#define __int64_t int64_t +#endif + #if defined(__linux__) #include #elif defined(__FreeBSD__) --- a/libhandle/handle.c +++ a/libhandle/handle.c @@ -20,6 +20,9 @@ #include #include #include +#if defined(__linux__) +#include +#endif /* just pick a value we know is more than big enough */ #define MAXHANSIZ 64 --- a/libhandle/jdm.c +++ a/libhandle/jdm.c @@ -20,6 +20,9 @@ #include #include #include +#if defined(__linux__) +#include +#endif /* internal fshandle - typecast to a void for external use */ #define FSHANDLE_SZ 8 --- a/libxfs/linux.c +++ a/libxfs/linux.c @@ -16,12 +16,9 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define ustat __kernel_ustat #include #include #include -#undef ustat -#include #include #include #include @@ -49,9 +46,12 @@ static int max_block_alignment; 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 stat64 st; + FILE *f; + struct stat64 mst; + struct mntent *mnt; + char mounts[MAXPATHLEN]; + int ismounted = 0; if (!s) { if (stat64(block, &st) < 0) @@ -61,14 +61,25 @@ platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose) s = &st; } - if (ustat(s->st_rdev, ust) >= 0) { + strcpy(mounts, (!access(PROC_MOUNTED, R_OK)) ? PROC_MOUNTED : MOUNTED); + if ((f = setmntent(mounts, "r")) == NULL) + return 0; + + while ((mnt = getmntent(f)) != NULL) { + if (stat64(mnt->mnt_dir, &mst) < 0) + continue; + if (mst.st_dev != s->st_rdev) + continue; + if (verbose) fprintf(stderr, _("%s: %s contains a mounted filesystem\n"), progname, name); - return 1; + ismounted = 1; + break; } - return 0; + endmntent(f); + return ismounted; } int --- ./repair/attr_repair.c.orig +++ ./repair/attr_repair.c @@ -24,6 +24,10 @@ #include "bmap.h" #include "protos.h" #include "dir2.h" +#if defined(__linux__) +#include +#endif + static int xfs_acl_valid(struct xfs_mount *mp, struct xfs_acl *daclp); static int xfs_mac_valid(xfs_mac_label_t *lp);