Commit 6e483f4b authored by Natanael Copa's avatar Natanael Copa

main/xfsprogs: fix building with musl libc

parent 35038f4a
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xfsprogs
pkgver=3.1.11
pkgrel=0
pkgrel=1
pkgdesc="XFS filesystem utilities"
url="http://oss.sgi.com/projects/xfs/"
arch="all"
......@@ -10,12 +10,18 @@ depends="e2fsprogs"
makedepends="e2fsprogs-dev bash"
subpackages="$pkgname-dev $pkgname-doc"
source="ftp://oss.sgi.com/projects/xfs/cmd_tars/${pkgname}-$pkgver.tar.gz
musl-fixes.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
update_config_sub || return 1
sed -i -e 's/--best//' Makefile doc/Makefile
}
......@@ -44,6 +50,9 @@ package() {
make -j1 DIST_ROOT="$pkgdir" install install-dev install-qa || return 1
rm "$pkgdir"/usr/lib/*.la "$pkgdir"/lib/*.la
}
md5sums="de9f1f45026c2f4e0776058d429ff4b6 xfsprogs-3.1.11.tar.gz"
sha256sums="adf4980177b5c890c1ca86b9c0e3e4d69a3f95bfc01746844280c2393cf4d6be xfsprogs-3.1.11.tar.gz"
sha512sums="6de16f0904709e53e6ceea8239e23b7e109375733fd712fd97bfbbf74ec7f1376147e61d1fbe498f1d5be2148bf8ca233c0577d5b88e9201bfd4bb87e696c28a xfsprogs-3.1.11.tar.gz"
md5sums="de9f1f45026c2f4e0776058d429ff4b6 xfsprogs-3.1.11.tar.gz
534a85a3afc1afd328975222ce43f4b7 musl-fixes.patch"
sha256sums="adf4980177b5c890c1ca86b9c0e3e4d69a3f95bfc01746844280c2393cf4d6be xfsprogs-3.1.11.tar.gz
b6488dfd3f419cdbcb7d259be1038df51ebff2799774bf643f9d7838ddc4c742 musl-fixes.patch"
sha512sums="6de16f0904709e53e6ceea8239e23b7e109375733fd712fd97bfbbf74ec7f1376147e61d1fbe498f1d5be2148bf8ca233c0577d5b88e9201bfd4bb87e696c28a xfsprogs-3.1.11.tar.gz
1cb52686cb2aa9b515feaa08f0b0e44decde7a5a61a3102a4c2ec9d7a3c9f1601c53308be039f717b8e999997b8222e76728bf45053330d3f820bfc040576074 musl-fixes.patch"
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 6f00b41..5b4af53 100644
--- a/fsr/xfs_fsr.c
+++ b/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;
diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index ac260bc..0e7fccf 100644
--- a/include/platform_defs.h.in
+++ b/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 <xfs/linux.h>
#elif defined(__FreeBSD__)
diff --git a/libhandle/handle.c b/libhandle/handle.c
index 9a232fa..1db7772 100644
--- a/libhandle/handle.c
+++ b/libhandle/handle.c
@@ -20,6 +20,9 @@
#include <xfs/xfs.h>
#include <xfs/handle.h>
#include <xfs/parent.h>
+#if defined(__linux__)
+#include <linux/limits.h>
+#endif
/* just pick a value we know is more than big enough */
#define MAXHANSIZ 64
diff --git a/libhandle/jdm.c b/libhandle/jdm.c
index 070407b..8dd6322 100644
--- a/libhandle/jdm.c
+++ b/libhandle/jdm.c
@@ -20,6 +20,9 @@
#include <xfs/handle.h>
#include <xfs/jdm.h>
#include <xfs/parent.h>
+#if defined(__linux__)
+#include <linux/limits.h>
+#endif
/* internal fshandle - typecast to a void for external use */
#define FSHANDLE_SZ 8
diff --git a/libxfs/linux.c b/libxfs/linux.c
index 2e07d54..4075786 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -16,12 +16,9 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define ustat __kernel_ustat
#include <xfs/libxfs.h>
#include <mntent.h>
#include <sys/stat.h>
-#undef ustat
-#include <sys/ustat.h>
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/sysinfo.h>
@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment