Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

make MTD headers use strict integer types

The MTD headers traditionally use stdint types rather than
the kernel integer types. This converts them to do the
same as all the others.

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Arnd Bergmann and committed by
Ingo Molnar
ccef7ab5 9adfbfb6

+123 -115
+14 -13
include/linux/jffs2.h
··· 12 12 #ifndef __LINUX_JFFS2_H__ 13 13 #define __LINUX_JFFS2_H__ 14 14 15 + #include <linux/types.h> 15 16 #include <linux/magic.h> 16 17 17 18 /* You must include something which defines the C99 uintXX_t types. ··· 92 91 byteswapping */ 93 92 94 93 typedef struct { 95 - uint32_t v32; 94 + __u32 v32; 96 95 } __attribute__((packed)) jint32_t; 97 96 98 97 typedef struct { 99 - uint32_t m; 98 + __u32 m; 100 99 } __attribute__((packed)) jmode_t; 101 100 102 101 typedef struct { 103 - uint16_t v16; 102 + __u16 v16; 104 103 } __attribute__((packed)) jint16_t; 105 104 106 105 struct jffs2_unknown_node ··· 122 121 jint32_t version; 123 122 jint32_t ino; /* == zero for unlink */ 124 123 jint32_t mctime; 125 - uint8_t nsize; 126 - uint8_t type; 127 - uint8_t unused[2]; 124 + __u8 nsize; 125 + __u8 type; 126 + __u8 unused[2]; 128 127 jint32_t node_crc; 129 128 jint32_t name_crc; 130 - uint8_t name[0]; 129 + __u8 name[0]; 131 130 }; 132 131 133 132 /* The JFFS2 raw inode structure: Used for storage on physical media. */ ··· 154 153 jint32_t offset; /* Where to begin to write. */ 155 154 jint32_t csize; /* (Compressed) data size */ 156 155 jint32_t dsize; /* Size of the node's data. (after decompression) */ 157 - uint8_t compr; /* Compression algorithm used */ 158 - uint8_t usercompr; /* Compression algorithm requested by the user */ 156 + __u8 compr; /* Compression algorithm used */ 157 + __u8 usercompr; /* Compression algorithm requested by the user */ 159 158 jint16_t flags; /* See JFFS2_INO_FLAG_* */ 160 159 jint32_t data_crc; /* CRC for the (compressed) data. */ 161 160 jint32_t node_crc; /* CRC for the raw inode (excluding data) */ 162 - uint8_t data[0]; 161 + __u8 data[0]; 163 162 }; 164 163 165 164 struct jffs2_raw_xattr { ··· 169 168 jint32_t hdr_crc; 170 169 jint32_t xid; /* XATTR identifier number */ 171 170 jint32_t version; 172 - uint8_t xprefix; 173 - uint8_t name_len; 171 + __u8 xprefix; 172 + __u8 name_len; 174 173 jint16_t value_len; 175 174 jint32_t data_crc; 176 175 jint32_t node_crc; 177 - uint8_t data[0]; 176 + __u8 data[0]; 178 177 } __attribute__((packed)); 179 178 180 179 struct jffs2_raw_xref
+18 -18
include/mtd/inftl-user.h
··· 16 16 /* Block Control Information */ 17 17 18 18 struct inftl_bci { 19 - uint8_t ECCsig[6]; 20 - uint8_t Status; 21 - uint8_t Status1; 19 + __u8 ECCsig[6]; 20 + __u8 Status; 21 + __u8 Status1; 22 22 } __attribute__((packed)); 23 23 24 24 struct inftl_unithead1 { 25 - uint16_t virtualUnitNo; 26 - uint16_t prevUnitNo; 27 - uint8_t ANAC; 28 - uint8_t NACs; 29 - uint8_t parityPerField; 30 - uint8_t discarded; 25 + __u16 virtualUnitNo; 26 + __u16 prevUnitNo; 27 + __u8 ANAC; 28 + __u8 NACs; 29 + __u8 parityPerField; 30 + __u8 discarded; 31 31 } __attribute__((packed)); 32 32 33 33 struct inftl_unithead2 { 34 - uint8_t parityPerField; 35 - uint8_t ANAC; 36 - uint16_t prevUnitNo; 37 - uint16_t virtualUnitNo; 38 - uint8_t NACs; 39 - uint8_t discarded; 34 + __u8 parityPerField; 35 + __u8 ANAC; 36 + __u16 prevUnitNo; 37 + __u16 virtualUnitNo; 38 + __u8 NACs; 39 + __u8 discarded; 40 40 } __attribute__((packed)); 41 41 42 42 struct inftl_unittail { 43 - uint8_t Reserved[4]; 44 - uint16_t EraseMark; 45 - uint16_t EraseMark1; 43 + __u8 Reserved[4]; 44 + __u16 EraseMark; 45 + __u16 EraseMark1; 46 46 } __attribute__((packed)); 47 47 48 48 union inftl_uci {
+3 -2
include/mtd/jffs2-user.h
··· 7 7 8 8 /* This file is blessed for inclusion by userspace */ 9 9 #include <linux/jffs2.h> 10 + #include <linux/types.h> 10 11 #include <endian.h> 11 12 #include <byteswap.h> 12 13 ··· 20 19 21 20 extern int target_endian; 22 21 23 - #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) 24 - #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) 22 + #define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) 23 + #define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) 25 24 26 25 #define cpu_to_je16(x) ((jint16_t){t16(x)}) 27 26 #define cpu_to_je32(x) ((jint32_t){t32(x)})
+34 -32
include/mtd/mtd-abi.h
··· 5 5 #ifndef __MTD_ABI_H__ 6 6 #define __MTD_ABI_H__ 7 7 8 + #include <linux/types.h> 9 + 8 10 struct erase_info_user { 9 - uint32_t start; 10 - uint32_t length; 11 + __u32 start; 12 + __u32 length; 11 13 }; 12 14 13 15 struct mtd_oob_buf { 14 - uint32_t start; 15 - uint32_t length; 16 + __u32 start; 17 + __u32 length; 16 18 unsigned char __user *ptr; 17 19 }; 18 20 ··· 50 48 #define MTD_OTP_USER 2 51 49 52 50 struct mtd_info_user { 53 - uint8_t type; 54 - uint32_t flags; 55 - uint32_t size; // Total size of the MTD 56 - uint32_t erasesize; 57 - uint32_t writesize; 58 - uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 51 + __u8 type; 52 + __u32 flags; 53 + __u32 size; // Total size of the MTD 54 + __u32 erasesize; 55 + __u32 writesize; 56 + __u32 oobsize; // Amount of OOB data per block (e.g. 16) 59 57 /* The below two fields are obsolete and broken, do not use them 60 58 * (TODO: remove at some point) */ 61 - uint32_t ecctype; 62 - uint32_t eccsize; 59 + __u32 ecctype; 60 + __u32 eccsize; 63 61 }; 64 62 65 63 struct region_info_user { 66 - uint32_t offset; /* At which this region starts, 64 + __u32 offset; /* At which this region starts, 67 65 * from the beginning of the MTD */ 68 - uint32_t erasesize; /* For this region */ 69 - uint32_t numblocks; /* Number of blocks in this region */ 70 - uint32_t regionindex; 66 + __u32 erasesize; /* For this region */ 67 + __u32 numblocks; /* Number of blocks in this region */ 68 + __u32 regionindex; 71 69 }; 72 70 73 71 struct otp_info { 74 - uint32_t start; 75 - uint32_t length; 76 - uint32_t locked; 72 + __u32 start; 73 + __u32 length; 74 + __u32 locked; 77 75 }; 78 76 79 77 #define MEMGETINFO _IOR('M', 1, struct mtd_info_user) ··· 101 99 * interfaces 102 100 */ 103 101 struct nand_oobinfo { 104 - uint32_t useecc; 105 - uint32_t eccbytes; 106 - uint32_t oobfree[8][2]; 107 - uint32_t eccpos[32]; 102 + __u32 useecc; 103 + __u32 eccbytes; 104 + __u32 oobfree[8][2]; 105 + __u32 eccpos[32]; 108 106 }; 109 107 110 108 struct nand_oobfree { 111 - uint32_t offset; 112 - uint32_t length; 109 + __u32 offset; 110 + __u32 length; 113 111 }; 114 112 115 113 #define MTD_MAX_OOBFREE_ENTRIES 8 ··· 118 116 * diagnosis and to allow creation of raw images 119 117 */ 120 118 struct nand_ecclayout { 121 - uint32_t eccbytes; 122 - uint32_t eccpos[64]; 123 - uint32_t oobavail; 119 + __u32 eccbytes; 120 + __u32 eccpos[64]; 121 + __u32 oobavail; 124 122 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; 125 123 }; 126 124 ··· 133 131 * @bbtblocks: number of blocks reserved for bad block tables 134 132 */ 135 133 struct mtd_ecc_stats { 136 - uint32_t corrected; 137 - uint32_t failed; 138 - uint32_t badblocks; 139 - uint32_t bbtblocks; 134 + __u32 corrected; 135 + __u32 failed; 136 + __u32 badblocks; 137 + __u32 bbtblocks; 140 138 }; 141 139 142 140 /*
+17 -15
include/mtd/nftl-user.h
··· 6 6 #ifndef __MTD_NFTL_USER_H__ 7 7 #define __MTD_NFTL_USER_H__ 8 8 9 + #include <linux/types.h> 10 + 9 11 /* Block Control Information */ 10 12 11 13 struct nftl_bci { 12 14 unsigned char ECCSig[6]; 13 - uint8_t Status; 14 - uint8_t Status1; 15 + __u8 Status; 16 + __u8 Status1; 15 17 }__attribute__((packed)); 16 18 17 19 /* Unit Control Information */ 18 20 19 21 struct nftl_uci0 { 20 - uint16_t VirtUnitNum; 21 - uint16_t ReplUnitNum; 22 - uint16_t SpareVirtUnitNum; 23 - uint16_t SpareReplUnitNum; 22 + __u16 VirtUnitNum; 23 + __u16 ReplUnitNum; 24 + __u16 SpareVirtUnitNum; 25 + __u16 SpareReplUnitNum; 24 26 } __attribute__((packed)); 25 27 26 28 struct nftl_uci1 { 27 - uint32_t WearInfo; 28 - uint16_t EraseMark; 29 - uint16_t EraseMark1; 29 + __u32 WearInfo; 30 + __u16 EraseMark; 31 + __u16 EraseMark1; 30 32 } __attribute__((packed)); 31 33 32 34 struct nftl_uci2 { 33 - uint16_t FoldMark; 34 - uint16_t FoldMark1; 35 - uint32_t unused; 35 + __u16 FoldMark; 36 + __u16 FoldMark1; 37 + __u32 unused; 36 38 } __attribute__((packed)); 37 39 38 40 union nftl_uci { ··· 52 50 53 51 struct NFTLMediaHeader { 54 52 char DataOrgID[6]; 55 - uint16_t NumEraseUnits; 56 - uint16_t FirstPhysicalEUN; 57 - uint32_t FormattedSize; 53 + __u16 NumEraseUnits; 54 + __u16 FirstPhysicalEUN; 55 + __u32 FormattedSize; 58 56 unsigned char UnitSizeFactor; 59 57 } __attribute__((packed)); 60 58
+37 -35
include/mtd/ubi-user.h
··· 21 21 #ifndef __UBI_USER_H__ 22 22 #define __UBI_USER_H__ 23 23 24 + #include <linux/types.h> 25 + 24 26 /* 25 27 * UBI device creation (the same as MTD device attachment) 26 28 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ··· 154 152 /* Create an UBI volume */ 155 153 #define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) 156 154 /* Remove an UBI volume */ 157 - #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t) 155 + #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32) 158 156 /* Re-size an UBI volume */ 159 157 #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) 160 158 /* Re-name volumes */ ··· 167 165 /* Attach an MTD device */ 168 166 #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) 169 167 /* Detach an MTD device */ 170 - #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t) 168 + #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32) 171 169 172 170 /* ioctl commands of UBI volume character devices */ 173 171 174 172 #define UBI_VOL_IOC_MAGIC 'O' 175 173 176 174 /* Start UBI volume update */ 177 - #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t) 175 + #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) 178 176 /* LEB erasure command, used for debugging, disabled by default */ 179 - #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t) 177 + #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) 180 178 /* Atomic LEB change command */ 181 - #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t) 179 + #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32) 182 180 /* Map LEB command */ 183 181 #define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) 184 182 /* Unmap LEB command */ 185 - #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) 183 + #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32) 186 184 /* Check if LEB is mapped command */ 187 - #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) 185 + #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) 188 186 /* Set an UBI volume property */ 189 187 #define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) 190 188 ··· 262 260 * sub-page of the first page and add needed padding. 263 261 */ 264 262 struct ubi_attach_req { 265 - int32_t ubi_num; 266 - int32_t mtd_num; 267 - int32_t vid_hdr_offset; 268 - int8_t padding[12]; 263 + __s32 ubi_num; 264 + __s32 mtd_num; 265 + __s32 vid_hdr_offset; 266 + __s8 padding[12]; 269 267 }; 270 268 271 269 /** ··· 300 298 * BLOBs, without caring about how to properly align them. 301 299 */ 302 300 struct ubi_mkvol_req { 303 - int32_t vol_id; 304 - int32_t alignment; 305 - int64_t bytes; 306 - int8_t vol_type; 307 - int8_t padding1; 308 - int16_t name_len; 309 - int8_t padding2[4]; 301 + __s32 vol_id; 302 + __s32 alignment; 303 + __s64 bytes; 304 + __s8 vol_type; 305 + __s8 padding1; 306 + __s16 name_len; 307 + __s8 padding2[4]; 310 308 char name[UBI_MAX_VOLUME_NAME + 1]; 311 309 } __attribute__ ((packed)); 312 310 ··· 322 320 * zero number of bytes). 323 321 */ 324 322 struct ubi_rsvol_req { 325 - int64_t bytes; 326 - int32_t vol_id; 323 + __s64 bytes; 324 + __s32 vol_id; 327 325 } __attribute__ ((packed)); 328 326 329 327 /** ··· 358 356 * re-name request. 359 357 */ 360 358 struct ubi_rnvol_req { 361 - int32_t count; 362 - int8_t padding1[12]; 359 + __s32 count; 360 + __s8 padding1[12]; 363 361 struct { 364 - int32_t vol_id; 365 - int16_t name_len; 366 - int8_t padding2[2]; 362 + __s32 vol_id; 363 + __s16 name_len; 364 + __s8 padding2[2]; 367 365 char name[UBI_MAX_VOLUME_NAME + 1]; 368 366 } ents[UBI_MAX_RNVOL]; 369 367 } __attribute__ ((packed)); ··· 377 375 * @padding: reserved for future, not used, has to be zeroed 378 376 */ 379 377 struct ubi_leb_change_req { 380 - int32_t lnum; 381 - int32_t bytes; 382 - int8_t dtype; 383 - int8_t padding[7]; 378 + __s32 lnum; 379 + __s32 bytes; 380 + __s8 dtype; 381 + __s8 padding[7]; 384 382 } __attribute__ ((packed)); 385 383 386 384 /** ··· 390 388 * @padding: reserved for future, not used, has to be zeroed 391 389 */ 392 390 struct ubi_map_req { 393 - int32_t lnum; 394 - int8_t dtype; 395 - int8_t padding[3]; 391 + __s32 lnum; 392 + __s8 dtype; 393 + __s8 padding[3]; 396 394 } __attribute__ ((packed)); 397 395 398 396 ··· 404 402 * @value: value to set 405 403 */ 406 404 struct ubi_set_prop_req { 407 - uint8_t property; 408 - uint8_t padding[7]; 409 - uint64_t value; 405 + __u8 property; 406 + __u8 padding[7]; 407 + __u64 value; 410 408 } __attribute__ ((packed)); 411 409 412 410 #endif /* __UBI_USER_H__ */