History

block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h>

It happens often while I'm preparing a patch for a block driver that I'm wondering: is a definition of SECTOR_SIZE and/or SECTOR_SHIFT available for this driver? Do I have to introduce definitions of these constants before I can use these constants? To avoid this confusion, move the existing definitions of SECTOR_SIZE and SECTOR_SHIFT into the <linux/blkdev.h> header file such that these become available for all block drivers. Make the SECTOR_SIZE definition in the uapi msdos_fs.h header file conditional to avoid that including that header file after <linux/blkdev.h> causes the compiler to complain about a SECTOR_SIZE redefinition. Note: the SECTOR_SIZE / SECTOR_SHIFT / SECTOR_BITS definitions have not been removed from uapi header files nor from NAND drivers in which these constants are used for another purpose than converting block layer offsets and sizes into a number of sectors.

Bart Van Assche committed 8 years ago

Commit 233bde21 parent ec6dcf613 files · +38 −41Browse files

Showing the changes to include/uapi/linux (1 of 13 files). Show all

Unified · Split

include/uapi/linux/msdos_fs.h+2−0
@@ -10,7 +10,9 @@ · 9 unmodified lines
10 * The MS-DOS filesystem constants/structures10 * The MS-DOS filesystem constants/structures
11 */11 */
12 12
13#ifndef SECTOR_SIZE
13#define SECTOR_SIZE 512 /* sector size (bytes) */14#define SECTOR_SIZE 512 /* sector size (bytes) */
15#endif
14#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */16#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
15#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */17#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
16#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */18#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */