From: Christoph Hellwig <hch@infradead.org>
To: Jan Tulak <jtulak@redhat.com>
Cc: hch@infradead.org, xfs@oss.sgi.com
Subject: Re: [PATCH 05/11] xfsprogs: missing and dummy calls for OS X support
Date: Mon, 17 Aug 2015 12:32:23 -0700 [thread overview]
Message-ID: <20150817193223.GE26222@infradead.org> (raw)
In-Reply-To: <1439828606-7886-6-git-send-email-jtulak@redhat.com>
On Mon, Aug 17, 2015 at 06:23:20PM +0200, Jan Tulak wrote:
> Add and update various API, macros and types where is some change
> in OS X or xfsprogs. Most changes are in darwin.h.
>
> Add dummy implementations where native support is nonexistent
> and the tools are not expected to work anyway, so all tools can be
> at least compiled.
>
> Signed-off-by: Jan Tulak <jtulak@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
> fsr/xfs_fsr.c | 8 +++
> include/darwin.h | 153 +++++++++++++++++++++++++++++++++++++++++++++++++------
> 2 files changed, 145 insertions(+), 16 deletions(-)
>
> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
> index 7c1d776..b4ff136 100644
> --- a/fsr/xfs_fsr.c
> +++ b/fsr/xfs_fsr.c
> @@ -43,6 +43,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
I don't think this is the right way to do it. I'd rather:
a) check for fsetxattr using autoconf, and
b) stub out the whole code calling it.
c) make this a patch on it's own
>
> char *progname;
>
> diff --git a/include/darwin.h b/include/darwin.h
> index 8b5a661..775dfc8 100644
> --- a/include/darwin.h
> +++ b/include/darwin.h
> @@ -76,45 +76,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);
Do you have any idea why MacOS defines a uuid_t, but wants unsigned
char arguments to uuid_compare?
Or given that the others work with pointer dereferences why doesn't:
return uuid_compare(*uu1, *uu2);
work?
Also please make the uuid changes a patch on it's own.
> -#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) */
Eww, looks like we depend on these Linux values in the on disk
defintion. I think we need to add new XFS_XATTR_SIZE_MAX and
XFS_XATTR_LIST_MAX defintions to xfs_format.h and use them where
we currently use these.
> +/*
> + * 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;
> +}
I don't think these stubs will work. It might be worth to figure
out what people use as replacement for realtime clocks on MacOS
by searching various programming resoures on the internet.
> +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 */
Please just build the mremap file in xfs_io conditional.
> +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];
> +};
Does MacOS support statvfs? or statfs? We should use the proper API
here instead of a dummy. Or maybe just not build fsr on OSX for now,
as that would solve the fsetxattr issue as well.
> +struct mntent
> +{
Another fsr issue, right? Seems like it would need similar getmntinfo
based code. As a stopgap I'd suggest we stop building fsr on OSX for
now.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-08-17 19:32 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 16:23 [PATCH 00/11] xfsprogs: Partial OS X support Jan Tulak
2015-08-17 16:23 ` [PATCH 01/11] xfsprogs: undefined variable fix Jan Tulak
2015-08-17 19:22 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 02/11] xfsprogs: Add ifdef dirent checks where it was missing Jan Tulak
2015-08-17 19:23 ` Christoph Hellwig
2015-08-18 6:49 ` Jan Tulak
2015-08-17 16:23 ` [PATCH 03/11] xfsprogs: Change OS X-specific CFLAGS/LDFLAGS Jan Tulak
2015-08-17 16:23 ` [PATCH 04/11] xfsprogs: Add includes required for OS X builds Jan Tulak
2015-08-17 19:23 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 05/11] xfsprogs: missing and dummy calls for OS X support Jan Tulak
2015-08-17 19:32 ` Christoph Hellwig [this message]
2015-08-18 0:17 ` Dave Chinner
2015-08-24 12:53 ` Jan Tulak
2015-08-18 21:45 ` Dave Chinner
2015-08-19 8:09 ` Christoph Hellwig
2015-08-19 9:14 ` Jan Tulak
2015-08-19 9:19 ` Christoph Hellwig
2015-08-19 10:26 ` Dave Chinner
2015-08-20 0:22 ` Dave Chinner
2015-08-20 7:33 ` Jan Tulak
2015-08-21 0:43 ` Dave Chinner
2015-08-17 16:23 ` [PATCH 06/11] xfsprogs: Add mntent.h check into autoconf Jan Tulak
2015-08-17 19:32 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 07/11] xfsprogs: Add fls " Jan Tulak
2015-08-17 19:32 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 08/11] xfsprogs: replace obsolete memalign with posix_memalign Jan Tulak
2015-08-17 19:36 ` Christoph Hellwig
2015-08-18 7:04 ` Jan Tulak
2015-08-18 8:20 ` Dave Chinner
2015-08-18 8:33 ` Jan Tulak
2015-08-18 22:01 ` Dave Chinner
2015-08-19 8:06 ` Jan Tulak
2015-08-17 16:23 ` [PATCH 09/11] xfsprogs: prevent LIST_ macros conflicts Jan Tulak
2015-08-17 19:36 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 10/11] xfsprogs: Update doc for OS X Jan Tulak
2015-08-17 19:36 ` Christoph Hellwig
2015-08-17 16:23 ` [PATCH 11/11] xfsprogs: Add a way to compile without blkid Jan Tulak
2015-08-17 19:39 ` Christoph Hellwig
2015-08-18 7:59 ` Jan Tulak
2015-08-18 12:02 ` [PATCH v2 " Jan Tulak
2015-08-17 21:55 ` [PATCH 00/11] xfsprogs: Partial OS X support Dave Chinner
2015-08-18 9:14 ` Jan Tulak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150817193223.GE26222@infradead.org \
--to=hch@infradead.org \
--cc=jtulak@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox