Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccef7ab5 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Ingo Molnar
Browse files

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9adfbfb6
Loading
Loading
Loading
Loading
+14 −13
Original line number Original line Diff line number Diff line
@@ -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
+18 −18
Original line number Original line Diff line number Diff line
@@ -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 {
+3 −2
Original line number Original line Diff line number Diff line
@@ -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)})
+34 −32
Original line number Original line Diff line number Diff line
@@ -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;
};
};


/*
/*
+17 −15
Original line number Original line Diff line number Diff line
@@ -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));


Loading