All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] xfsprogs: Partial OS X support
@ 2015-07-20 12:56 Jan Tulak
  2015-07-20 12:56 ` [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_ Jan Tulak
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Jan Tulak @ 2015-07-20 12:56 UTC (permalink / raw)
  To: xfs; +Cc: Jan Tulak

These patches fixes the current broken OS X support of xfsprogs.
The goal is to make xfsprogs buildable on current OS X Yosemite,
and to have a working mkfs.xfs. The usage is indeed limited but 
"it works".

This v2 fixes known issues from the first patchset and builds
entire xfsprogs.

Jan Tulak (4):
  xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  xfsprogs: Don't Make .po files with gettext disabled
  xfsprogs: Use glibtoolize on osx
  xfsprogs: OS X partial support

 Makefile              |  19 +++++-
 configure.ac          |   1 +
 fsr/xfs_fsr.c         |  20 +++++-
 include/bitops.h      |   2 +
 include/builddefs.in  |   6 +-
 include/darwin.h      | 168 ++++++++++++++++++++++++++++++++++++++++++++------
 include/list.h        |   6 +-
 io/readdir.c          |   4 ++
 libdisk/fstype.c      |   1 +
 libhandle/Makefile    |   4 ++
 libxcmd/paths.c       |   2 +-
 m4/package_libcdev.m4 |  14 +++++
 repair/phase6.c       |   2 +-
 13 files changed, 218 insertions(+), 31 deletions(-)

-- 
2.4.3

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  2015-07-20 12:56 [PATCH v2 0/4] xfsprogs: Partial OS X support Jan Tulak
@ 2015-07-20 12:56 ` Jan Tulak
  2015-08-02 23:42   ` Dave Chinner
  2015-07-20 12:56 ` [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled Jan Tulak
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Jan Tulak @ 2015-07-20 12:56 UTC (permalink / raw)
  To: xfs; +Cc: Jan Tulak

OS X has some conflicting LIST_ macros, so prefix the XFS ones.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 include/list.h  | 6 +++---
 repair/phase6.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/list.h b/include/list.h
index 3f087a4..7e9f748 100644
--- a/include/list.h
+++ b/include/list.h
@@ -27,10 +27,10 @@ struct list_head {
 	struct list_head *prev;
 };
 
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
+#define XFS_LIST_HEAD_INIT(name) { &(name), &(name) }
 
-#define LIST_HEAD(name) \
-		struct list_head name = LIST_HEAD_INIT(name)
+#define XFS_LIST_HEAD(name) \
+		struct list_head name = XFS_LIST_HEAD_INIT(name)
 
 #define INIT_LIST_HEAD(list) list_head_init(list)
 static inline void list_head_init(struct list_head *list)
diff --git a/repair/phase6.c b/repair/phase6.c
index 9a5cba7..87732e1 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -49,7 +49,7 @@ typedef struct dotdot_update {
 	int			ino_offset;
 } dotdot_update_t;
 
-static LIST_HEAD(dotdot_update_list);
+static XFS_LIST_HEAD(dotdot_update_list);
 static int			dotdot_update;
 
 static void
-- 
2.4.3

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled
  2015-07-20 12:56 [PATCH v2 0/4] xfsprogs: Partial OS X support Jan Tulak
  2015-07-20 12:56 ` [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_ Jan Tulak
@ 2015-07-20 12:56 ` Jan Tulak
  2015-07-26 16:28   ` Christoph Hellwig
  2015-07-20 12:56 ` [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx Jan Tulak
  2015-07-20 12:56 ` [PATCH v2 4/4] xfsprogs: OS X partial support Jan Tulak
  3 siblings, 1 reply; 13+ messages in thread
From: Jan Tulak @ 2015-07-20 12:56 UTC (permalink / raw)
  To: xfs; +Cc: Jan Tulak

"po" target is added only if gettext binary is found.
Without this patch, Make tried to build the target even
with --enable-gettext=no configure option, which led
to a failing build.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6d6803b..3da4d5d 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,11 @@ HDR_SUBDIRS = include libxfs
 DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk
 LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS)
 TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
-		mdrestore repair rtcp m4 man doc po debian
+		mdrestore repair rtcp m4 man doc debian
+
+ifneq ("$(XGETTEXT)","")
+TOOL_SUBDIRS += po
+endif
 
 # include is listed last so it is processed last in clean rules.
 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
-- 
2.4.3

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx
  2015-07-20 12:56 [PATCH v2 0/4] xfsprogs: Partial OS X support Jan Tulak
  2015-07-20 12:56 ` [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_ Jan Tulak
  2015-07-20 12:56 ` [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled Jan Tulak
@ 2015-07-20 12:56 ` Jan Tulak
  2015-07-26 16:29   ` Christoph Hellwig
  2015-07-20 12:56 ` [PATCH v2 4/4] xfsprogs: OS X partial support Jan Tulak
  3 siblings, 1 reply; 13+ messages in thread
From: Jan Tulak @ 2015-07-20 12:56 UTC (permalink / raw)
  To: xfs; +Cc: Jan Tulak

OS X doesn't have libtoolize binary by default, and the available$
ports are named "glibtoolize". Autodetect this issue.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 Makefile | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3da4d5d..4abaaac 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,14 @@ ifneq ("$(XGETTEXT)","")
 TOOL_SUBDIRS += po
 endif
 
+# If we are on OS X, use glibtoolize from MacPorts, as OS X doesn't have
+# libtoolize binary itself.
+LIBTOOLIZE_TEST=$(shell libtoolize --version >/dev/null 2>&1 && echo found)
+LIBTOOLIZE_BIN=libtoolize
+ifneq ("$(LIBTOOLIZE_TEST)","found")
+LIBTOOLIZE_BIN=glibtoolize
+endif
+
 # include is listed last so it is processed last in clean rules.
 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
 
@@ -85,13 +93,14 @@ else
 clean:	# if configure hasn't run, nothing to clean
 endif
 
+
 # Recent versions of libtool require the -i option for copying auxiliary
 # files (config.sub, config.guess, install-sh, ltmain.sh), while older
 # versions will copy those files anyway, and don't understand -i.
-LIBTOOLIZE_INSTALL = `libtoolize -n -i >/dev/null 2>/dev/null && echo -i`
+LIBTOOLIZE_INSTALL = `$(LIBTOOLIZE_BIN) -n -i >/dev/null 2>/dev/null && echo -i`
 
 configure:
-	libtoolize -c $(LIBTOOLIZE_INSTALL) -f
+	$(LIBTOOLIZE_BIN) -c $(LIBTOOLIZE_INSTALL) -f
 	cp include/install-sh .
 	aclocal -I m4
 	autoconf
-- 
2.4.3

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/4] xfsprogs: OS X partial support
  2015-07-20 12:56 [PATCH v2 0/4] xfsprogs: Partial OS X support Jan Tulak
                   ` (2 preceding siblings ...)
  2015-07-20 12:56 ` [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx Jan Tulak
@ 2015-07-20 12:56 ` Jan Tulak
  2015-07-26 16:34   ` Christoph Hellwig
  3 siblings, 1 reply; 13+ messages in thread
From: Jan Tulak @ 2015-07-20 12:56 UTC (permalink / raw)
  To: xfs; +Cc: Jan Tulak

This patch introduces changes to support current OS X (10.10 Yosemite).
The previous OS X code base is about 4 years old and both OS X and
XFS changed, so there had to be done some work to make it compilable.

- xfs_repair currently has only a dummy timer implementation
- fsr and io, as tools working with a mounted XFS, are
  really not expected to work - lots of dummy functions
- Various other edits  - some API translations, some missing
  defines.

The code compiles using Apple's clang, although it throws some
warnings. Some of them are complaints about deprecated calls, some
are false-positives and there are also some incompatible type
assignments/comparisons. Fixing these looks like an ugly work,
but fortunately, incompatible assignments are only in the tools
not expected to work anyway (fsr and io).

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 configure.ac          |   1 +
 fsr/xfs_fsr.c         |  20 +++++-
 include/bitops.h      |   2 +
 include/builddefs.in  |   6 +-
 include/darwin.h      | 168 ++++++++++++++++++++++++++++++++++++++++++++------
 io/readdir.c          |   4 ++
 libdisk/fstype.c      |   1 +
 libhandle/Makefile    |   4 ++
 libxcmd/paths.c       |   2 +-
 m4/package_libcdev.m4 |  14 +++++
 10 files changed, 198 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index fe991cc..8f966a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,7 @@ AC_HAVE_PREADV
 AC_HAVE_SYNC_FILE_RANGE
 AC_HAVE_BLKID_TOPO($enable_blkid)
 AC_HAVE_READDIR
+AC_HAVE_FLS
 
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([char *])
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index efc17a8..a069bd7 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -25,16 +25,22 @@
 
 #include <fcntl.h>
 #include <errno.h>
-#include <malloc.h>
-#include <mntent.h>
 #include <syslog.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/wait.h>
-#include <sys/vfs.h>
 #include <sys/statvfs.h>
 #include <sys/xattr.h>
 
+#ifndef PLATFORM_HAS_NO_MALLOC_H
+#  include <malloc.h>
+#endif
+#ifndef PLATFORM_HAS_NO_MNTENT_H
+#  include <mntent.h>
+#endif
+#ifndef PLATFORM_HAS_NO_VFS_H
+#  include <sys/vfs.h>
+#endif
 
 #ifndef XFS_XFLAG_NODEFRAG
 #define XFS_XFLAG_NODEFRAG 0x00002000 /* src dependancy, remove later */
@@ -43,6 +49,14 @@
 #define _PATH_FSRLAST		"/var/tmp/.fsrlast_xfs"
 #define _PATH_PROC_MOUNTS	"/proc/mounts"
 
+#ifdef USE_DUMMY_XATTR
+	/* OS X has fsetxattr with different number of arguments.
+	 * Because it won't work anyway (no fstab/mtab and so on),
+	 * hijack the call to a dummy function so it can at least
+	 * compile.
+	 */
+#  define fsetxattr(a,b,c,d,e) dummy_fsetxattr(a,b,c,d,e)
+#endif
 
 char *progname;
 
diff --git a/include/bitops.h b/include/bitops.h
index 930f64a..44599a7 100644
--- a/include/bitops.h
+++ b/include/bitops.h
@@ -5,6 +5,7 @@
  * fls: find last bit set.
  */
 
+#ifndef HAVE_FLS
 static inline int fls(int x)
 {
 	int r = 32;
@@ -32,6 +33,7 @@ static inline int fls(int x)
 	}
 	return r;
 }
+#endif /* HAVE_FLS */
 
 static inline int fls64(__u64 x)
 {
diff --git a/include/builddefs.in b/include/builddefs.in
index 7e9f53d..9feb096 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -104,6 +104,7 @@ HAVE_FIEMAP = @have_fiemap@
 HAVE_PREADV = @have_preadv@
 HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
 HAVE_READDIR = @have_readdir@
+HAVE_FLS = @have_fls@
 
 GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall 
 #	   -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
@@ -119,7 +120,7 @@ ifeq ($(PKG_PLATFORM),gnukfreebsd)
 PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS)
 endif
 ifeq ($(PKG_PLATFORM),darwin)
-PCFLAGS = -traditional-cpp $(GCCFLAGS)
+PCFLAGS = $(GCCFLAGS)
 DEPENDFLAGS = -D__APPLE__
 endif
 ifeq ($(PKG_PLATFORM),irix)
@@ -131,6 +132,9 @@ PLDLIBS = -L/usr/local/lib -lintl
 PCFLAGS = -I/usr/local/include $(GCCFLAGS)
 DEPENDFLAGS = -D__FreeBSD__
 endif
+ifeq ($(HAVE_FLS),yes)
+LCFLAGS+= -DHAVE_FLS
+endif
 
 GCFLAGS = $(OPTIMIZER) $(DEBUG) \
 	  -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\"  \
diff --git a/include/darwin.h b/include/darwin.h
index 30f0052..0d82872 100644
--- a/include/darwin.h
+++ b/include/darwin.h
@@ -18,17 +18,26 @@
 #ifndef __XFS_DARWIN_H__
 #define __XFS_DARWIN_H__
 
+#define PLATFORM_HAS_NO_MALLOC_H
+#define PLATFORM_HAS_NO_MNTENT_H
+#define PLATFORM_HAS_NO_VFS_H
+
 #include <uuid/uuid.h>
 #include <libgen.h>
 #include <sys/vm.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
+#include <sys/types.h>
+#include <ftw.h>
+#include <mach/mach_time.h>
+#include <inttypes.h>
+#include <stdio.h>
 
 #include <machine/endian.h>
-#define __BYTE_ORDER	BYTE_ORDER
-#define __BIG_ENDIAN	BIG_ENDIAN
-#define __LITTLE_ENDIAN	LITTLE_ENDIAN
+#define __BYTE_ORDER   BYTE_ORDER
+#define __BIG_ENDIAN   BIG_ENDIAN
+#define __LITTLE_ENDIAN        LITTLE_ENDIAN
 
 #include <sys/syscall.h>
 # ifndef SYS_fsctl
@@ -68,45 +77,37 @@ static __inline__ void platform_getoptreset(void)
 
 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
 {
-	return uuid_compare(uu1, uu2, NULL);
+	return uuid_compare((const unsigned char *) uu1, (const unsigned char*) uu2);
 }
 
 static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
 {
-	uint32_t status;
-	char *s;
-	uuid_to_string(uu, &s, &status);
-	if (status == uuid_s_ok)
-		strcpy(buffer, s);
-	else buffer[0] = '\0';
-	free(s);
+	uuid_unparse(*uu, buffer);
 }
 
 static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
 {
-	uint32_t status;
-	uuid_from_string(buffer, uu, &status);
-	return (status == uuid_s_ok);
+	return uuid_parse(buffer, *uu);
 }
 
 static __inline__ int platform_uuid_is_null(uuid_t *uu)
 {
-	return uuid_is_nil(uu, NULL);
+	return uuid_is_null(*uu);
 }
 
 static __inline__ void platform_uuid_generate(uuid_t *uu)
 {
-	uuid_create(uu, NULL);
+	uuid_generate(*uu);
 }
 
 static __inline__ void platform_uuid_clear(uuid_t *uu)
 {
-	uuid_create_nil(uu, NULL);
+	uuid_clear(*uu);
 }
 
 static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
 {
-	memcpy(dst, src, sizeof(uuid_t));
+	uuid_copy(*dst, *src);
 }
 
 #define __int8_t	int8_t
@@ -142,11 +143,13 @@ typedef int64_t		xfs_daddr_t;
 #define O_SYNC          0
 #endif
 
-#define ENOATTR		989     /* Attribute not found */
 #define EFSCORRUPTED	990	/* Filesystem is corrupted */
 #define EFSBADCRC	991	/* Bad CRC detected */
 #define constpp		char * const *
 
+#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
+#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */
+
 #define HAVE_FID	1
 
 static __inline__ int
@@ -155,4 +158,131 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)
 	return 0;
 }
 
