From: Jan Tulak <hidden> Date: 2015-08-26 12:00:59
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(-)
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:46
Delta patch, an older version missing 3 includes was merged
into 4.2.0-rc2.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 3 +++
1 file changed, 3 insertions(+)
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:47
OS 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.
Signed-off-by: Jan Tulak <redacted>
---
configure.ac | 1 +
fsr/xfs_fsr.c | 2 ++
include/builddefs.in | 4 ++++
m4/package_libcdev.m4 | 13 +++++++++++++
4 files changed, 20 insertions(+)
@@ -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
@@ -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],
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
@@ -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);
@@ -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,intrval;/* 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,
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:49
UUID API changed in OS X in last few years, so fix the platform_ calls.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:50
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.
Signed-off-by: Jan Tulak <redacted>
---
configure.ac | 10 +++++++++-
include/builddefs.in | 5 +++++
mkfs/xfs_mkfs.c | 37 ++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 2 deletions(-)
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:51
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 6 ++++++
1 file changed, 6 insertions(+)
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:54
Use 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.
Signed-off-by: Jan Tulak <redacted>
---
fsr/xfs_fsr.c | 6 ++++++
include/builddefs.in | 2 +-
include/darwin.h | 33 +++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:55
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.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
@@ -244,6 +244,41 @@ struct statvfs64int__f_spare[6];};+structmntent+{+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. */+intmnt_freq;/* Dump frequency (in days). */+intmnt_passno;/* Pass number for `fsck'. */+};++staticinlineFILE*setmntent(constchar*filename,constchar*type)+{+returnNULL;+}++staticinlineintendmntent(FILE*fp)+{+return0;+}++staticinlinestructmntent*getmntent(FILE*fp)+{+returnNULL;+}++staticinlineintaddmntent(FILE*fp,conststructmntent*mnt)+{+return0;+}++staticinlinechar*hasmntopt(conststructmntent*mnt,constchar*opt)+{+returnNULL;+}+staticinlineintstatvfs64(constchar*__restrict__file,structstatfs*__restrict__buf){
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-08-26 12:02:56
OS X does not have the timer used in xfs_repair.
Add a simple implementation providing the required
capabilities.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
repair/progress.c | 16 ++++++++++++++--
2 files changed, 62 insertions(+), 2 deletions(-)
@@ -169,4 +170,51 @@ static inline int nftw64(const char *path, int (*fn)(const char *, const structreturnnftw(path,fn,depth,flags);}+/*+*POSIXtimerreplacement.+*Itreallyjustdotheminimumweneedforxfs_repair.+*Also,assetitimercan'tcreatemultipletimers,+*thetimeridthingsareuseless-wehaveonlyoneITIMER_REAL+*timer.+*/+#define CLOCK_REALTIME ITIMER_REAL+#define itimerspec itimerval+typedefuint64_ttimer_t;+typedefdoubletimer_c;+typedefclock_id_tclockid_t;+++staticinlineinttimer_create(clockid_t__clock_id,+structsigevent*__restrict__evp,+timer_t*__restricttimer)+{+// set something, to initialize the variable, just in case+*timer=0;+return0;+}++staticinlineinttimer_settime(timer_ttimerid,intflags,+conststructitimerspec*__restricttimerspec,+structitimerspec*__restrictovalue)+{+returnsetitimer(ITIMER_REAL,timerspec,ovalue);+}++staticinlineinttimer_delete(timer_ttimerid)+{+structitimerspectimespec;++timespec.it_interval.tv_sec=0;+timespec.it_interval.tv_usec=0;+timespec.it_value.tv_sec=0;+timespec.it_value.tv_usec=0;++returnsetitimer(ITIMER_REAL,×pec,NULL);+}++staticinlineinttimer_gettime(timer_ttimerid,structitimerspec*value)+{+returngetitimer(ITIMER_REAL,value);+}+#endif /* __XFS_DARWIN_H__ */
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.
+#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)
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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-08-27 06:02:31
Currently, 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).
Signed-off-by: Jan Tulak <redacted>
---
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(-)
@@ -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);
@@ -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,intrval;/* 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,
From: Jan Tulak <hidden> Date: 2015-08-27 06:06:26
On Thu, Aug 27, 2015 at 12:01 AM, Dave Chinner [off-list ref] wrote:
On Wed, Aug 26, 2015 at 02:02:26PM +0200, Jan Tulak wrote:
quoted
Signed-off-by: Jan Tulak <redacted>
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
jtulak@redhat.com / jan@tulak.me
From: Christoph Hellwig <hch@infradead.org> Date: 2015-08-31 18:57:09
On Wed, Aug 26, 2015 at 02:02:25PM +0200, Jan Tulak wrote:
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,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Christoph Hellwig <hch@infradead.org> Date: 2015-08-31 19:00:11
On Wed, Aug 26, 2015 at 02:02:32PM +0200, Jan Tulak wrote:
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Christoph Hellwig <hch@infradead.org> Date: 2015-08-31 19:01:25
On Wed, Aug 26, 2015 at 02:02:34PM +0200, Jan Tulak wrote:
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Christoph Hellwig <hch@infradead.org> Date: 2015-08-31 19:01:48
NAK - just don't compile the mremap support in xfs_io if support
for it is missing in the OS.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-09-01 08:04:40
UPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 2 ++
1 file changed, 2 insertions(+)
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.
Well, you wrote about adding it into xfs_format.h. I don't recall (and
can't find) anything else regarding XATTR_SIZE...
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.
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
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-01 08:35:59
Ah, never mind, I noticed I didn't read the last part of Dave's email. It
looks clear now.
Jan
On Tue, Sep 1, 2015 at 10:13 AM, Jan Tulak [off-list ref] wrote:
On Mon, Aug 31, 2015 at 8:58 PM, Christoph Hellwig [off-list ref]
wrote:
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.
Well, you wrote about adding it into xfs_format.h. I don't recall (and
can't find) anything else regarding XATTR_SIZE...
quoted
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.
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
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Darrick J. Wong <hidden> Date: 2015-09-01 16:31:48
On Tue, Sep 01, 2015 at 10:04:32AM +0200, Jan Tulak wrote:
quoted hunk
UPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 2 ++
1 file changed, 2 insertions(+)
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
static __inline__ int
platform_discard_blocks(int fd, uint64_t start, uint64_t len)
{
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-09-02 07:12:28
On Tue, Sep 1, 2015 at 6:31 PM, Darrick J. Wong [off-list ref]
wrote:
On Tue, Sep 01, 2015 at 10:04:32AM +0200, Jan Tulak wrote:
quoted
UPDATE: changed to #define
OS X has only nftw variant - not the 64 suffix used in xfs.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 2 ++
1 file changed, 2 insertions(+)
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. :)
Good idea. I'll run tests after the change
and if nothing bad happens, I send
it here.
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-02 10:54:29
On Mon, Aug 31, 2015 at 9:00 PM, Christoph Hellwig [off-list ref]
wrote:
On Wed, Aug 26, 2015 at 02:02:32PM +0200, Jan Tulak wrote:
quoted
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
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-03 09:02:11
On Mon, Aug 31, 2015 at 9:01 PM, Christoph Hellwig [off-list ref]
wrote:
On Wed, Aug 26, 2015 at 02:02:34PM +0200, Jan Tulak wrote:
quoted
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
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-03 10:33:21
OS X has no XATTR_LIST_MAX value. So add it to the platform header.
Signed-off-by: Jan Tulak <redacted>
---
include/darwin.h | 5 +++++
1 file changed, 5 insertions(+)
From: Dave Chinner <david@fromorbit.com> Date: 2015-09-03 10:33:22
On Thu, Sep 03, 2015 at 11:01:44AM +0200, Jan Tulak wrote:
On Mon, Aug 31, 2015 at 9:01 PM, Christoph Hellwig [off-list ref]
wrote:
quoted
On Wed, Aug 26, 2015 at 02:02:34PM +0200, Jan Tulak wrote:
quoted
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.
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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-09-03 10:33:24
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.
Signed-off-by: Jan Tulak <redacted>
---
libxfs/xfs_attr_remote.c | 2 +-
libxfs/xfs_format.h | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
From: Jan Tulak <hidden> Date: 2015-09-03 10:33:27
WILL 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?
Signed-off-by: Jan Tulak <redacted>
---
include/xfs.h | 2 ++
libhandle/handle.c | 4 ++--
libhandle/jdm.c | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
From: Jan Tulak <hidden> Date: 2015-09-03 10:35:15
Don't build mremap (in xfs_io) on platforms where it has no support.
CHANGELOG:
- subject was xfsprogs: add dummy mremap for OS X
Signed-off-by: Jan Tulak <redacted>
---
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(+)
@@ -688,6 +692,7 @@ mmap_init(void)_("writes data into a region in the current memory mapping");mwrite_cmd.help=mwrite_help;+#ifdef HAVE_MREMAPmremap_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_MREMAPadd_command(&mremap_cmd);+#endif /* HAVE_MREMAP */}
@@ -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)+ ])
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-09-03 10:37:44
On Thu, Sep 3, 2015 at 12:33 PM, Dave Chinner [off-list ref] wrote:
On Thu, Sep 03, 2015 at 11:01:44AM +0200, Jan Tulak wrote:
quoted
On Mon, Aug 31, 2015 at 9:01 PM, Christoph Hellwig [off-list ref]
wrote:
quoted
On Wed, Aug 26, 2015 at 02:02:34PM +0200, Jan Tulak wrote:
quoted
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.
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.
All right, I will look on this. Thanks. :-)
Cheers,
Jan
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-03 10:39:51
Changelog:
- 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.
Signed-off-by: Jan Tulak <redacted>
---
estimate/xfs_estimate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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);
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
From: Jan Tulak <hidden> Date: 2015-09-08 14:23:43
For 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.
Signed-off-by: Jan Tulak <redacted>
---
fsr/Makefile | 8 +++++++
fsr/xfs_fsr.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--------
include/darwin.h | 20 ++++++++++++++++
3 files changed, 87 insertions(+), 10 deletions(-)
@@ -202,6 +205,27 @@ find_mountpoint(char *mtab, char *argname, struct stat64 *sb)}while((t=getmntent(mtabp))){+#elif defined(HAVE_GETMNTINFO)+structstatfs*stats;+interror,i,count;+// because "t" is a pointer, but we don't need to use+// malloc for this usage+structmntentt_tmp;+t=&t_tmp;+++error=0;+if((count=getmntinfo(&stats,0))<0){+fprintf(stderr,_("%s: getmntinfo() failed: %s\n"),+progname,strerror(errno));+return0;+}++for(i=0;i<count;i++){+mntinfo2mntent(&stats[i],t);+#else+# error "How do I extract info about mounted filesystems on this platform?"+#endifif(S_ISDIR(sb->st_mode)){/* mount point */if(stat64(t->mnt_dir,&ms)<0)continue;
@@ -411,18 +436,11 @@ usage(int ret)staticvoidinitallfs(char*mtab){-FILE*fp;structmntent*mp;intmi;char*cp;structstat64sb;-fp=setmntent(mtab,"r");-if(fp==NULL){-fsrprintf(_("could not open mtab file: %s\n"),mtab);-exit(1);-}-/* malloc a number of descriptors, increased later if needed */if(!(fsbase=(fsdesc_t*)malloc(fsbufsize*sizeof(fsdesc_t)))){fsrprintf(_("out of memory: %s\n"),strerror(errno));
@@ -433,7 +451,36 @@ initallfs(char *mtab)/* find all rw xfs file systems */mi=0;fs=fsbase;++#if defined(HAVE_GETMNTENT)+FILE*fp;+fp=setmntent(mtab,"r");+if(fp==NULL){+fsrprintf(_("could not open mtab file: %s\n"),mtab);+exit(1);+}+while((mp=getmntent(fp))){+#elif defined(HAVE_GETMNTINFO)+structstatfs*stats;+interror,i,count;+// because "t" is a pointer, but we don't need to use+// malloc for this usage+structmntentmp_tmp;+mp=&mp_tmp;+error=0;+if((count=getmntinfo(&stats,0))<0){+fprintf(stderr,_("%s: getmntinfo() failed: %s\n"),+progname,strerror(errno));+exit(1);+}++for(i=0;i<count;i++){+mntinfo2mntent(&stats[i],mp);+#else+# error "How do I extract info about mounted filesystems on this platform?"+#endif+intrw=0;if(strcmp(mp->mnt_type,MNTTYPE_XFS)!=0||
@@ -485,7 +532,9 @@ initallfs(char *mtab)}numfs=mi;fsend=(fsbase+numfs);+#if defined(HAVE_GETMNTENT)endmntent(fp);+#endifif(numfs==0){fsrprintf(_("no rw xfs file systems in mtab: %s\n"),mtab);exit(0);
@@ -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);--
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
From ftw.h, the difference is in __nftw_func_t and __nftw64_func_t as 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
--
Jan Tulak
jtulak@redhat.com / jan@tulak.me
From: Jan Tulak <hidden> Date: 2015-09-09 10:14:28
Changelog:
- 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.
Signed-off-by: Jan Tulak <redacted>
---
estimate/xfs_estimate.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -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(constchar*path,conststructstat64*stb,intflags,structFTW*f)+ffn(constchar*path,conststructstat*stb,intflags,structFTW*f){/* cases are in most-encountered to least-encountered order */dirsize+=PERDIRENTRY+strlen(path);
--
2.4.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs