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>
This commit is contained in:
Arnd Bergmann 2009-02-26 00:51:41 +01:00 committed by Ingo Molnar
parent 9adfbfb611
commit ccef7ab534
6 changed files with 123 additions and 115 deletions

View file

@ -12,6 +12,7 @@
#ifndef __LINUX_JFFS2_H__ #ifndef __LINUX_JFFS2_H__
#define __LINUX_JFFS2_H__ #define __LINUX_JFFS2_H__
#include <linux/types.h>
#include <linux/magic.h> #include <linux/magic.h>
/* You must include something which defines the C99 uintXX_t types. /* You must include something which defines the C99 uintXX_t types.
@ -91,15 +92,15 @@
byteswapping */ byteswapping */
typedef struct { typedef struct {
uint32_t v32; __u32 v32;
} __attribute__((packed)) jint32_t; } __attribute__((packed)) jint32_t;
typedef struct { typedef struct {
uint32_t m; __u32 m;
} __attribute__((packed)) jmode_t; } __attribute__((packed)) jmode_t;
typedef struct { typedef struct {
uint16_t v16; __u16 v16;
} __attribute__((packed)) jint16_t; } __attribute__((packed)) jint16_t;
struct jffs2_unknown_node struct jffs2_unknown_node
@ -121,12 +122,12 @@ struct jffs2_raw_dirent
jint32_t version; jint32_t version;
jint32_t ino; /* == zero for unlink */ jint32_t ino; /* == zero for unlink */
jint32_t mctime; jint32_t mctime;
uint8_t nsize; __u8 nsize;
uint8_t type; __u8 type;
uint8_t unused[2]; __u8 unused[2];
jint32_t node_crc; jint32_t node_crc;
jint32_t name_crc; jint32_t name_crc;
uint8_t name[0]; __u8 name[0];
}; };
/* The JFFS2 raw inode structure: Used for storage on physical media. */ /* The JFFS2 raw inode structure: Used for storage on physical media. */
@ -153,12 +154,12 @@ struct jffs2_raw_inode
jint32_t offset; /* Where to begin to write. */ jint32_t offset; /* Where to begin to write. */
jint32_t csize; /* (Compressed) data size */ jint32_t csize; /* (Compressed) data size */
jint32_t dsize; /* Size of the node's data. (after decompression) */ jint32_t dsize; /* Size of the node's data. (after decompression) */
uint8_t compr; /* Compression algorithm used */ __u8 compr; /* Compression algorithm used */
uint8_t usercompr; /* Compression algorithm requested by the user */ __u8 usercompr; /* Compression algorithm requested by the user */
jint16_t flags; /* See JFFS2_INO_FLAG_* */ jint16_t flags; /* See JFFS2_INO_FLAG_* */
jint32_t data_crc; /* CRC for the (compressed) data. */ jint32_t data_crc; /* CRC for the (compressed) data. */
jint32_t node_crc; /* CRC for the raw inode (excluding data) */ jint32_t node_crc; /* CRC for the raw inode (excluding data) */
uint8_t data[0]; __u8 data[0];
}; };
struct jffs2_raw_xattr { struct jffs2_raw_xattr {
@ -168,12 +169,12 @@ struct jffs2_raw_xattr {
jint32_t hdr_crc; jint32_t hdr_crc;
jint32_t xid; /* XATTR identifier number */ jint32_t xid; /* XATTR identifier number */
jint32_t version; jint32_t version;
uint8_t xprefix; __u8 xprefix;
uint8_t name_len; __u8 name_len;
jint16_t value_len; jint16_t value_len;
jint32_t data_crc; jint32_t data_crc;
jint32_t node_crc; jint32_t node_crc;
uint8_t data[0]; __u8 data[0];
} __attribute__((packed)); } __attribute__((packed));
struct jffs2_raw_xref struct jffs2_raw_xref

View file

@ -16,33 +16,33 @@
/* Block Control Information */ /* Block Control Information */
struct inftl_bci { struct inftl_bci {
uint8_t ECCsig[6]; __u8 ECCsig[6];
uint8_t Status; __u8 Status;
uint8_t Status1; __u8 Status1;
} __attribute__((packed)); } __attribute__((packed));
struct inftl_unithead1 { struct inftl_unithead1 {
uint16_t virtualUnitNo; __u16 virtualUnitNo;
uint16_t prevUnitNo; __u16 prevUnitNo;
uint8_t ANAC; __u8 ANAC;
uint8_t NACs; __u8 NACs;
uint8_t parityPerField; __u8 parityPerField;
uint8_t discarded; __u8 discarded;
} __attribute__((packed)); } __attribute__((packed));
struct inftl_unithead2 { struct inftl_unithead2 {
uint8_t parityPerField; __u8 parityPerField;
uint8_t ANAC; __u8 ANAC;
uint16_t prevUnitNo; __u16 prevUnitNo;
uint16_t virtualUnitNo; __u16 virtualUnitNo;
uint8_t NACs; __u8 NACs;
uint8_t discarded; __u8 discarded;
} __attribute__((packed)); } __attribute__((packed));
struct inftl_unittail { struct inftl_unittail {
uint8_t Reserved[4]; __u8 Reserved[4];
uint16_t EraseMark; __u16 EraseMark;
uint16_t EraseMark1; __u16 EraseMark1;
} __attribute__((packed)); } __attribute__((packed));
union inftl_uci { union inftl_uci {

View file

@ -7,6 +7,7 @@
/* This file is blessed for inclusion by userspace */ /* This file is blessed for inclusion by userspace */
#include <linux/jffs2.h> #include <linux/jffs2.h>
#include <linux/types.h>
#include <endian.h> #include <endian.h>
#include <byteswap.h> #include <byteswap.h>
@ -19,8 +20,8 @@
extern int target_endian; extern int target_endian;
#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) #define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) #define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
#define cpu_to_je16(x) ((jint16_t){t16(x)}) #define cpu_to_je16(x) ((jint16_t){t16(x)})
#define cpu_to_je32(x) ((jint32_t){t32(x)}) #define cpu_to_je32(x) ((jint32_t){t32(x)})

View file

@ -5,14 +5,16 @@
#ifndef __MTD_ABI_H__ #ifndef __MTD_ABI_H__
#define __MTD_ABI_H__ #define __MTD_ABI_H__
#include <linux/types.h>
struct erase_info_user { struct erase_info_user {
uint32_t start; __u32 start;
uint32_t length; __u32 length;
}; };
struct mtd_oob_buf { struct mtd_oob_buf {
uint32_t start; __u32 start;
uint32_t length; __u32 length;
unsigned char __user *ptr; unsigned char __user *ptr;
}; };
@ -48,30 +50,30 @@ struct mtd_oob_buf {
#define MTD_OTP_USER 2 #define MTD_OTP_USER 2
struct mtd_info_user { struct mtd_info_user {
uint8_t type; __u8 type;
uint32_t flags; __u32 flags;
uint32_t size; // Total size of the MTD __u32 size; // Total size of the MTD
uint32_t erasesize; __u32 erasesize;
uint32_t writesize; __u32 writesize;
uint32_t oobsize; // Amount of OOB data per block (e.g. 16) __u32 oobsize; // Amount of OOB data per block (e.g. 16)
/* The below two fields are obsolete and broken, do not use them /* The below two fields are obsolete and broken, do not use them
* (TODO: remove at some point) */ * (TODO: remove at some point) */
uint32_t ecctype; __u32 ecctype;
uint32_t eccsize; __u32 eccsize;
}; };
struct region_info_user { struct region_info_user {
uint32_t offset; /* At which this region starts, __u32 offset; /* At which this region starts,
* from the beginning of the MTD */ * from the beginning of the MTD */
uint32_t erasesize; /* For this region */ __u32 erasesize; /* For this region */
uint32_t numblocks; /* Number of blocks in this region */ __u32 numblocks; /* Number of blocks in this region */
uint32_t regionindex; __u32 regionindex;
}; };
struct otp_info { struct otp_info {
uint32_t start; __u32 start;
uint32_t length; __u32 length;
uint32_t locked; __u32 locked;
}; };
#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) #define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
@ -99,15 +101,15 @@ struct otp_info {
* interfaces * interfaces
*/ */
struct nand_oobinfo { struct nand_oobinfo {
uint32_t useecc; __u32 useecc;
uint32_t eccbytes; __u32 eccbytes;
uint32_t oobfree[8][2]; __u32 oobfree[8][2];
uint32_t eccpos[32]; __u32 eccpos[32];
}; };
struct nand_oobfree { struct nand_oobfree {
uint32_t offset; __u32 offset;
uint32_t length; __u32 length;
}; };
#define MTD_MAX_OOBFREE_ENTRIES 8 #define MTD_MAX_OOBFREE_ENTRIES 8
@ -116,9 +118,9 @@ struct nand_oobfree {
* diagnosis and to allow creation of raw images * diagnosis and to allow creation of raw images
*/ */
struct nand_ecclayout { struct nand_ecclayout {
uint32_t eccbytes; __u32 eccbytes;
uint32_t eccpos[64]; __u32 eccpos[64];
uint32_t oobavail; __u32 oobavail;
struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
}; };
@ -131,10 +133,10 @@ struct nand_ecclayout {
* @bbtblocks: number of blocks reserved for bad block tables * @bbtblocks: number of blocks reserved for bad block tables
*/ */
struct mtd_ecc_stats { struct mtd_ecc_stats {
uint32_t corrected; __u32 corrected;
uint32_t failed; __u32 failed;
uint32_t badblocks; __u32 badblocks;
uint32_t bbtblocks; __u32 bbtblocks;
}; };
/* /*

View file

@ -6,33 +6,35 @@
#ifndef __MTD_NFTL_USER_H__ #ifndef __MTD_NFTL_USER_H__
#define __MTD_NFTL_USER_H__ #define __MTD_NFTL_USER_H__
#include <linux/types.h>
/* Block Control Information */ /* Block Control Information */
struct nftl_bci { struct nftl_bci {
unsigned char ECCSig[6]; unsigned char ECCSig[6];
uint8_t Status; __u8 Status;
uint8_t Status1; __u8 Status1;
}__attribute__((packed)); }__attribute__((packed));
/* Unit Control Information */ /* Unit Control Information */
struct nftl_uci0 { struct nftl_uci0 {
uint16_t VirtUnitNum; __u16 VirtUnitNum;
uint16_t ReplUnitNum; __u16 ReplUnitNum;
uint16_t SpareVirtUnitNum; __u16 SpareVirtUnitNum;
uint16_t SpareReplUnitNum; __u16 SpareReplUnitNum;
} __attribute__((packed)); } __attribute__((packed));
struct nftl_uci1 { struct nftl_uci1 {
uint32_t WearInfo; __u32 WearInfo;
uint16_t EraseMark; __u16 EraseMark;
uint16_t EraseMark1; __u16 EraseMark1;
} __attribute__((packed)); } __attribute__((packed));
struct nftl_uci2 { struct nftl_uci2 {
uint16_t FoldMark; __u16 FoldMark;
uint16_t FoldMark1; __u16 FoldMark1;
uint32_t unused; __u32 unused;
} __attribute__((packed)); } __attribute__((packed));
union nftl_uci { union nftl_uci {
@ -50,9 +52,9 @@ struct nftl_oob {
struct NFTLMediaHeader { struct NFTLMediaHeader {
char DataOrgID[6]; char DataOrgID[6];
uint16_t NumEraseUnits; __u16 NumEraseUnits;
uint16_t FirstPhysicalEUN; __u16 FirstPhysicalEUN;
uint32_t FormattedSize; __u32 FormattedSize;
unsigned char UnitSizeFactor; unsigned char UnitSizeFactor;
} __attribute__((packed)); } __attribute__((packed));

View file

@ -21,6 +21,8 @@
#ifndef __UBI_USER_H__ #ifndef __UBI_USER_H__
#define __UBI_USER_H__ #define __UBI_USER_H__
#include <linux/types.h>
/* /*
* UBI device creation (the same as MTD device attachment) * UBI device creation (the same as MTD device attachment)
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -152,7 +154,7 @@
/* Create an UBI volume */ /* Create an UBI volume */
#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) #define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
/* Remove an UBI volume */ /* Remove an UBI volume */
#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t) #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
/* Re-size an UBI volume */ /* Re-size an UBI volume */
#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
/* Re-name volumes */ /* Re-name volumes */
@ -165,24 +167,24 @@
/* Attach an MTD device */ /* Attach an MTD device */
#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) #define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
/* Detach an MTD device */ /* Detach an MTD device */
#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t) #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
/* ioctl commands of UBI volume character devices */ /* ioctl commands of UBI volume character devices */
#define UBI_VOL_IOC_MAGIC 'O' #define UBI_VOL_IOC_MAGIC 'O'
/* Start UBI volume update */ /* Start UBI volume update */
#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t) #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
/* LEB erasure command, used for debugging, disabled by default */ /* LEB erasure command, used for debugging, disabled by default */
#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t) #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
/* Atomic LEB change command */ /* Atomic LEB change command */
#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t) #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
/* Map LEB command */ /* Map LEB command */
#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) #define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
/* Unmap LEB command */ /* Unmap LEB command */
#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
/* Check if LEB is mapped command */ /* Check if LEB is mapped command */
#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
/* Set an UBI volume property */ /* Set an UBI volume property */
#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) #define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
@ -260,10 +262,10 @@ enum {
* sub-page of the first page and add needed padding. * sub-page of the first page and add needed padding.
*/ */
struct ubi_attach_req { struct ubi_attach_req {
int32_t ubi_num; __s32 ubi_num;
int32_t mtd_num; __s32 mtd_num;
int32_t vid_hdr_offset; __s32 vid_hdr_offset;
int8_t padding[12]; __s8 padding[12];
}; };
/** /**
@ -298,13 +300,13 @@ struct ubi_attach_req {
* BLOBs, without caring about how to properly align them. * BLOBs, without caring about how to properly align them.
*/ */
struct ubi_mkvol_req { struct ubi_mkvol_req {
int32_t vol_id; __s32 vol_id;
int32_t alignment; __s32 alignment;
int64_t bytes; __s64 bytes;
int8_t vol_type; __s8 vol_type;
int8_t padding1; __s8 padding1;
int16_t name_len; __s16 name_len;
int8_t padding2[4]; __s8 padding2[4];
char name[UBI_MAX_VOLUME_NAME + 1]; char name[UBI_MAX_VOLUME_NAME + 1];
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -320,8 +322,8 @@ struct ubi_mkvol_req {
* zero number of bytes). * zero number of bytes).
*/ */
struct ubi_rsvol_req { struct ubi_rsvol_req {
int64_t bytes; __s64 bytes;
int32_t vol_id; __s32 vol_id;
} __attribute__ ((packed)); } __attribute__ ((packed));
/** /**
@ -356,12 +358,12 @@ struct ubi_rsvol_req {
* re-name request. * re-name request.
*/ */
struct ubi_rnvol_req { struct ubi_rnvol_req {
int32_t count; __s32 count;
int8_t padding1[12]; __s8 padding1[12];
struct { struct {
int32_t vol_id; __s32 vol_id;
int16_t name_len; __s16 name_len;
int8_t padding2[2]; __s8 padding2[2];
char name[UBI_MAX_VOLUME_NAME + 1]; char name[UBI_MAX_VOLUME_NAME + 1];
} ents[UBI_MAX_RNVOL]; } ents[UBI_MAX_RNVOL];
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -375,10 +377,10 @@ struct ubi_rnvol_req {
* @padding: reserved for future, not used, has to be zeroed * @padding: reserved for future, not used, has to be zeroed
*/ */
struct ubi_leb_change_req { struct ubi_leb_change_req {
int32_t lnum; __s32 lnum;
int32_t bytes; __s32 bytes;
int8_t dtype; __s8 dtype;
int8_t padding[7]; __s8 padding[7];
} __attribute__ ((packed)); } __attribute__ ((packed));
/** /**
@ -388,9 +390,9 @@ struct ubi_leb_change_req {
* @padding: reserved for future, not used, has to be zeroed * @padding: reserved for future, not used, has to be zeroed
*/ */
struct ubi_map_req { struct ubi_map_req {
int32_t lnum; __s32 lnum;
int8_t dtype; __s8 dtype;
int8_t padding[3]; __s8 padding[3];
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -402,9 +404,9 @@ struct ubi_map_req {
* @value: value to set * @value: value to set
*/ */
struct ubi_set_prop_req { struct ubi_set_prop_req {
uint8_t property; __u8 property;
uint8_t padding[7]; __u8 padding[7];
uint64_t value; __u64 value;
} __attribute__ ((packed)); } __attribute__ ((packed));
#endif /* __UBI_USER_H__ */ #endif /* __UBI_USER_H__ */