+
+/*
+ * Dummy POSIX timer replacement
+ */
+#define CLOCK_REALTIME 1
+typedef uint64_t timer_t;
+typedef double   timer_c;
+typedef clock_id_t clockid_t;
+struct itimerspec
+  {
+    struct timespec it_interval;
+    struct timespec it_value;
+  };
+
+static inline int timer_create (clockid_t __clock_id,
+                         struct sigevent *__restrict __evp,
+                         timer_t *__restrict __timerid)
+{
+	return 0;
+}
+
+static inline int timer_settime (timer_t __timerid, int __flags,
+                          const struct itimerspec *__restrict __value,
+                          struct itimerspec *__restrict __ovalue)
+{
+	return 0;
+}
+
+static inline int timer_delete (timer_t __timerid)
+{
+	return 0;
+}
+
+static inline int timer_gettime (timer_t __timerid, struct itimerspec *__value)
+{
+	return 0;
+}
+
+static inline int nftw64(const char *path, int (*fn)(const char *, const struct stat *ptr, int flag, struct FTW *), int depth,
+         int flags)
+{
+	return nftw(path, fn, depth, flags);
+}
+
+#define MREMAP_FIXED 1
+#define MREMAP_MAYMOVE 2
+static inline void *mremap(void *old_address, size_t old_size,
+                    size_t new_size, int flags, ... /* void *new_address */)
+{
+	return NULL;
+}
+
+/* FSR */
+
+#define		_PATH_MOUNTED   "/etc/mtab"
+#define		USE_DUMMY_XATTR
+
+typedef int __fsblkcnt_t;
+typedef int __fsfilcnt_t;
+typedef long long int __fsblkcnt64_t;
+typedef long long int __fsfilcnt64_t;
+
+struct statvfs64
+{
+	unsigned long int f_bsize;
+	unsigned long int f_frsize;
+	__fsblkcnt64_t f_blocks;
+	__fsblkcnt64_t f_bfree;
+	__fsblkcnt64_t f_bavail;
+	__fsfilcnt64_t f_files;
+	__fsfilcnt64_t f_ffree;
+	__fsfilcnt64_t f_favail;
+	unsigned long int f_fsid;
+	int __f_unused;
+	unsigned long int f_flag;
+	unsigned long int f_namemax;
+	int __f_spare[6];
+};
+
+struct mntent
+{
+	char *mnt_fsname;		/* Device or server for filesystem.  */
+	char *mnt_dir;		/* Directory mounted on.  */
+	char *mnt_type;		/* Type of filesystem: ufs, nfs, etc.  */
+	char *mnt_opts;		/* Comma-separated options for fs.  */
+	int mnt_freq;		/* Dump frequency (in days).  */
+	int mnt_passno;		/* Pass number for `fsck'.  */
+};
+
+static inline FILE *setmntent(const char *filename, const char *type)
+{
+	return NULL;
+}
+
+static inline int endmntent(FILE *fp)
+{
+	return 0;
+}
+
+static inline struct mntent *getmntent(FILE *fp)
+{
+	return NULL;
+}
+
+static inline int addmntent(FILE *fp, const struct mntent *mnt)
+{
+	return 0;
+}
+
+static inline char *hasmntopt(const struct mntent *mnt, const char *opt)
+{
+	return NULL;
+}
+
+static inline int statvfs64 (const char *__restrict __file, 
+							 struct statvfs64 *__restrict __buf)
+{
+	return 0;
+}
+
+static inline int dummy_fsetxattr (int filedes, const char *name,
+                       const void *value, size_t size, int flags)
+{
+	return 0;
+}
+
+
 #endif	/* __XFS_DARWIN_H__ */
