diff mbox

[1/4] xfstests: if DEV_BSIZE is not defined, assume it to be 512

Message ID 1438006967-18815-2-git-send-email-tytso@mit.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Theodore Ts'o July 27, 2015, 2:22 p.m. UTC
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(+)

Comments

Christoph Hellwig July 30, 2015, 5:13 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o July 30, 2015, 5:47 p.m. UTC | #2
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
					
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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