[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a3j0opg-1yUt4sAU+fxCvk0bKBoJKc16jyPUPmyHEr0hg@mail.gmail.com>
Date: Fri, 19 Jul 2019 15:28:09 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Christoph Hellwig <hch@....de>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Jani Nikula <jani.nikula@...el.com>,
Randy Dunlap <rdunlap@...radead.org>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Jens Axboe <axboe@...nel.dk>, Hannes Reinecke <hare@...e.com>,
Omar Sandoval <osandov@...com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Subject: Re: [PATCH] [v2] blkdev: always export SECTOR_SHIFT
On Fri, Jul 19, 2019 at 3:14 PM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Fri, Jul 19, 2019 at 2:13 PM Christoph Hellwig <hch@....de> wrote:
> >
> > > +/*
> > > + * The basic unit of block I/O is a sector. It is used in a number of contexts
> > > + * in Linux (blk, bio, genhd). The size of one sector is 512 = 2**9
> > > + * bytes. Variables of type sector_t represent an offset or size that is a
> > > + * multiple of 512 bytes. Hence these two constants.
> > > + */
> > > +#ifndef SECTOR_SHIFT
> > > +#define SECTOR_SHIFT 9
> > > +#endif
> > > +#ifndef SECTOR_SIZE
> > > +#define SECTOR_SIZE (1 << SECTOR_SHIFT)
> > > +#endif
> >
> > While we're at it we really should drop the ifndefs.
>
> Good idea. Needs some more build testing then.
Did not take long:
In file included from block/partitions/msdos.c:24:
In file included from block/partitions/check.h:3:
include/linux/blkdev.h:15:9: error: 'SECTOR_SIZE' macro redefined
[-Werror,-Wmacro-redefined]
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
^
include/uapi/linux/msdos_fs.h:14:9: note: previous definition is here
#define SECTOR_SIZE 512 /* sector size (bytes) */
^
This could clearly be fixed as well, but I suspect we're better off not touching
it any further than necessary.
Arnd
Powered by blists - more mailing lists