diff --git a/io/readdir.c b/io/readdir.c
index 20b8898..ed8f04d 100644
--- a/io/readdir.c
+++ b/io/readdir.c
@@ -104,12 +104,16 @@ read_directory(
 		if (!dirent)
 			break;
 
+#ifdef _DIRENT_HAVE_D_RECLEN
 		*total += dirent->d_reclen;
+#endif
 		count++;
 
 		if (dump) {
 			dump_dirent(offset, dirent);
+#ifdef _DIRENT_HAVE_D_OFF
 			offset = dirent->d_off;
+#endif
 		}
 	}
 
diff --git a/libdisk/fstype.c b/libdisk/fstype.c
index 548f297..c8bde34 100644
--- a/libdisk/fstype.c
+++ b/libdisk/fstype.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include "fstype.h"
 
 /*
diff --git a/libhandle/Makefile b/libhandle/Makefile
index 865ca22..0b5e1ad 100644
--- a/libhandle/Makefile
+++ b/libhandle/Makefile
@@ -10,7 +10,11 @@ LT_CURRENT = 1
 LT_REVISION = 3
 LT_AGE = 0
 
+ifeq ($(PKG_PLATFORM),darwin)
+LTLDFLAGS += -Wl,libhandle.sym
+else
 LTLDFLAGS += -Wl,--version-script,libhandle.sym
+endif
 
 CFILES = handle.c jdm.c
 LSRCFILES = libhandle.sym
diff --git a/libxcmd/paths.c b/libxcmd/paths.c
index c0b1ddb..b360617 100644
--- a/libxcmd/paths.c
+++ b/libxcmd/paths.c
@@ -364,7 +364,7 @@ fs_table_initialise_mounts(
 			continue;
 		if (!realpath(stats[i].f_mntfromname, rmntfromname))
 			continue;
-		if (!realpath(stats[i].f_mntonname, rmnttomname)))
+		if (!realpath(stats[i].f_mntonname, rmntonname))
 			continue;
 
 		if (path &&
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 919ae0a..d7f37ca 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -202,3 +202,17 @@ AC_DEFUN([AC_HAVE_READDIR],
     AC_SUBST(have_readdir)
   ])
 
+#
+# Check if we have a flc call (Mac OS X)
+#
+AC_DEFUN([AC_HAVE_FLS],
+  [ AC_MSG_CHECKING([for fls])
+    AC_TRY_LINK([
+#include <string.h>
+    ], [
+         fls(0);
+    ], have_fls=yes
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no))
+    AC_SUBST(have_fls)
+  ])
-- 
2.4.3

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled
  2015-07-20 12:56 ` [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled Jan Tulak
@ 2015-07-26 16:28   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2015-07-26 16:28 UTC (permalink / raw)
  To: Jan Tulak; +Cc: xfs

On Mon, Jul 20, 2015 at 02:56:56PM +0200, Jan Tulak wrote:
> "po" target is added only if gettext binary is found.
> Without this patch, Make tried to build the target even
> with --enable-gettext=no configure option, which led
> to a failing build.
> 
> Signed-off-by: Jan Tulak <jtulak@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx
  2015-07-20 12:56 ` [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx Jan Tulak
@ 2015-07-26 16:29   ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2015-07-26 16:29 UTC (permalink / raw)
  To: Jan Tulak; +Cc: xfs

On Mon, Jul 20, 2015 at 02:56:57PM +0200, Jan Tulak wrote:
> OS X doesn't have libtoolize binary by default, and the available$
> ports are named "glibtoolize". Autodetect this issue.
> 
> Signed-off-by: Jan Tulak <jtulak@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/4] xfsprogs: OS X partial support
  2015-07-20 12:56 ` [PATCH v2 4/4] xfsprogs: OS X partial support Jan Tulak
@ 2015-07-26 16:34   ` Christoph Hellwig
  2015-07-27 16:45     ` Jan Tulak
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2015-07-26 16:34 UTC (permalink / raw)
  To: Jan Tulak; +Cc: xfs

I think this needs to be split into one patch per issue.  A few comments
below:

> -#include <malloc.h>


malloc and friends need to be in stdlib.h per Posix, so the right
fix is to drop every include of malloc.h and mae sure we include
stdlib.h where needed.

> -#include <mntent.h>
>  #include <syslog.h>
>  #include <signal.h>
>  #include <sys/ioctl.h>
>  #include <sys/wait.h>
> -#include <sys/vfs.h>

sys/vfs.h is jsut an alias for sys/stafs.h, ut given that
this file doesn't even use statfs we can simply drop the include
unconditionally.

> +#ifndef PLATFORM_HAS_NO_MNTENT_H
> +#  include <mntent.h>
> +#endif

Why aren't you using the standard autoconf-generate include checks?

> +#ifdef _DIRENT_HAVE_D_RECLEN
>  		*total += dirent->d_reclen;
> +#endif
>  		count++;
>  
>  		if (dump) {
>  			dump_dirent(offset, dirent);
> +#ifdef _DIRENT_HAVE_D_OFF
>  			offset = dirent->d_off;
> +#endif

I'm pretty sure autoconf has a standard macro for this, try looking it
up in the autoconf manual.

> diff --git a/libxcmd/paths.c b/libxcmd/paths.c
> index c0b1ddb..b360617 100644
> --- a/libxcmd/paths.c
> +++ b/libxcmd/paths.c
> @@ -364,7 +364,7 @@ fs_table_initialise_mounts(
>  			continue;
>  		if (!realpath(stats[i].f_mntfromname, rmntfromname))
>  			continue;
> -		if (!realpath(stats[i].f_mntonname, rmnttomname)))
> +		if (!realpath(stats[i].f_mntonname, rmntonname))

I don't understand this change.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/4] xfsprogs: OS X partial support
  2015-07-26 16:34   ` Christoph Hellwig
@ 2015-07-27 16:45     ` Jan Tulak
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Tulak @ 2015-07-27 16:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs



----- Original Message -----
> From: "Christoph Hellwig" <hch@infradead.org>
> To: "Jan Tulak" <jtulak@redhat.com>
> Cc: xfs@oss.sgi.com
> Sent: Sunday, July 26, 2015 6:34:38 PM
> Subject: Re: [PATCH v2 4/4] xfsprogs: OS X partial support
> 
> I think this needs to be split into one patch per issue.  A few comments
> below:

Sure, I guess it is a good idea.

> 
> > -#include <malloc.h>
> 
> 
> malloc and friends need to be in stdlib.h per Posix, so the right
> fix is to drop every include of malloc.h and mae sure we include
> stdlib.h where needed.
> 

stdlib.h contains posix_memalign(), but the code is using memalign(). 
So should I prefix the calls?

Regarding the autoconf related issues, I'm looking on it, though it
can take me some time. I can't say I love the way autoconf is done... :)

[ snip autoconf related issues ]

> 
> > diff --git a/libxcmd/paths.c b/libxcmd/paths.c
> > index c0b1ddb..b360617 100644
> > --- a/libxcmd/paths.c
> > +++ b/libxcmd/paths.c
> > @@ -364,7 +364,7 @@ fs_table_initialise_mounts(
> >  			continue;
> >  		if (!realpath(stats[i].f_mntfromname, rmntfromname))
> >  			continue;
> > -		if (!realpath(stats[i].f_mntonname, rmnttomname)))
> > +		if (!realpath(stats[i].f_mntonname, rmntonname))
> 
> I don't understand this change.

Typo fix, which wasn't catched earlier due to #ifdef branching.
The 'rmnttomname' does not exists anywhere and looks like a hybrid
between rmntfromname and rmntonname. And because the previous if has
has 'fromname' on both arguments of realpath, I choose the same approach
when fixing it.

I'm making it a standalone patch too, though.

Cheers,
Jan
-- 
Jan Tulak
jtulak@redhat.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  2015-07-20 12:56 ` [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_ Jan Tulak
@ 2015-08-02 23:42   ` Dave Chinner
  2015-08-03  9:34     ` Jan Tulak
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Chinner @ 2015-08-02 23:42 UTC (permalink / raw)
  To: Jan Tulak; +Cc: xfs

On Mon, Jul 20, 2015 at 02:56:55PM +0200, Jan Tulak wrote:
> OS X has some conflicting LIST_ macros, so prefix the XFS ones.

What macros, and how do we get them included in the build? I
shouldn't need to go and use google to work out why a change is
beign made....

> Signed-off-by: Jan Tulak <jtulak@redhat.com>
> ---
>  include/list.h  | 6 +++---
>  repair/phase6.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/list.h b/include/list.h
> index 3f087a4..7e9f748 100644
> --- a/include/list.h
> +++ b/include/list.h
> @@ -27,10 +27,10 @@ struct list_head {
>  	struct list_head *prev;
>  };
>  
> -#define LIST_HEAD_INIT(name) { &(name), &(name) }
> +#define XFS_LIST_HEAD_INIT(name) { &(name), &(name) }
>  
> -#define LIST_HEAD(name) \
> -		struct list_head name = LIST_HEAD_INIT(name)
> +#define XFS_LIST_HEAD(name) \
> +		struct list_head name = XFS_LIST_HEAD_INIT(name)
>  
>  #define INIT_LIST_HEAD(list) list_head_init(list)
>  static inline void list_head_init(struct list_head *list)

This is supposed to match what is required for libxfs/ so we don't
have to modify the kernel code we bring across. Without knowing
exactly how we are including conflicting definitions from the OS X
include files, it's really hard to suggest other possible
solutions...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  2015-08-02 23:42   ` Dave Chinner
@ 2015-08-03  9:34     ` Jan Tulak
  2015-08-03 22:16       ` Dave Chinner
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Tulak @ 2015-08-03  9:34 UTC (permalink / raw)
  To: Dave Chinner, Christoph Hellwig; +Cc: xfs



----- Original Message -----
> From: "Dave Chinner" <david@fromorbit.com>
> What macros, and how do we get them included in the build? I
> shouldn't need to go and use google to work out why a change is
> beign made....
> 
> > 
> > 
> > 
> 
> This is supposed to match what is required for libxfs/ so we don't
> have to modify the kernel code we bring across. Without knowing
> exactly how we are including conflicting definitions from the OS X
> include files, it's really hard to suggest other possible
> solutions...
> 

Ahh, sorry, I already wrote a reply to Chris, but it looks like 
I pressed "save" instead "send" - I found it in drafts and not 
in send emails. /shy

I will edit the commit message appropriately when resubmitting.

The conflicting macros are LIST_HEAD and LIST_HEAD_INIT.

Here is the reply I didn't sent:

----- Original Message -----
> From: "Christoph Hellwig" <hch@infradead.org>
> 
> Can you post the compiler warnings you see without this patch?
> 

Sure, these:

../include/xfs/list.h:32:9: warning: 'LIST_HEAD' macro redefined [-Wmacro-redefined]
#define LIST_HEAD(name) \
        ^
/usr/include/sys/queue.h:417:9: note: previous definition is here
#define LIST_HEAD(name, type)                                           \
        ^
(and the same for LIST_HEAD_INIT)

sys/queue.h is not linked directly, but from many system libraries. 
A quick grep on /usr/include/ shows 24 header files including the queue,
sys/mount.h one of them. And I didn't found a way how to avoid it.

If you have an idea what else to to with it, I'm happy to try it.

Cheers,
Jan

-- 
Jan Tulak
jtulak@redhat.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  2015-08-03  9:34     ` Jan Tulak
@ 2015-08-03 22:16       ` Dave Chinner
  2015-08-04  8:38         ` Jan Tulak
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Chinner @ 2015-08-03 22:16 UTC (permalink / raw)
  To: Jan Tulak; +Cc: Christoph Hellwig, xfs

On Mon, Aug 03, 2015 at 05:34:48AM -0400, Jan Tulak wrote:
> > From: "Dave Chinner" <david@fromorbit.com>
> > What macros, and how do we get them included in the build? I
> > shouldn't need to go and use google to work out why a change is
> > beign made....
> > 
> > This is supposed to match what is required for libxfs/ so we don't
> > have to modify the kernel code we bring across. Without knowing
> > exactly how we are including conflicting definitions from the OS X
> > include files, it's really hard to suggest other possible
> > solutions...
> > 
> 
> Ahh, sorry, I already wrote a reply to Chris, but it looks like 
> I pressed "save" instead "send" - I found it in drafts and not 
> in send emails. /shy

No worries, we all do silly things like that from time to time,
myself included.

> Sure, these:
> 
> ../include/xfs/list.h:32:9: warning: 'LIST_HEAD' macro redefined [-Wmacro-redefined]
> #define LIST_HEAD(name) \
>         ^
> /usr/include/sys/queue.h:417:9: note: previous definition is here
> #define LIST_HEAD(name, type)                                           \
>         ^
> (and the same for LIST_HEAD_INIT)
> 
> sys/queue.h is not linked directly, but from many system libraries. 
> A quick grep on /usr/include/ shows 24 header files including the queue,
> sys/mount.h one of them. And I didn't found a way how to avoid it.

Ok, so 4.4BSD introduced these years ago. Now it rings a bell, but I
can't find the relevant thread I'm thinking of (google has become
almost useless as a mailing list search engine in recent times).

I suspect that we are going to need an

#undef LIST_HEAD

somewhere in include/libxfs.h, libxfs/libxfs_priv.h and/or
include/list.h just to ensure we don't use the system definitions
(with a large comment explaining it).

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_...
  2015-08-03 22:16       ` Dave Chinner
@ 2015-08-04  8:38         ` Jan Tulak
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Tulak @ 2015-08-04  8:38 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, xfs



----- Original Message -----
> From: "Dave Chinner" <david@fromorbit.com>

> > /usr/include/sys/queue.h:417:9: note: previous definition is here
> > #define LIST_HEAD(name, type)                                           \
> >         ^
> > (and the same for LIST_HEAD_INIT)
> > 
> > sys/queue.h is not linked directly, but from many system libraries.
> > A quick grep on /usr/include/ shows 24 header files including the queue,
> > sys/mount.h one of them. And I didn't found a way how to avoid it.
> 
> Ok, so 4.4BSD introduced these years ago. Now it rings a bell, but I
> can't find the relevant thread I'm thinking of (google has become
> almost useless as a mailing list search engine in recent times).
> 
> I suspect that we are going to need an
> 
> #undef LIST_HEAD
> 
> somewhere in include/libxfs.h, libxfs/libxfs_priv.h and/or
> include/list.h just to ensure we don't use the system definitions
> (with a large comment explaining it).
> 

Great! Putting it in libxfs/list.h seems to be enough. This header should be
included anywhere where our lists are used, so I think there should be no
risk of using the system definition anymore. I'm making an updated patch.

Thanks for pointing on #undef. I'm sure I must have heard of it before, 
but as I never used it... :-)

Cheers,
Jan

-- 
Jan Tulak
jtulak@redhat.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-08-04  8:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 12:56 [PATCH v2 0/4] xfsprogs: Partial OS X support Jan Tulak
2015-07-20 12:56 ` [PATCH v2 1/4] xfsprogs: Prefix LIST_... macros to XFS_LIST_ Jan Tulak
2015-08-02 23:42   ` Dave Chinner
2015-08-03  9:34     ` Jan Tulak
2015-08-03 22:16       ` Dave Chinner
2015-08-04  8:38         ` Jan Tulak
2015-07-20 12:56 ` [PATCH v2 2/4] xfsprogs: Don't Make .po files with gettext disabled Jan Tulak
2015-07-26 16:28   ` Christoph Hellwig
2015-07-20 12:56 ` [PATCH v2 3/4] xfsprogs: Use glibtoolize on osx Jan Tulak
2015-07-26 16:29   ` Christoph Hellwig
2015-07-20 12:56 ` [PATCH v2 4/4] xfsprogs: OS X partial support Jan Tulak
2015-07-26 16:34   ` Christoph Hellwig
2015-07-27 16:45     ` Jan Tulak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.