Re: [PATCH] [v2] blkdev: always export SECTOR_SHIFT

From: Arnd Bergmann
Date: Fri Jul 19 2019 - 09:15:12 EST


On Fri, Jul 19, 2019 at 2:13 PM Christoph Hellwig <hch@xxxxxx> 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.

> Otherwise looks good.
>
> In fact given that sector_t is in linux/types.h I wonder if these
> should just move there.

Less sure about that, we don't really have other constants in that
file, just typedefs and a few common structures.

ARnd