* [PATCH 0/4] xfstests portability fixes for Android
@ 2015-07-27 14:22 Theodore Ts'o
2015-07-27 14:22 ` [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512 Theodore Ts'o
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-27 14:22 UTC (permalink / raw
To: fstests; +Cc: Theodore Ts'o
As part of my efforts to port xfstests so it can be cross-compiled for
Android (where running fsstress by hand seems to be the
state-of-the-art in file system QA), I had to make the following
portability fixes.
Modulo working around some missing functions in the Bionic libc, I was
pleasantly surprised how few changes were required!
Theodore Ts'o (4):
xfstests: if DEV_BSIZE is not defined, assume it to be 512
xfstests: Support C libraries that define SIGCHLD instead of SIGCLD
xfstests: use the Posix st_mode defines instead of the obsolete SysV
ones
xfstests: remove manual declaration of errno
lib/str_to_bytes.c | 4 ++++
lib/write_log.c | 4 ++++
ltp/doio.c | 4 ++++
ltp/growfiles.c | 6 +++++-
src/locktest.c | 1 -
src/lstat64.c | 18 +++++++++---------
6 files changed, 26 insertions(+), 11 deletions(-)
--
2.3.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512
2015-07-27 14:22 [PATCH 0/4] xfstests portability fixes for Android Theodore Ts'o
@ 2015-07-27 14:22 ` Theodore Ts'o
2015-07-30 17:13 ` Christoph Hellwig
2015-07-27 14:22 ` [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD Theodore Ts'o
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-27 14:22 UTC (permalink / raw
To: fstests; +Cc: Theodore Ts'o
On Linux systems with glibc, DEV_BSIZE defines the sector size for the
Linux kernel, which is 512 since the beginning of time --- and which
we can't really change without breaking a huge amount of kernel code.
Some non-glibc C libraries, may not define DEV_BSIZE; if it does not
exist, assume that it will be 512.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/str_to_bytes.c | 4 ++++
lib/write_log.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c
index c0d7d97..d63e93b 100644
--- a/lib/str_to_bytes.c
+++ b/lib/str_to_bytes.c
@@ -44,7 +44,11 @@
****************************************************************************/
#if linux
+#ifdef DEV_BSIZE
#define B_MULT DEV_BSIZE /* block size */
+#else
+#define B_MULT 512 /* block size */
+#endif
#endif
diff --git a/lib/write_log.c b/lib/write_log.c
index 8c921fc..852a2ae 100644
--- a/lib/write_log.c
+++ b/lib/write_log.c
@@ -62,7 +62,11 @@
#ifndef BSIZE
#ifdef linux
+#ifdef DEV_BSIZE
#define BSIZE DEV_BSIZE
+#else /* !DEV_BSIZE */
+#define BSIZE 512
+#endif /* DEV_BSIZE */
#else
#define BSIZE BBSIZE
#endif
--
2.3.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD
2015-07-27 14:22 [PATCH 0/4] xfstests portability fixes for Android Theodore Ts'o
2015-07-27 14:22 ` [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512 Theodore Ts'o
@ 2015-07-27 14:22 ` Theodore Ts'o
2015-07-30 17:14 ` Christoph Hellwig
2015-07-27 14:22 ` [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones Theodore Ts'o
2015-07-27 14:22 ` [PATCH 4/4] xfstests: remove manual declaration of errno Theodore Ts'o
3 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-27 14:22 UTC (permalink / raw
To: fstests; +Cc: Theodore Ts'o
SIGCLD is the name used by System V; SIGCHLD is the name defined by
Posix. Some C libraries will only define SIGCHLD and not SIGCLD, so
accomodate them.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
ltp/doio.c | 4 ++++
ltp/growfiles.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ltp/doio.c b/ltp/doio.c
index 966cff1..3e525d4 100644
--- a/ltp/doio.c
+++ b/ltp/doio.c
@@ -361,7 +361,11 @@ char **argv;
case SIGTSTP:
case SIGSTOP:
case SIGCONT:
+#if defined(SIGCLD)
case SIGCLD:
+#elif defined (SIGCHLD)
+ case SIGCHLD:
+#endif
case SIGBUS:
case SIGSEGV:
case SIGQUIT:
diff --git a/ltp/growfiles.c b/ltp/growfiles.c
index 06f179f..19ed013 100644
--- a/ltp/growfiles.c
+++ b/ltp/growfiles.c
@@ -1389,7 +1389,11 @@ set_sig()
#ifdef SIGRESTART
case SIGRESTART:
#endif /* SIGRESTART */
- case SIGCLD:
+#if defined(SIGCLD)
+ case SIGCLD:
+#elif defined(SIGCHLD)
+ case SIGCHLD:
+#endif
break;
default:
--
2.3.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones
2015-07-27 14:22 [PATCH 0/4] xfstests portability fixes for Android Theodore Ts'o
2015-07-27 14:22 ` [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512 Theodore Ts'o
2015-07-27 14:22 ` [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD Theodore Ts'o
@ 2015-07-27 14:22 ` Theodore Ts'o
2015-07-30 17:14 ` Christoph Hellwig
2015-07-27 14:22 ` [PATCH 4/4] xfstests: remove manual declaration of errno Theodore Ts'o
3 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-27 14:22 UTC (permalink / raw
To: fstests; +Cc: Theodore Ts'o
Instead of S_IEXEC, S_IREAD, and S_IWRITE, use the Posix defines of
S_I[WRX]{OTH,GRP,USR}.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
src/lstat64.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/lstat64.c b/src/lstat64.c
index 3b68c66..c8a0cc6 100644
--- a/src/lstat64.c
+++ b/src/lstat64.c
@@ -92,23 +92,23 @@ main(int argc, char **argv)
printf(" Size: %-10llu", (unsigned long long)sbuf.st_size);
}
- if (sbuf.st_mode & (S_IEXEC>>6))
+ if (sbuf.st_mode & S_IXOTH)
mode[9] = 'x';
- if (sbuf.st_mode & (S_IWRITE>>6))
+ if (sbuf.st_mode & S_IWOTH)
mode[8] = 'w';
- if (sbuf.st_mode & (S_IREAD>>6))
+ if (sbuf.st_mode & S_IROTH)
mode[7] = 'r';
- if (sbuf.st_mode & (S_IEXEC>>3))
+ if (sbuf.st_mode & S_IXGRP)
mode[6] = 'x';
- if (sbuf.st_mode & (S_IWRITE>>3))
+ if (sbuf.st_mode & S_IWGRP)
mode[5] = 'w';
- if (sbuf.st_mode & (S_IREAD>>3))
+ if (sbuf.st_mode & S_IRGRP)
mode[4] = 'r';
- if (sbuf.st_mode & S_IEXEC)
+ if (sbuf.st_mode & S_IXUSR)
mode[3] = 'x';
- if (sbuf.st_mode & S_IWRITE)
+ if (sbuf.st_mode & S_IWUSR)
mode[2] = 'w';
- if (sbuf.st_mode & S_IREAD)
+ if (sbuf.st_mode & S_IRUSR)
mode[1] = 'r';
if (sbuf.st_mode & S_ISVTX)
mode[9] = 't';
--
2.3.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] xfstests: remove manual declaration of errno
2015-07-27 14:22 [PATCH 0/4] xfstests portability fixes for Android Theodore Ts'o
` (2 preceding siblings ...)
2015-07-27 14:22 ` [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones Theodore Ts'o
@ 2015-07-27 14:22 ` Theodore Ts'o
2015-07-30 17:15 ` Christoph Hellwig
3 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-27 14:22 UTC (permalink / raw
To: fstests; +Cc: Theodore Ts'o
locktest.c has already #included <errno.h>, so remove the unneeded
(and in some cases, incorrect) manual declaration of errno as an
integer. Some C libraries use a macro to provide thread-safety for
errno, so it's incorrect to try to provide a manual declaration.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
src/locktest.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/locktest.c b/src/locktest.c
index 23bb240..adf8ce0 100644
--- a/src/locktest.c
+++ b/src/locktest.c
@@ -779,7 +779,6 @@ main(int argc, char *argv[])
char *p;
extern char *optarg;
extern int optind;
- extern int errno;
int fail_count = 0;;
atexit(cleanup);
--
2.3.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512
2015-07-27 14:22 ` [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512 Theodore Ts'o
@ 2015-07-30 17:13 ` Christoph Hellwig
2015-07-30 17:47 ` Theodore Ts'o
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-30 17:13 UTC (permalink / raw
To: Theodore Ts'o; +Cc: fstests
On Mon, Jul 27, 2015 at 10:22:44AM -0400, Theodore Ts'o wrote:
> On Linux systems with glibc, DEV_BSIZE defines the sector size for the
> Linux kernel, which is 512 since the beginning of time --- and which
> we can't really change without breaking a huge amount of kernel code.
> Some non-glibc C libraries, may not define DEV_BSIZE; if it does not
> exist, assume that it will be 512.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> lib/str_to_bytes.c | 4 ++++
> lib/write_log.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c
> index c0d7d97..d63e93b 100644
> --- a/lib/str_to_bytes.c
> +++ b/lib/str_to_bytes.c
> @@ -44,7 +44,11 @@
> ****************************************************************************/
>
> #if linux
> +#ifdef DEV_BSIZE
> #define B_MULT DEV_BSIZE /* block size */
> +#else
> +#define B_MULT 512 /* block size */
> +#endif
> #endif
That ifdef Linux looks bogus too. I's say just define it to 512
bytes here unconditionally.
> #ifndef BSIZE
> #ifdef linux
> +#ifdef DEV_BSIZE
> #define BSIZE DEV_BSIZE
> +#else /* !DEV_BSIZE */
> +#define BSIZE 512
> +#endif /* DEV_BSIZE */
> #else
> #define BSIZE BBSIZE
> #endif
Same here, drop all the ifdefs and just define it to 512.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD
2015-07-27 14:22 ` [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD Theodore Ts'o
@ 2015-07-30 17:14 ` Christoph Hellwig
2015-07-30 17:47 ` Theodore Ts'o
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-30 17:14 UTC (permalink / raw
To: Theodore Ts'o; +Cc: fstests
On Mon, Jul 27, 2015 at 10:22:45AM -0400, Theodore Ts'o wrote:
> SIGCLD is the name used by System V; SIGCHLD is the name defined by
> Posix. Some C libraries will only define SIGCHLD and not SIGCLD, so
> accomodate them.
Please just use SIGCHLD unconditionally, there is no point in supporting
pre-Posix systems in xfstests.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones
2015-07-27 14:22 ` [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones Theodore Ts'o
@ 2015-07-30 17:14 ` Christoph Hellwig
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-30 17:14 UTC (permalink / raw
To: Theodore Ts'o; +Cc: fstests
On Mon, Jul 27, 2015 at 10:22:46AM -0400, Theodore Ts'o wrote:
> Instead of S_IEXEC, S_IREAD, and S_IWRITE, use the Posix defines of
> S_I[WRX]{OTH,GRP,USR}.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] xfstests: remove manual declaration of errno
2015-07-27 14:22 ` [PATCH 4/4] xfstests: remove manual declaration of errno Theodore Ts'o
@ 2015-07-30 17:15 ` Christoph Hellwig
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-30 17:15 UTC (permalink / raw
To: Theodore Ts'o; +Cc: fstests
On Mon, Jul 27, 2015 at 10:22:47AM -0400, Theodore Ts'o wrote:
> locktest.c has already #included <errno.h>, so remove the unneeded
> (and in some cases, incorrect) manual declaration of errno as an
> integer. Some C libraries use a macro to provide thread-safety for
> errno, so it's incorrect to try to provide a manual declaration.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512
2015-07-30 17:13 ` Christoph Hellwig
@ 2015-07-30 17:47 ` Theodore Ts'o
0 siblings, 0 replies; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-30 17:47 UTC (permalink / raw
To: Christoph Hellwig; +Cc: fstests
On Thu, Jul 30, 2015 at 10:13:58AM -0700, Christoph Hellwig wrote:
> > diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c
> > index c0d7d97..d63e93b 100644
> > --- a/lib/str_to_bytes.c
> > +++ b/lib/str_to_bytes.c
> > @@ -44,7 +44,11 @@
> > ****************************************************************************/
> >
> > #if linux
> > +#ifdef DEV_BSIZE
> > #define B_MULT DEV_BSIZE /* block size */
> > +#else
> > +#define B_MULT 512 /* block size */
> > +#endif
> > #endif
>
> That ifdef Linux looks bogus too. I's say just define it to 512
> bytes here unconditionally.
Ack, will do.
> Same here, drop all the ifdefs and just define it to 512.
Ditto
- Ted
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD
2015-07-30 17:14 ` Christoph Hellwig
@ 2015-07-30 17:47 ` Theodore Ts'o
0 siblings, 0 replies; 11+ messages in thread
From: Theodore Ts'o @ 2015-07-30 17:47 UTC (permalink / raw
To: Christoph Hellwig; +Cc: fstests
On Thu, Jul 30, 2015 at 10:14:28AM -0700, Christoph Hellwig wrote:
> On Mon, Jul 27, 2015 at 10:22:45AM -0400, Theodore Ts'o wrote:
> > SIGCLD is the name used by System V; SIGCHLD is the name defined by
> > Posix. Some C libraries will only define SIGCHLD and not SIGCLD, so
> > accomodate them.
>
> Please just use SIGCHLD unconditionally, there is no point in supporting
> pre-Posix systems in xfstests.
Ack, will do.
- Ted
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-07-30 17:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 14:22 [PATCH 0/4] xfstests portability fixes for Android Theodore Ts'o
2015-07-27 14:22 ` [PATCH 1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512 Theodore Ts'o
2015-07-30 17:13 ` Christoph Hellwig
2015-07-30 17:47 ` Theodore Ts'o
2015-07-27 14:22 ` [PATCH 2/4] xfstests: Support C libraries that define SIGCHLD instead of SIGCLD Theodore Ts'o
2015-07-30 17:14 ` Christoph Hellwig
2015-07-30 17:47 ` Theodore Ts'o
2015-07-27 14:22 ` [PATCH 3/4] xfstests: use the Posix st_mode defines instead of the obsolete SysV ones Theodore Ts'o
2015-07-30 17:14 ` Christoph Hellwig
2015-07-27 14:22 ` [PATCH 4/4] xfstests: remove manual declaration of errno Theodore Ts'o
2015-07-30 17:15 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.