xfsprogs: Partial OSX support
v4 cover xfsprogs: Partial OSX support
Fourth iteration. Most of the patches in this set are from splitting one patch in the previous iteration.
Specifically, only patch 1 is from the previous set as it wasn't in a good shape yet. Patch 3 is a delta for an older version which was merged accidentaly instead of the newest one.
All the other patches in this set originate from
[PATCH 05/11] xfsprogs: missing and dummy calls for OS X support.
FSR is still compiled, even if it requires empty functions. There is no drawback from this for other platforms. Some of the calls can be made working. However, for example the mntent calls are not usefull anywhere else, and as fsr can't work without a mounted system, there is no way how to use and test the alternative implementation.
If in futre xfs can be mounted on OS X, then at least the empty functions are clear as "TODO". If there is an untested code, they will most likely need to be debugged and possibly even rewritten to respect future changes in OS X. So in short, I see implementing them as a waste of time.
Stopping the FSR build is, with the current target audience of this port between developers, unnecessary.
Cheers,
Jan
CHANGELOG:
v4:
- added #warning message (patch 1)
- use dummy blkid_get_topology instead of #ifdefs (patch 1)
- fix autoconf (wasn't passing -DENABLE_BLKID flag, lost during patch cleaning.) (patch 1)
- remove dependency on linux XATTR_ constants (patch 2)
- add autoconf detection for fsetxattr (patch 4)
- use uuid_t instead of unsigned char (patch 5)
- add a basic timer functionality (patch 8)
- mremap replacement now returns MAP_FAILED (patch 11)
Version 3:
- better commit messages (patch 1)
- formatting fixes (patch 2, 8)
- autoconf updates (patch 6, 7)
- changed default behaviour if BLKID is disabled such that mkfs -f is required (patch 11)
Jan Tulak (11):
xfsprogs: Add a way to compile without blkid
xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
xfsprogs: Add includes required for OS X builds (delta)
xfsprogs: Add autoconf check for fsetxattr call
xfsprogs: uuid changes for OS X
xfsprogs: Remove conflicting define for OS X
xfsprogs: add nftw64 translation for OS X
xfsprogs: Add a timer implementation for OS X
xfsprogs: Add statvfs64 for osx
xfsprogs: add dummy mntent for OS X
xfsprogs: add dummy mremap for OS X
configure.ac | 11 +++- fsr/xfs_fsr.c | 8 +++ include/builddefs.in | 11 +++- include/darwin.h | 157 ++++++++++++++++++++++++++++++++++++++++++----- libhandle/handle.c | 6 +- libhandle/jdm.c | 6 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_format.h | 11 +++- m4/package_libcdev.m4 | 13 ++++ mkfs/xfs_mkfs.c | 37 ++++++++++- repair/progress.c | 16 ++++- 11 files changed, 251 insertions(+), 27 deletions(-)
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 1/11 xfsprogs: Add a way to compile without blkid
Because not all platforms have up-to-date blkid with required functions, allow at least partial functionality by adding --enable-blkid=yes/no optional configure argument.
When blkid is disabled, signature detection and device geometry detection doesn't work.
--- configure.ac | 10 +++++++++- include/builddefs.in | 5 +++++ mkfs/xfs_mkfs.c | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-)
configure.ac +9 -1
@@ -26,6 +26,11 @@ AC_ARG_ENABLE(gettext, enable_gettext=yes) AC_SUBST(enable_gettext) +AC_ARG_ENABLE(blkid, +[ --enable-blkid=[yes/no] Enable use of block device id library [default=yes]],, + enable_blkid=yes) +AC_SUBST(enable_blkid) + AC_ARG_ENABLE(readline, [ --enable-readline=[yes/no] Enable readline command editing [default=no]], test $enable_readline = yes && libreadline="-lreadline",
@@ -117,9 +122,12 @@ AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE AC_HAVE_MNTENT AC_HAVE_FLS -AC_HAVE_BLKID_TOPO AC_HAVE_READDIR +if test "$enable_blkid" = yes; then +AC_HAVE_BLKID_TOPO +fi + AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([char *]) AC_TYPE_UMODE_T
include/builddefs.in +5 -0
@@ -89,6 +89,7 @@ ENABLE_SHARED = @enable_shared@ ENABLE_GETTEXT = @enable_gettext@ ENABLE_EDITLINE = @enable_editline@ ENABLE_READLINE = @enable_readline@ +ENABLE_BLKID = @enable_blkid@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
@@ -138,6 +139,10 @@ endif ifeq ($(HAVE_MNTENT),yes) PCFLAGS+= -DHAVE_MNTENT endif +ifeq ($(ENABLE_BLKID),yes) +PCFLAGS+= -DENABLE_BLKID +endif + GCFLAGS = $(OPTIMIZER) $(DEBUG) \ -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
mkfs/xfs_mkfs.c +36 -1
@@ -18,7 +18,9 @@#include "libxfs.h" #include <ctype.h> -#include <blkid/blkid.h> +#ifdef ENABLE_BLKID +# include <blkid/blkid.h> +#endif /* ENABLE_BLKID */ #include "xfs_mkfs.h" /*
@@ -298,6 +300,7 @@ calc_stripe_factors(* 0 for nothing found * -1 for internal error */ +#ifdef ENABLE_BLKID static int check_overwrite (char *device)
@@ -451,6 +454,38 @@ out_free_probe:_ ("warning: unable to probe device topology for device %s\n" ), device); } +#else /* ifdef ENABLE_BLKID */ +/* +* Without blkid, we can't do a good check for signatures. +* So instead of some messy attempts, just disable any checks +* and always return 'nothing found'. +*/ +# warning BLKID is disabled, so signature detection and block device\ + access are not working! +static int +check_overwrite ( +char *device) +{ +return 1 ; +} + +static void blkid_get_topology ( +const char *device, +int *sunit, +int *swidth, +int *lsectorsize, +int *psectorsize, +int force_overwrite) +{ +/* +* Shouldn't make any difference (no blkid = no block device access), +* but make sure this dummy replacement returns with at least some +* sanity. +*/ + *lsectorsize = *psectorsize =512 ; +} + +#endif /* ENABLE_BLKID */ static void get_topology( libxfs_init_t *xi,
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 2/11 xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
--- libhandle/handle.c | 6 ++++-- libhandle/jdm.c | 6 ++++-- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_format.h | 11 ++++++++++- 4 files changed, 19 insertions(+), 6 deletions(-)
libhandle/handle.c +4 -2
@@ -21,6 +21,8 @@#include "xfs.h" #include "handle.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" /* just pick a value we know is more than big enough */ #define MAXHANSIZ 64
@@ -397,8 +399,8 @@ attr_list_by_handle( alhreq.buffer = buf; alhreq.buflen = bufsize;/* prevent needless EINVAL from the kernel */ -if (alhreq.buflen >XATTR_LIST_MAX ) - alhreq.buflen =XATTR_LIST_MAX ; +if (alhreq.buflen >XFS_XATTR_LIST_MAX ) + alhreq.buflen =XFS_XATTR_LIST_MAX ; error =xfsctl (path, fd,XFS_IOC_ATTRLIST_BY_HANDLE , &alhreq);
libhandle/jdm.c +4 -2
@@ -21,6 +21,8 @@#include "handle.h" #include "jdm.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" /* internal fshandle - typecast to a void for external use */ #define FSHANDLE_SZ 8
@@ -168,8 +170,8 @@ jdm_attr_list( jdm_fshandle_t *fshp,int rval;/* prevent needless EINVAL from the kernel */ -if (bufsz >XATTR_LIST_MAX ) - bufsz =XATTR_LIST_MAX ; +if (bufsz >XFS_XATTR_LIST_MAX ) + bufsz =XFS_XATTR_LIST_MAX ;jdm_fill_filehandle ( &filehandle, fshandlep, statp ); rval = attr_list_by_handle (( void * )&filehandle,
libxfs/xfs_attr_remote.c +1 -1
@@ -102,7 +102,7 @@ xfs_attr3_rmt_verify(if (be32_to_cpu (rmt->rm_bytes) > fsbsize -sizeof (*rmt))return false;if (be32_to_cpu (rmt->rm_offset) + -be32_to_cpu (rmt->rm_bytes) >XATTR_SIZE_MAX ) +be32_to_cpu (rmt->rm_bytes) >XFS_XATTR_SIZE_MAX )return false;if (rmt->rm_owner ==0 )return false;
libxfs/xfs_format.h +10 -1
@@ -60,6 +60,14 @@ struct xfs_ifork;#define XFS_SB_VERSION_MOREBITSBIT 0x8000/* +* Avoid dependency on linux values of XATTR. +* It has to be on the beginning of this file, because we use these Values +* later in this header file. +*/ +#define XFS_XATTR_SIZE_MAX 65536/* size of an extended attribute value (64k) */ +#define XFS_XATTR_LIST_MAX 65536/* size of extended attribute namelist (64k) */ + +/* * Supported feature bit list is just all bits in the versionnum field because * we've used them all up and understand them all. Except, of course, for the * shared superblock bit, which nobody knows what it does and so is unsupported.
@@ -1483,7 +1491,7 @@ struct xfs_acl {*/ #define XFS_ACL_MAX_ENTRIES (mp) \ (xfs_sb_version_hascrc(&mp->m_sb) \ - ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ + ? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ sizeof(struct xfs_acl_entry) \ : 25)
@@ -1497,4 +1505,5 @@ struct xfs_acl {#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) +#endif /* __XFS_FORMAT_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
Quoted 1 line · Jan Tulak
Signed-off-by Jan Tulak <[email protected]>
Explanation of the change?
Quoted 11 lines
--- libhandle/handle.c | 6 ++++-- libhandle/jdm.c | 6 ++++-- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_format.h | 11 ++++++++++- 4 files changed, 19 insertions(+), 6 deletions(-)libhandle/handle.c +0
-0
....
libhandle/jdm.c line 25
Quoted 10 lines
libhandle/jdm.c +2
-0@@ -21,6 +21,8 @@#include "handle.h" #include "jdm.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h"
I don't think you need the xfs/ prefix now.
libxfs/xfs_format.h struct xfs_ifork; · line 66
Quoted 12 lines
libxfs/xfs_format.h +4
-0@@ -60,6 +60,14 @@ struct xfs_ifork;#define XFS_SB_VERSION_MOREBITSBIT 0x8000/* +* Avoid dependency on linux values of XATTR. +* It has to be on the beginning of this file, because we use these Values +* later in this header file. +*/
This is an explanation of why the change is being made, not what the definitions are for. This belongs in the commit message, not the code.
libxfs/xfs_format.h struct xfs_ifork; · line 67
Quoted 1 line
libxfs/xfs_format.h +1
-0+#define XFS_XATTR_SIZE_MAX 65536/* size of an extended attribute value (64k) */
We try to avoid comments like these for defines (they tend only to be added to structure definitions now).
/*
* The size of a single extended attribute on disk is limited by
* the size of index values within the attribute entries themselves.
* These are be16 fields, so we can only support attribute data
* sizes up to 2^16 bytes in length.
*/
#define XFS_XATTR_SIZE_MAX (1 << 16)
libxfs/xfs_format.h struct xfs_ifork; · line 68
Quoted 1 line
libxfs/xfs_format.h +1
-0+#define XFS_XATTR_LIST_MAX 65536/* size of extended attribute namelist (64k) */
XATTR_LIST_MAX is not an on-disk format definition - it's a syscall buffer size limit and is defined by the OS. This belongs in the platform headers, such as:
#ifndef XATTR_LIST_MAX
#define XATTR_LIST_MAX 65536
#endif
And so in a common header (e.g. include/xfs.h after including the platform headers):
#define XFS_XATTR_LIST_MAX XATTR_LIST_MAX
IOWs, this is really two separate patches - one for the XFS_XATTR_SIZE_MAX change (which also needs to go back to the kernel) and one for XFS_XATTR_LIST_MAX (which is purely userspace).
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
Quoted 5 lines · Dave Chinner
Quoted 1 line · Jan Tulak
Signed-off-by Jan Tulak <[email protected]>Explanation of the change?
Submitted. And sorry, I realized I didn't add v2 to the patch the moment I sent it.
:-( Though only the commit message is changed.
Cheers,
Jan
--
Jan Tulak
[email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 2/11 xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
In reply to Jan TulakCurrently, we depends on Linux XATTR values for on disk definitions. Which causes trouble on other platforms and maybe also if these values were to change.
Fix it by creating a custom definition independent from those in Linux (although with the same values).
--- libhandle/handle.c | 6 ++++-- libhandle/jdm.c | 6 ++++-- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_format.h | 11 ++++++++++- 4 files changed, 19 insertions(+), 6 deletions(-)
libhandle/handle.c +4 -2
@@ -21,6 +21,8 @@#include "xfs.h" #include "handle.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" /* just pick a value we know is more than big enough */ #define MAXHANSIZ 64
@@ -397,8 +399,8 @@ attr_list_by_handle( alhreq.buffer = buf; alhreq.buflen = bufsize;/* prevent needless EINVAL from the kernel */ -if (alhreq.buflen >XATTR_LIST_MAX ) - alhreq.buflen =XATTR_LIST_MAX ; +if (alhreq.buflen >XFS_XATTR_LIST_MAX ) + alhreq.buflen =XFS_XATTR_LIST_MAX ; error =xfsctl (path, fd,XFS_IOC_ATTRLIST_BY_HANDLE , &alhreq);
libhandle/jdm.c +4 -2
@@ -21,6 +21,8 @@#include "handle.h" #include "jdm.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" /* internal fshandle - typecast to a void for external use */ #define FSHANDLE_SZ 8
@@ -168,8 +170,8 @@ jdm_attr_list( jdm_fshandle_t *fshp,int rval;/* prevent needless EINVAL from the kernel */ -if (bufsz >XATTR_LIST_MAX ) - bufsz =XATTR_LIST_MAX ; +if (bufsz >XFS_XATTR_LIST_MAX ) + bufsz =XFS_XATTR_LIST_MAX ;jdm_fill_filehandle ( &filehandle, fshandlep, statp ); rval = attr_list_by_handle (( void * )&filehandle,
libxfs/xfs_attr_remote.c +1 -1
@@ -102,7 +102,7 @@ xfs_attr3_rmt_verify(if (be32_to_cpu (rmt->rm_bytes) > fsbsize -sizeof (*rmt))return false;if (be32_to_cpu (rmt->rm_offset) + -be32_to_cpu (rmt->rm_bytes) >XATTR_SIZE_MAX ) +be32_to_cpu (rmt->rm_bytes) >XFS_XATTR_SIZE_MAX )return false;if (rmt->rm_owner ==0 )return false;
libxfs/xfs_format.h +10 -1
@@ -60,6 +60,14 @@ struct xfs_ifork;#define XFS_SB_VERSION_MOREBITSBIT 0x8000/* +* Avoid dependency on linux values of XATTR. +* It has to be on the beginning of this file, because we use these Values +* later in this header file. +*/ +#define XFS_XATTR_SIZE_MAX 65536/* size of an extended attribute value (64k) */ +#define XFS_XATTR_LIST_MAX 65536/* size of extended attribute namelist (64k) */ + +/* * Supported feature bit list is just all bits in the versionnum field because * we've used them all up and understand them all. Except, of course, for the * shared superblock bit, which nobody knows what it does and so is unsupported.
@@ -1483,7 +1491,7 @@ struct xfs_acl {*/ #define XFS_ACL_MAX_ENTRIES (mp) \ (xfs_sb_version_hascrc(&mp->m_sb) \ - ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ + ? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ sizeof(struct xfs_acl_entry) \ : 25)
@@ -1497,4 +1505,5 @@ struct xfs_acl {#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) +#endif /* __XFS_FORMAT_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/1 xfsprogs: Add XATTR_LIST_MAX to OS X headers
OS X has no XATTR_LIST_MAX value. So add it to the platform header.
--- include/darwin.h | 5 +++++ 1 file changed, 5 insertions(+)
include/darwin.h +5 -0
@@ -39,6 +39,11 @@# ifndef SYS_fsctl# define SYS_fsctl 242# endif + +#ifndef XATTR_LIST_MAX +#define XATTR_LIST_MAX 65536 +#endif +static __inline__int xfsctl (const char *path,int fd,int cmd,void *p) {return syscall (SYS_fsctl, path, cmd, p,0 );
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/1 xfsprogs: avoid dependency on Linux XATTR_SIZE_MAX
Currently, we depends on Linux XATTR value for on disk definitions. Which causes trouble on other platforms and maybe also if this value was to change.
Fix it by creating a custom definition independent from those in Linux (although with the same values), so it is OK with the be16 fields used for holding these attributes.
--- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_format.h | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
libxfs/xfs_attr_remote.c +1 -1
@@ -102,7 +102,7 @@ xfs_attr3_rmt_verify(if (be32_to_cpu (rmt->rm_bytes) > fsbsize -sizeof (*rmt))return false;if (be32_to_cpu (rmt->rm_offset) + -be32_to_cpu (rmt->rm_bytes) >XATTR_SIZE_MAX ) +be32_to_cpu (rmt->rm_bytes) >XFS_XATTR_SIZE_MAX )return false;if (rmt->rm_owner ==0 )return false;
libxfs/xfs_format.h +9 -1
@@ -60,6 +60,14 @@ struct xfs_ifork;#define XFS_SB_VERSION_MOREBITSBIT 0x8000/* +* The size of a single extended attribute on disk is limited by +* the size of index values within the attribute entries themselves. +* These are be16 fields, so we can only support attribute data +* sizes up to 2^16 bytes in length. +*/ +#define XFS_XATTR_SIZE_MAX (1 << 16) + +/* * Supported feature bit list is just all bits in the versionnum field because * we've used them all up and understand them all. Except, of course, for the * shared superblock bit, which nobody knows what it does and so is unsupported.
@@ -1483,7 +1491,7 @@ struct xfs_acl {*/ #define XFS_ACL_MAX_ENTRIES (mp) \ (xfs_sb_version_hascrc(&mp->m_sb) \ - ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ + ? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ sizeof(struct xfs_acl_entry) \ : 25)
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/1 xfsprogs: prefix XATTR_LIST_MAX with XFS_
In reply to Jan TulakWILL CHANGE THE COMMIT MESSAGE.
All right, I make the renaming with define - though I'm not sure that with the ifdef for OS X and SIZE_MAX moved to a standalone patch we need it - shouldn't be this change rather dropped?
--- include/xfs.h | 2 ++ libhandle/handle.c | 4 ++-- libhandle/jdm.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-)
include/xfs.h +2 -0
@@ -53,6 +53,8 @@# define ASSERT (EX ) ((void) 0)#endif +#define XFS_XATTR_LIST_MAX XATTR_LIST_MAX +/* * sparse kernel source annotations */
libhandle/handle.c +2 -2
@@ -397,8 +397,8 @@ attr_list_by_handle( alhreq.buffer = buf; alhreq.buflen = bufsize;/* prevent needless EINVAL from the kernel */ -if (alhreq.buflen >XATTR_LIST_MAX ) - alhreq.buflen =XATTR_LIST_MAX ; +if (alhreq.buflen >XFS_XATTR_LIST_MAX ) + alhreq.buflen =XFS_XATTR_LIST_MAX ; error =xfsctl (path, fd,XFS_IOC_ATTRLIST_BY_HANDLE , &alhreq);
libhandle/jdm.c +2 -2
@@ -168,8 +168,8 @@ jdm_attr_list( jdm_fshandle_t *fshp,int rval;/* prevent needless EINVAL from the kernel */ -if (bufsz >XATTR_LIST_MAX ) - bufsz =XATTR_LIST_MAX ; +if (bufsz >XFS_XATTR_LIST_MAX ) + bufsz =XFS_XATTR_LIST_MAX ;jdm_fill_filehandle ( &filehandle, fshandlep, statp ); rval = attr_list_by_handle (( void * )&filehandle,
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
In reply to Jan Tulaklibhandle/handle.c line 25
Quoted 9 lines
index b1c0c10..d532f44 100644
libhandle/handle.c +2
-0@@ -21,6 +21,8 @@#include "xfs.h" #include "handle.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h"
These headers should not be used in libhandle. As mentioned last time I think libhandle should get it's own LIBHANDLE_XATTR_LIST_MAX define, separate frome the one for the on disk format.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
Quoted 5 lines · Christoph Hellwig
Quoted 5 lines
index b1c0c10..d532f44 100644
libhandle/handle.c +0
-0@@ -21,6 +21,8 @@#include "xfs.h"
Quoted 9 lines
libhandle/handle.c line 25
Quoted 4 lines
libhandle/handle.c +2
-0#include "handle.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" These headers should not be used in libhandle. As mentioned last time I think libhandle should get it's own
LIBHANDLE_XATTR_LIST_MAXdefine, separate frome the one for the on disk format.
Well, you wrote about adding it into xfs_format.h. I don't recall (and can't find) anything else regarding XATTR_SIZE...
Quoted 4 lines
Eww, looks like we depend on these Linux values in the on disk defintion. I think we need to add new
XFS_XATTR_SIZE_MAXandXFS_XATTR_LIST_MAXdefintions toxfs_format.hand use them where we currently use these.
So
the XFS_ defines in xfs_format.h should be there, I just need to add another LIBHANDLE_ variant so we don't include the headers, right?
Cheers,
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX
Ah, never mind, I noticed I didn't read the last part of Dave's email. It looks clear now.
Jan
Quoted 41 lines · Jan Tulak
Quoted 5 lines · Christoph Hellwig
Quoted 5 lines
index b1c0c10..d532f44 100644
libhandle/handle.c +0
-0@@ -21,6 +21,8 @@#include "xfs.h" Quoted 9 lines
libhandle/handle.c line 25
Quoted 4 lines
libhandle/handle.c +2
-0#include "handle.h" #include "parent.h" +#include "xfs/xfs_arch.h" +#include "xfs/xfs_format.h" These headers should not be used in libhandle. As mentioned last time I think libhandle should get it's own
LIBHANDLE_XATTR_LIST_MAXdefine, separate frome the one for the on disk format.Well, you wrote about adding it into
xfs_format.h. I don't recall (and can't find) anything else regardingXATTR_SIZE...Quoted 4 lines
Eww, looks like we depend on these Linux values in the on disk defintion. I think we need to add new
XFS_XATTR_SIZE_MAXandXFS_XATTR_LIST_MAXdefintions toxfs_format.hand use them where we currently use these.So
the
XFS_defines in xfs_format.h should be there, I just need to add anotherLIBHANDLE_variant so we don't include the headers, right?Cheers,
Jan--
Jan Tulak
[email protected] / [email protected]
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 3/11 xfsprogs: Add includes required for OS X builds (delta)
In reply to Jan TulakDelta patch, an older version missing 3 includes was merged into 4.2.0-rc2.
--- include/darwin.h | 3 +++ 1 file changed, 3 insertions(+)
include/darwin.h +3 -0
@@ -18,6 +18,9 @@#ifndef __XFS_DARWIN_H__#define __XFS_DARWIN_H__ +#include <unistd.h> +#include <sys/types.h> +#include <string.h> #include <uuid/uuid.h> #include <libgen.h> #include <sys/vm.h>
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 03/11] xfsprogs: Add includes required for OS X builds (delta)
Looks fine,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 4/11 xfsprogs: Add autoconf check for fsetxattr call
In reply to Jan TulakOS X has fsetxattr() in another header and with different arguments. For now, check for the Linux variant and if not available, skip the code using the call.
--- configure.ac | 1 + fsr/xfs_fsr.c | 2 ++ include/builddefs.in | 4 ++++ m4/package_libcdev.m4 | 13 +++++++++++++ 4 files changed, 20 insertions(+)
configure.ac +1 -0
@@ -123,6 +123,7 @@ AC_HAVE_SYNC_FILE_RANGE AC_HAVE_MNTENT AC_HAVE_FLS AC_HAVE_READDIR +AC_HAVE_FSETXATTR if test "$enable_blkid" = yes; then AC_HAVE_BLKID_TOPO
fsr/xfs_fsr.c +2 -0
@@ -1025,6 +1025,7 @@ fsr_setup_attr_fork(int tfd, xfs_bstat_t *bstatp) { +#ifdef HAVE_FSETXATTR struct stat64 tstatbuf;int i;int diff =0 ;
@@ -1199,6 +1200,7 @@ out:if (dflag && diff)fsrprintf (_ ("failed to match fork offset\n" ));; +#endif /* HAVE_FSETXATTR */ return 0 ; }
include/builddefs.in +4 -0
@@ -106,6 +106,7 @@ HAVE_SYNC_FILE_RANGE = @have_sync_file_range@ HAVE_READDIR = @have_readdir@ HAVE_MNTENT = @have_mntent@ HAVE_FLS = @have_fls@ +HAVE_FSETXATTR = @have_fsetxattr@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
@@ -139,6 +140,9 @@ endif ifeq ($(HAVE_MNTENT),yes) PCFLAGS+= -DHAVE_MNTENT endif +ifeq ($(HAVE_FSETXATTR),yes) +PCFLAGS+= -DHAVE_FSETXATTR +endif ifeq ($(ENABLE_BLKID),yes) PCFLAGS+= -DENABLE_BLKID endif
m4/package_libcdev.m4 +13 -0
@@ -215,6 +215,19 @@ AC_DEFUN([AC_HAVE_FLS], ]) # +# Check if we have a fsetxattr call (Mac OS X) +# +AC_DEFUN([AC_HAVE_FSETXATTR], + [ AC_CHECK_DECL([fsetxattr], + have_fsetxattr=yes, + [], + [#include <sys/types.h> + #include <attr/xattr.h>] + ) + AC_SUBST(have_fsetxattr) + ]) + +# # Check if there is mntent.h # AC_DEFUN([AC_HAVE_MNTENT],
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/11] xfsprogs: Add autoconf check for fsetxattr call
Looks ok,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 5/11 xfsprogs: uuid changes for OS X
In reply to Jan TulakUUID API changed in OS X in last few years, so fix the platform_ calls.
--- include/darwin.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
include/darwin.h +7 -15
@@ -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 (*uu1, *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); }typedef unsigned char __u8 ;
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/11] xfsprogs: uuid changes for OS X
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 6/11 xfsprogs: Remove conflicting define for OS X
In reply to Jan TulakENOATTR already exists in OS X.
--- include/darwin.h | 1 - 1 file changed, 1 deletion(-)
include/darwin.h +0 -1
@@ -151,7 +151,6 @@ 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 *
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 06/11] xfsprogs: Remove conflicting define for OS X
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 7/11 xfsprogs: add nftw64 translation for OS X
In reply to Jan TulakOS X has only nftw variant - not the 64 suffix used in xfs.
--- include/darwin.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/darwin.h +6 -0
@@ -163,4 +163,10 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len) 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); +} +#endif /* __XFS_DARWIN_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/11] xfsprogs: add nftw64 translation for OS X
Quoted 1 line · Jan Tulak
OS X has only nftw variant - not the 64 suffix used in xfs.
Can you just use a #define?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/11] xfsprogs: add nftw64 translation for OS X
Quoted 6 lines · Christoph Hellwig
Quoted 1 line · Jan Tulak
OS X has only nftw variant - not the 64 suffix used in xfs.
Can you just use a #define?
Yes, indeed I can. Changed... :-)
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 1/1 xfsprogs: add nftw64 translation for OS X
In reply to Christoph HellwigUPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
--- include/darwin.h | 2 ++ 1 file changed, 2 insertions(+)
include/darwin.h +2 -0
@@ -157,6 +157,8 @@ typedef int64_t xfs_daddr_t;#define HAVE_FID 1 +#define nftw64 nftw +static __inline__int platform_discard_blocks (int fd,uint64_t start,uint64_t len) {
Signature · 6 lines
2.4.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v2] xfsprogs: add nftw64 translation for OS X
Quoted 14 lines · Jan Tulak
UPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by Jan Tulak <[email protected]>--- include/darwin.h | 2 ++ 1 file changed, 2 insertions(+)include/darwin.h +0
-0
include/darwin.h typedef int64_t xfs_daddr_t; · line 161
Quoted 5 lines
include/darwin.h +2
-0@@ -157,6 +157,8 @@ typedef int64_t xfs_daddr_t;#define HAVE_FID 1 +#define nftw64 nftw +
Sorry for chiming in late, but there's only one caller of nftw64 and several callers of nftw; why not just change it to use nftw?
<shrug> There could be other reasons why xfs_estimate requires the -64 variant, but I don't know. :)
--D
Quoted 10 lines
include/darwin.h +0
-0static __inline__int platform_discard_blocks (int fd,uint64_t start,uint64_t len) {Signature · 6 lines
2.4.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v2] xfsprogs: add nftw64 translation for OS X
Quoted 2 lines · Darrick J. Wong
Sorry for chiming in late, but there's only one caller of nftw64 and several callers of nftw; why not just change it to use nftw?
That sounds even better.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v2] xfsprogs: add nftw64 translation for OS X
In reply to Darrick J. WongQuoted 25 lines · Darrick J. Wong
Quoted 14 lines · Jan Tulak
UPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by Jan Tulak <[email protected]>--- include/darwin.h | 2 ++ 1 file changed, 2 insertions(+)include/darwin.h +0
-0include/darwin.h typedef int64_t xfs_daddr_t; · line 161
Quoted 5 lines
include/darwin.h +2
-0@@ -157,6 +157,8 @@ typedef int64_t xfs_daddr_t;#define HAVE_FID 1 +#define nftw64 nftw +Sorry for chiming in late, but there's only one caller of nftw64 and several
callers of nftw; why not just change it to use nftw?
Quoted 3 lines
<shrug> There could be other reasons why
xfs_estimaterequires the -64 variant, but I don't know. :)
Good idea. I'll run tests after the change
and if nothing bad happens, I send
it here.
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 7/11 xfsprogs: change nftw64 to nftw
In reply to Jan TulakChangelog:
- Subject was "add nftw64 translation for OS X"
- Changed from #define to renaming
There is only one usage of nftw64 in entire xfsprogs, but multiple usages of nftw. It seems the 64 variant has no reason, and causes difficulties with some other platforms which has only nftw call.
--- estimate/xfs_estimate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
estimate/xfs_estimate.c +1 -1
@@ -168,7 +168,7 @@ main(int argc, char **argv) ndirs=0LL ;/* number of directories */ nspecial=0LL ;/* number of special files */ -nftw64 (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT ); +nftw (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT );if (__debug) {printf (_ ("dirsize=%llu\n" ), dirsize);
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH v2 07/11] xfsprogs: change nftw64 to nftw
Quoted 13 lines
estimate/xfs_estimate.c +1
-2@@ -168,7 +168,7 @@ main(int argc, char **argv) ndirs=0LL ;/* number of directories */ nspecial=0LL ;/* number of special files */ -nftw64 (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT ); +nftw (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT );if (__debug) {printf (_ ("dirsize=%llu\n" ), dirsize); --
Quoted 3 lines
2.4.5
Now I noticed this causes a warning:
xfs_estimate.c:171:3: warning: passing argument 2 of ‘nftw’ from incompatible pointer type
Quoted 1 line
From
ftw.h, the difference is in__nftw_func_tand__nftw64_func_tas a
second argument. However, what we pass in the code is "
int
ffn(
..., struct stat64 *stb, ...)". If I change this to struct stat, it works and xfstests -g quick gives the same result as with 64bit variant. So I'm sending an updated patch.
Cheers,
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v3 7/11 xfsprogs: change nftw64 to nftw
In reply to Jan TulakChangelog:
- changed ffn argument from stat64 to stat
- Subject was "add nftw64 translation for OS X"
- Changed from #define to renaming
There is only one usage of nftw64 in entire xfsprogs, but multiple usages of nftw. It seems the 64 variant has no reason, and causes difficulties with some other platforms which has only nftw call.
--- estimate/xfs_estimate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
estimate/xfs_estimate.c +3 -3
@@ -45,7 +45,7 @@ cvtnum(char *s)return 0LL ; } -int ffn (const char *,const struct stat64 *,int ,struct FTW *); +int ffn (const char *,const struct stat *,int ,struct FTW *);#define BLOCKSIZE 4096#define INODESIZE 256
@@ -168,7 +168,7 @@ main(int argc, char **argv) ndirs=0LL ;/* number of directories */ nspecial=0LL ;/* number of special files */ -nftw64 (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT ); +nftw (argv[optind], ffn,40 ,FTW_PHYS |FTW_MOUNT );if (__debug) {printf (_ ("dirsize=%llu\n" ), dirsize);
@@ -214,7 +214,7 @@ main(int argc, char **argv) }int -ffn (const char *path,const struct stat64 *stb,int flags,struct FTW *f) +ffn (const char *path,const struct stat *stb,int flags,struct FTW *f) {/* cases are in most-encountered to least-encountered order */ dirsize+=PERDIRENTRY +strlen (path);
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 8/11 xfsprogs: Add a timer implementation for OS X
In reply to Jan TulakOS X does not have the timer used in xfs_repair. Add a simple implementation providing the required capabilities.
--- include/darwin.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ repair/progress.c | 16 ++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-)
include/darwin.h +48 -0
@@ -28,6 +28,7 @@#include <sys/ioctl.h> #include <sys/mount.h> #include <sys/types.h> +#include <sys/time.h> #include <ftw.h> #include <mach/mach_time.h> #include <inttypes.h>
@@ -169,4 +170,51 @@ static inline int nftw64(const char *path, int (*fn)(const char *, const struct return nftw(path, fn, depth, flags); } +/* +* POSIX timer replacement. +* It really just do the minimum we need for xfs_repair. +* Also, as setitimer can't create multiple timers, +* the timerid things are useless - we have only one ITIMER_REAL +* timer. +*/ +#define CLOCK_REALTIME ITIMER_REAL +#define itimerspec itimerval +typedef uint64_t timer_t ; +typedef double timer_c ; +typedef clock_id_t clockid_t ; + + +static inline int timer_create (clockid_t __clock_id, +struct sigevent *__restrict __evp, +timer_t *__restrict timer) +{ +// set something, to initialize the variable, just in case + *timer =0 ; +return 0 ; +} + +static inline int timer_settime (timer_t timerid,int flags, +const struct itimerspec *__restrict timerspec, +struct itimerspec *__restrict ovalue) +{ +return setitimer (ITIMER_REAL , timerspec, ovalue); +} + +static inline int timer_delete (timer_t timerid) +{ +struct itimerspec timespec; + + timespec.it_interval.tv_sec=0 ; + timespec.it_interval.tv_usec=0 ; + timespec.it_value.tv_sec=0 ; + timespec.it_value.tv_usec=0 ; + +return setitimer (ITIMER_REAL , ×pec,NULL ); +} + +static inline int timer_gettime (timer_t timerid,struct itimerspec *value) +{ +return getitimer (ITIMER_REAL , value); +} +#endif /* __XFS_DARWIN_H__ */
repair/progress.c +14 -2
@@ -184,10 +184,22 @@ progress_rpt_thread (void *p)*/ timespec.it_value.tv_sec = msgp->interval; - timespec.it_value.tv_nsec =0 ; timespec.it_interval.tv_sec = msgp->interval; +/* +* On some platforms (like OS X), timers and time things are slightly +* different: itimerspec is replaced with itimerval and timeval struct +* has no tv_nsec, but just tv_usec member. +* For compatibility, itimerspec is a macro defined to the existing +* itimerval on these platforms, and in such case, use usec instead +* of nsec. +*/ +#ifndef itimerspec + timespec.it_value.tv_nsec =0 ; timespec.it_interval.tv_nsec =0 ; - +#else + timespec.it_value.tv_usec =0 ; + timespec.it_interval.tv_usec =0 ; +#endif if (timer_create (CLOCK_REALTIME ,NULL , &timerid))do_error (_ ("progress_rpt: cannot create timer\n" ));
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 08/11] xfsprogs: Add a timer implementation for OS X
Quoted 3 lines · Jan Tulak
OS X does not have the timer used in
xfs_repair. Add a simple implementation providing the required capabilities.
This doesn't look like it would actually work.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 08/11] xfsprogs: Add a timer implementation for OS X
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jan Tulak
OS X does not have the timer used in
xfs_repair. Add a simple implementation providing the required capabilities.This doesn't look like it would actually work.
As I understand the timer usage, it should periodically send a signal. The timer code I posted really does this, at least when I take the timer_* functions "as it is" outside and test them, calling them in the same order as in the repair code. I tested that before sending the patch.
I have to try it in xfs_repair yet - this is limited by having small storage space for a filesystem, where the reporting interval would be noticeable. The best thing for this I have now is an old USB2 8 GB flash drive, filled with multiple copies of installed Debian. However, even on a raspberry pi, it still runs quickly. I guess few hundreds of GB would do it, but I need to dig out an old USB2-sata reduction somewhere and a HDD... (And I didn't noticed any difference in output.)
So in meantime, why do you think this won't work?
Cheers,
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 9/11 xfsprogs: Add statvfs64 for osx
In reply to Jan TulakUse dummy stuff. It is used only in xfs_fsr, so it is not a big issue. However, there is a part of an attempted solution to translate it to OS X variant - statfs.
OS X statfs is missing f_frsize member in the struct, so its use would require some #ifdef in fsr code. Because of this, the dummy stuff is used.
--- fsr/xfs_fsr.c | 6 ++++++ include/builddefs.in | 2 +- include/darwin.h | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-)
fsr/xfs_fsr.c +6 -0
@@ -36,6 +36,12 @@# include <mntent.h> #endif +#ifdef __APPLE__ +//# define statvfs64 statfs; +# include <sys/param.h> +# include <sys/mount.h> +#endif +#ifndef XFS_XFLAG_NODEFRAG #define XFS_XFLAG_NODEFRAG 0x00002000/* src dependancy, remove later */ #endif
include/builddefs.in +1 -1
@@ -123,7 +123,7 @@ PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS) endif ifeq ($(PKG_PLATFORM),darwin) PCFLAGS = $(GCCFLAGS) -DEPENDFLAGS = -D__APPLE__ +DEPENDFLAGS = -D__APPLE__ -D_DARWIN_FEATURE_64_BIT_INODE endif ifeq ($(PKG_PLATFORM),irix) PLDLIBS = -ldisk -lgen
include/darwin.h +33 -0
@@ -217,4 +217,37 @@ static inline int timer_gettime (timer_t timerid, struct itimerspec *value) return getitimer(ITIMER_REAL, value); } +/* FSR */ + +//#define statvfs64 statfs +#define _PATH_MOUNTED "/etc/mtab" + +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 ]; +}; + +static inline int statvfs64 (const char *__restrict __file, +struct statfs *__restrict __buf) +{ +return 0 ; +} +#endif /* __XFS_DARWIN_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 9/11 xfsprogs: Add statvfs64 for osx
Simply rename statvfs64 to statfs with a #define.
CHANGE:
remove dummy code, add rename
--- fsr/xfs_fsr.c | 14 ++++++++++++++ include/builddefs.in | 2 +- include/darwin.h | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-)
fsr/xfs_fsr.c +14 -0
@@ -36,6 +36,12 @@# include <mntent.h> #endif +#ifdef __APPLE__ +//# define statvfs64 statfs; +# include <sys/param.h> +# include <sys/mount.h> +#endif +#ifndef XFS_XFLAG_NODEFRAG #define XFS_XFLAG_NODEFRAG 0x00002000/* src dependancy, remove later */ #endif
@@ -948,7 +954,11 @@ fsrfile_common( fname, strerror(errno));return -1 ; } +#ifndef statvfs64 bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize; +#else + bsize = vfss.f_bsize; +#endif if (statp->bs_blksize * statp->bs_blocks > vfss.f_bfree * bsize - minimumfree) { fsrprintf(_("insufficient freespace for: %s: "
@@ -1728,7 +1738,11 @@ xfs_getrt(int fd, struct statvfs64 *sfbp)close (fd);return -1 ; } +#ifndef statvfs64 bsize = (sfbp->f_frsize ? sfbp->f_frsize : sfbp->f_bsize); +#else + bsize = sfbp->f_bsize; +#endif factor = fsgeom.blocksize / bsize;/* currently this is == 1 */ sfbp->f_bfree = (cnt.freertx * fsgeom.rtextsize) * factor;return 0 ;
include/builddefs.in +1 -1
@@ -123,7 +123,7 @@ PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS) endif ifeq ($(PKG_PLATFORM),darwin) PCFLAGS = $(GCCFLAGS) -DEPENDFLAGS = -D__APPLE__ +DEPENDFLAGS = -D__APPLE__ -D_DARWIN_FEATURE_64_BIT_INODE endif ifeq ($(PKG_PLATFORM),irix) PLDLIBS = -ldisk -lgen
include/darwin.h +5 -0
@@ -216,4 +216,9 @@ static inline int timer_gettime (timer_t timerid, struct itimerspec *value) return getitimer(ITIMER_REAL, value); } +/* FSR */ + +#define statvfs64 statfs +#define _PATH_MOUNTED "/etc/mtab" +#endif /* __XFS_DARWIN_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 10/11 xfsprogs: add dummy mntent for OS X
In reply to Jan TulakBecause these calls are used only by xfs_fsr, which can't work on OS X unless a way how to mount XFS is found, there is not use in implementing these calls.
--- include/darwin.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
include/darwin.h +35 -0
@@ -244,6 +244,41 @@ struct statvfs64int __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 statfs *__restrict __buf) {
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/11] xfsprogs: add dummy mntent for OS X
Quoted 3 lines · Jan Tulak
Because these calls are used only by
xfs_fsr, which can't work on OS X unless a way how to mount XFS is found, there is not use in implementing these calls.
Take a look at the quota code for the BSD alternative to mntent. That code should be moved into a common location and used by fsr.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/11] xfsprogs: add dummy mntent for OS X
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Jan Tulak
Because these calls are used only by
xfs_fsr, which can't work on OS X unless a way how to mount XFS is found, there is not use in implementing these calls.Take a look at the quota code for the BSD alternative to mntent. That code should be moved into a common location and used by fsr.
I tried to find it, but didn't found... Could you point me where it is? Quota/freebsd.h has just few lines with one definition with errno = -ENOSYS, and in other files in quota/, I didn't saw anything BSD specific.
Thanks,
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/11] xfsprogs: add dummy mntent for OS X
Quoted 8 lines · Jan Tulak
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jan Tulak
Because these calls are used only by
xfs_fsr, which can't work on OS X unless a way how to mount XFS is found, there is not use in implementing these calls.
Quoted 7 lines
Quoted 3 lines
Take a look at the quota code for the BSD alternative to mntent. That code should be moved into a common location and used by fsr.
I tried to find it, but didn't found... Could you point me where it is?
Quota/freebsd.hhas just few lines with one definition with errno =-ENOSYS, and in other files in quota/, I didn't saw anything BSD specific.
I think Christoph is refering to the code in libxcmd/paths.c:
#if defined(HAVE_GETMNTENT)
....
#elif defined(HAVE_GETMNTINFO)
....
#else
# error "How do I extract info about mounted filesystems on this platform?" #endif #
HAVE_GETMNTINFO is for BSD systems, IIRC.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/11] xfsprogs: add dummy mntent for OS X
Quoted 25 lines · Dave Chinner
Quoted 8 lines · Jan Tulak
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jan Tulak
Because these calls are used only by
xfs_fsr, which can't work on OS X unless a way how to mount XFS is found, there is not use in implementing these calls.Quoted 7 lines
Quoted 3 lines
Take a look at the quota code for the BSD alternative to mntent. That code should be moved into a common location and used by fsr.
I tried to find it, but didn't found... Could you point me where it is?
Quota/freebsd.hhas just few lines with one definition with errno =-ENOSYS, and in other files in quota/, I didn't saw anything BSDspecific.
I think Christoph is refering to the code in
libxcmd/paths.c:#if
defined(HAVE_GETMNTENT)
....
#elifdefined(HAVE_GETMNTINFO)
....
#else
Quoted 7 lines
# error "How do I extract info about mounted filesystems on this platform?" #endif #
HAVE_GETMNTINFOis for BSD systems, IIRC.
All right, I will look on this. Thanks. :-)
Cheers,
Jan
Signature · 2 lines
Jan Tulak [email protected] / [email protected]
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 10/11 xfsprogs: make fsr use mntinfo when there is no mntent
In reply to Jan TulakFor what fsr needs, mntinfo can be used instead of mntent. Custom mntent struct is used to avoid too big ifdefs:
We only change few lines and the rest of the code can still use mntent as before.
CHANGE
- subject was: "add dummy mntent for OS X"
- reduced the stuby code.
--- fsr/Makefile | 8 +++++++ fsr/xfs_fsr.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++-------- include/darwin.h | 20 ++++++++++++++++ 3 files changed, 87 insertions(+), 10 deletions(-)
fsr/Makefile +8 -0
@@ -9,6 +9,14 @@ LTCOMMAND = xfs_fsr CFILES = xfs_fsr.c LLDLIBS = $(LIBHANDLE) +ifeq ($(HAVE_GETMNTENT),yes) +LCFLAGS += -DHAVE_GETMNTENT +endif + +ifeq ($(HAVE_GETMNTINFO),yes) +LCFLAGS += -DHAVE_GETMNTINFO +endif + default: depend $(LTCOMMAND) include $(BUILDRULES)
fsr/xfs_fsr.c +59 -10
124 lines not on this page · raw message
include/darwin.h +20 -0
@@ -218,7 +218,27 @@ static inline int timer_gettime (timer_t timerid, struct itimerspec *value)/* FSR */ +# include <sys/mount.h> +# include <sys/param.h> +#include <sys/ucred.h> +#include <errno.h> #define statvfs64 statfs#define _PATH_MOUNTED "/etc/mtab" +struct mntent +{ +char *mnt_fsname; +char *mnt_dir; +char *mnt_type; +char *mnt_opts; +int mnt_freq; +int mnt_passno; +}; + +static inline void mntinfo2mntent (struct statfs * stats,struct mntent * mnt) { + mnt->mnt_fsname = stats->f_mntfromname; + mnt->mnt_dir = stats->f_mntonname; + mnt->mnt_type = stats->f_fstypename; +} +#endif /* __XFS_DARWIN_H__ */
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 11/11 xfsprogs: add dummy mremap for OS X
In reply to Jan Tulak--- include/darwin.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/darwin.h +9 -0
@@ -33,6 +33,7 @@#include <mach/mach_time.h> #include <inttypes.h> #include <stdio.h> +#include <sys/mman.h> #include <machine/endian.h> #define __BYTE_ORDER BYTE_ORDER
@@ -217,6 +218,14 @@ static inline int timer_gettime (timer_t timerid, struct itimerspec *value)return getitimer (ITIMER_REAL , value); } +#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, ...) +{ +return MAP_FAILED ; +} +/* FSR */ //#define statvfs64 statfs
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 11/11] xfsprogs: add dummy mremap for OS X
NAK - just don't compile the mremap support in xfs_io if support for it is missing in the OS.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 1/1 xfsprogs: Make mremap conditional
In reply to Jan TulakDon't build mremap (in xfs_io) on platforms where it has no support.
CHANGELOG:
- subject was xfsprogs: add dummy mremap for OS X
--- configure.ac | 1 + include/builddefs.in | 1 + include/darwin.h | 1 + io/mmap.c | 8 ++++++++ m4/package_libcdev.m4 | 13 +++++++++++++ 5 files changed, 24 insertions(+)
configure.ac +1 -0
@@ -124,6 +124,7 @@ AC_HAVE_MNTENT AC_HAVE_FLS AC_HAVE_READDIR AC_HAVE_FSETXATTR +AC_HAVE_MREMAP if test "$enable_blkid" = yes; then AC_HAVE_BLKID_TOPO
include/builddefs.in +1 -0
@@ -107,6 +107,7 @@ HAVE_READDIR = @have_readdir@ HAVE_MNTENT = @have_mntent@ HAVE_FLS = @have_fls@ HAVE_FSETXATTR = @have_fsetxattr@ +HAVE_MREMAP = @have_mremap@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
include/darwin.h +1 -0
@@ -33,6 +33,7 @@#include <mach/mach_time.h> #include <inttypes.h> #include <stdio.h> +#include <sys/mman.h> #include <machine/endian.h> #define __BYTE_ORDER BYTE_ORDER
io/mmap.c +8 -0
@@ -28,7 +28,9 @@ static cmdinfo_t mread_cmd;static cmdinfo_t msync_cmd;static cmdinfo_t munmap_cmd;static cmdinfo_t mwrite_cmd; +#ifdef HAVE_MREMAP static cmdinfo_t mremap_cmd; +#endif /* HAVE_MREMAP */ mmap_region_t *maptable;int mapcount;
@@ -574,6 +576,7 @@ mwrite_f(return 0 ; } +#ifdef HAVE_MREMAP static void mremap_help (void ) {
@@ -633,6 +636,7 @@ mremap_f( return 0; } +#endif /* HAVE_MREMAP */ void mmap_init (void )
@@ -688,6 +692,7 @@ mmap_init(void)_ ("writes data into a region in the current memory mapping" ); mwrite_cmd.help = mwrite_help; +#ifdef HAVE_MREMAP mremap_cmd.name ="mremap" ; mremap_cmd.altname ="mrm" ; mremap_cmd.cfunc = mremap_f;
@@ -698,11 +703,14 @@ mmap_init(void) mremap_cmd.oneline =_ ("alters the size of the current memory mapping" ); mremap_cmd.help = mremap_help; +#endif /* HAVE_MREMAP */ add_command (&mmap_cmd);add_command (&mread_cmd);add_command (&msync_cmd);add_command (&munmap_cmd);add_command (&mwrite_cmd); +#ifdef HAVE_MREMAP add_command (&mremap_cmd); +#endif /* HAVE_MREMAP */ }
m4/package_libcdev.m4 +13 -0
@@ -235,3 +235,16 @@ AC_DEFUN([AC_HAVE_MNTENT], have_mntent=yes) AC_SUBST(have_mntent) ]) + +# +# Check if we have a mremap call (not on Mac OS X) +# +AC_DEFUN([AC_HAVE_MREMAP], + [ AC_CHECK_DECL([mremap], + have_mremap=yes, + [], + [#define _GNU_SOURCE + #include <sys/mman.h>] + ) + AC_SUBST(have_mremap) + ])
Signature · 6 lines
2.4.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/11] xfsprogs: Add a way to compile without blkid
In reply to Jan TulakQuoted 6 lines · Jan Tulak
Because not all platforms have up-to-date blkid with required functions, allow at least partial functionality by adding --enable-blkid=yes/no optional configure argument.
When blkid is disabled, signature detection and device geometry detection doesn't work.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs