Commit 3854be77 authored by David Woodhouse's avatar David Woodhouse

[MTD] Remove strange u_int32_t types from FTL

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 0f07a0be
...@@ -109,25 +109,25 @@ module_param(shuffle_freq, int, 0); ...@@ -109,25 +109,25 @@ module_param(shuffle_freq, int, 0);
/* Each memory region corresponds to a minor device */ /* Each memory region corresponds to a minor device */
typedef struct partition_t { typedef struct partition_t {
struct mtd_blktrans_dev mbd; struct mtd_blktrans_dev mbd;
u_int32_t state; uint32_t state;
u_int32_t *VirtualBlockMap; uint32_t *VirtualBlockMap;
u_int32_t *VirtualPageMap; uint32_t *VirtualPageMap;
u_int32_t FreeTotal; uint32_t FreeTotal;
struct eun_info_t { struct eun_info_t {
u_int32_t Offset; uint32_t Offset;
u_int32_t EraseCount; uint32_t EraseCount;
u_int32_t Free; uint32_t Free;
u_int32_t Deleted; uint32_t Deleted;
} *EUNInfo; } *EUNInfo;
struct xfer_info_t { struct xfer_info_t {
u_int32_t Offset; uint32_t Offset;
u_int32_t EraseCount; uint32_t EraseCount;
u_int16_t state; uint16_t state;
} *XferInfo; } *XferInfo;
u_int16_t bam_index; uint16_t bam_index;
u_int32_t *bam_cache; uint32_t *bam_cache;
u_int16_t DataUnits; uint16_t DataUnits;
u_int32_t BlocksPerUnit; uint32_t BlocksPerUnit;
erase_unit_header_t header; erase_unit_header_t header;
} partition_t; } partition_t;
...@@ -199,8 +199,8 @@ static int scan_header(partition_t *part) ...@@ -199,8 +199,8 @@ static int scan_header(partition_t *part)
static int build_maps(partition_t *part) static int build_maps(partition_t *part)
{ {
erase_unit_header_t header; erase_unit_header_t header;
u_int16_t xvalid, xtrans, i; uint16_t xvalid, xtrans, i;
u_int blocks, j; unsigned blocks, j;
int hdr_ok, ret = -1; int hdr_ok, ret = -1;
ssize_t retval; ssize_t retval;
loff_t offset; loff_t offset;
...@@ -269,14 +269,14 @@ static int build_maps(partition_t *part) ...@@ -269,14 +269,14 @@ static int build_maps(partition_t *part)
/* Set up virtual page map */ /* Set up virtual page map */
blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize; blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize;
part->VirtualBlockMap = vmalloc(blocks * sizeof(u_int32_t)); part->VirtualBlockMap = vmalloc(blocks * sizeof(uint32_t));
if (!part->VirtualBlockMap) if (!part->VirtualBlockMap)
goto out_XferInfo; goto out_XferInfo;
memset(part->VirtualBlockMap, 0xff, blocks * sizeof(u_int32_t)); memset(part->VirtualBlockMap, 0xff, blocks * sizeof(uint32_t));
part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize; part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize;
part->bam_cache = kmalloc(part->BlocksPerUnit * sizeof(u_int32_t), part->bam_cache = kmalloc(part->BlocksPerUnit * sizeof(uint32_t),
GFP_KERNEL); GFP_KERNEL);
if (!part->bam_cache) if (!part->bam_cache)
goto out_VirtualBlockMap; goto out_VirtualBlockMap;
...@@ -290,7 +290,7 @@ static int build_maps(partition_t *part) ...@@ -290,7 +290,7 @@ static int build_maps(partition_t *part)
offset = part->EUNInfo[i].Offset + le32_to_cpu(header.BAMOffset); offset = part->EUNInfo[i].Offset + le32_to_cpu(header.BAMOffset);
ret = part->mbd.mtd->read(part->mbd.mtd, offset, ret = part->mbd.mtd->read(part->mbd.mtd, offset,
part->BlocksPerUnit * sizeof(u_int32_t), &retval, part->BlocksPerUnit * sizeof(uint32_t), &retval,
(unsigned char *)part->bam_cache); (unsigned char *)part->bam_cache);
if (ret) if (ret)
...@@ -332,7 +332,7 @@ static int build_maps(partition_t *part) ...@@ -332,7 +332,7 @@ static int build_maps(partition_t *part)
======================================================================*/ ======================================================================*/
static int erase_xfer(partition_t *part, static int erase_xfer(partition_t *part,
u_int16_t xfernum) uint16_t xfernum)
{ {
int ret; int ret;
struct xfer_info_t *xfer; struct xfer_info_t *xfer;
...@@ -408,7 +408,7 @@ static int prepare_xfer(partition_t *part, int i) ...@@ -408,7 +408,7 @@ static int prepare_xfer(partition_t *part, int i)
erase_unit_header_t header; erase_unit_header_t header;
struct xfer_info_t *xfer; struct xfer_info_t *xfer;
int nbam, ret; int nbam, ret;
u_int32_t ctl; uint32_t ctl;
ssize_t retlen; ssize_t retlen;
loff_t offset; loff_t offset;
...@@ -430,15 +430,15 @@ static int prepare_xfer(partition_t *part, int i) ...@@ -430,15 +430,15 @@ static int prepare_xfer(partition_t *part, int i)
} }
/* Write the BAM stub */ /* Write the BAM stub */
nbam = (part->BlocksPerUnit * sizeof(u_int32_t) + nbam = (part->BlocksPerUnit * sizeof(uint32_t) +
le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE; le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE;
offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset); offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
ctl = cpu_to_le32(BLOCK_CONTROL); ctl = cpu_to_le32(BLOCK_CONTROL);
for (i = 0; i < nbam; i++, offset += sizeof(u_int32_t)) { for (i = 0; i < nbam; i++, offset += sizeof(uint32_t)) {
ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int32_t), ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t),
&retlen, (u_char *)&ctl); &retlen, (u_char *)&ctl);
if (ret) if (ret)
...@@ -461,18 +461,18 @@ static int prepare_xfer(partition_t *part, int i) ...@@ -461,18 +461,18 @@ static int prepare_xfer(partition_t *part, int i)
======================================================================*/ ======================================================================*/
static int copy_erase_unit(partition_t *part, u_int16_t srcunit, static int copy_erase_unit(partition_t *part, uint16_t srcunit,
u_int16_t xferunit) uint16_t xferunit)
{ {
u_char buf[SECTOR_SIZE]; u_char buf[SECTOR_SIZE];
struct eun_info_t *eun; struct eun_info_t *eun;
struct xfer_info_t *xfer; struct xfer_info_t *xfer;
u_int32_t src, dest, free, i; uint32_t src, dest, free, i;
u_int16_t unit; uint16_t unit;
int ret; int ret;
ssize_t retlen; ssize_t retlen;
loff_t offset; loff_t offset;
u_int16_t srcunitswap = cpu_to_le16(srcunit); uint16_t srcunitswap = cpu_to_le16(srcunit);
eun = &part->EUNInfo[srcunit]; eun = &part->EUNInfo[srcunit];
xfer = &part->XferInfo[xferunit]; xfer = &part->XferInfo[xferunit];
...@@ -486,7 +486,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, ...@@ -486,7 +486,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
offset = eun->Offset + le32_to_cpu(part->header.BAMOffset); offset = eun->Offset + le32_to_cpu(part->header.BAMOffset);
ret = part->mbd.mtd->read(part->mbd.mtd, offset, ret = part->mbd.mtd->read(part->mbd.mtd, offset,
part->BlocksPerUnit * sizeof(u_int32_t), part->BlocksPerUnit * sizeof(uint32_t),
&retlen, (u_char *) (part->bam_cache)); &retlen, (u_char *) (part->bam_cache));
/* mark the cache bad, in case we get an error later */ /* mark the cache bad, in case we get an error later */
...@@ -503,7 +503,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, ...@@ -503,7 +503,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
offset = xfer->Offset + 20; /* Bad! */ offset = xfer->Offset + 20; /* Bad! */
unit = cpu_to_le16(0x7fff); unit = cpu_to_le16(0x7fff);
ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int16_t), ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint16_t),
&retlen, (u_char *) &unit); &retlen, (u_char *) &unit);
if (ret) { if (ret) {
...@@ -560,7 +560,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, ...@@ -560,7 +560,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
/* All clear? Then update the LogicalEUN again */ /* All clear? Then update the LogicalEUN again */
ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(u_int16_t), ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(uint16_t),
&retlen, (u_char *)&srcunitswap); &retlen, (u_char *)&srcunitswap);
if (ret) { if (ret) {
...@@ -605,8 +605,8 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, ...@@ -605,8 +605,8 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit,
static int reclaim_block(partition_t *part) static int reclaim_block(partition_t *part)
{ {
u_int16_t i, eun, xfer; uint16_t i, eun, xfer;
u_int32_t best; uint32_t best;
int queued, ret; int queued, ret;
DEBUG(0, "ftl_cs: reclaiming space...\n"); DEBUG(0, "ftl_cs: reclaiming space...\n");
...@@ -723,10 +723,10 @@ static void dump_lists(partition_t *part) ...@@ -723,10 +723,10 @@ static void dump_lists(partition_t *part)
} }
#endif #endif
static u_int32_t find_free(partition_t *part) static uint32_t find_free(partition_t *part)
{ {
u_int16_t stop, eun; uint16_t stop, eun;
u_int32_t blk; uint32_t blk;
size_t retlen; size_t retlen;
int ret; int ret;
...@@ -749,7 +749,7 @@ static u_int32_t find_free(partition_t *part) ...@@ -749,7 +749,7 @@ static u_int32_t find_free(partition_t *part)
ret = part->mbd.mtd->read(part->mbd.mtd, ret = part->mbd.mtd->read(part->mbd.mtd,
part->EUNInfo[eun].Offset + le32_to_cpu(part->header.BAMOffset), part->EUNInfo[eun].Offset + le32_to_cpu(part->header.BAMOffset),
part->BlocksPerUnit * sizeof(u_int32_t), part->BlocksPerUnit * sizeof(uint32_t),
&retlen, (u_char *) (part->bam_cache)); &retlen, (u_char *) (part->bam_cache));
if (ret) { if (ret) {
...@@ -786,7 +786,7 @@ static u_int32_t find_free(partition_t *part) ...@@ -786,7 +786,7 @@ static u_int32_t find_free(partition_t *part)
static int ftl_read(partition_t *part, caddr_t buffer, static int ftl_read(partition_t *part, caddr_t buffer,
u_long sector, u_long nblocks) u_long sector, u_long nblocks)
{ {
u_int32_t log_addr, bsize; uint32_t log_addr, bsize;
u_long i; u_long i;
int ret; int ret;
size_t offset, retlen; size_t offset, retlen;
...@@ -829,14 +829,14 @@ static int ftl_read(partition_t *part, caddr_t buffer, ...@@ -829,14 +829,14 @@ static int ftl_read(partition_t *part, caddr_t buffer,
======================================================================*/ ======================================================================*/
static int set_bam_entry(partition_t *part, u_int32_t log_addr, static int set_bam_entry(partition_t *part, uint32_t log_addr,
u_int32_t virt_addr) uint32_t virt_addr)
{ {
u_int32_t bsize, blk, le_virt_addr; uint32_t bsize, blk, le_virt_addr;
#ifdef PSYCHO_DEBUG #ifdef PSYCHO_DEBUG
u_int32_t old_addr; uint32_t old_addr;
#endif #endif
u_int16_t eun; uint16_t eun;
int ret; int ret;
size_t retlen, offset; size_t retlen, offset;
...@@ -845,11 +845,11 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, ...@@ -845,11 +845,11 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
bsize = 1 << part->header.EraseUnitSize; bsize = 1 << part->header.EraseUnitSize;
eun = log_addr / bsize; eun = log_addr / bsize;
blk = (log_addr % bsize) / SECTOR_SIZE; blk = (log_addr % bsize) / SECTOR_SIZE;
offset = (part->EUNInfo[eun].Offset + blk * sizeof(u_int32_t) + offset = (part->EUNInfo[eun].Offset + blk * sizeof(uint32_t) +
le32_to_cpu(part->header.BAMOffset)); le32_to_cpu(part->header.BAMOffset));
#ifdef PSYCHO_DEBUG #ifdef PSYCHO_DEBUG
ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(u_int32_t), ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(uint32_t),
&retlen, (u_char *)&old_addr); &retlen, (u_char *)&old_addr);
if (ret) { if (ret) {
printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret); printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret);
...@@ -886,7 +886,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, ...@@ -886,7 +886,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
#endif #endif
part->bam_cache[blk] = le_virt_addr; part->bam_cache[blk] = le_virt_addr;
} }
ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int32_t), ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t),
&retlen, (u_char *)&le_virt_addr); &retlen, (u_char *)&le_virt_addr);
if (ret) { if (ret) {
...@@ -900,7 +900,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, ...@@ -900,7 +900,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr,
static int ftl_write(partition_t *part, caddr_t buffer, static int ftl_write(partition_t *part, caddr_t buffer,
u_long sector, u_long nblocks) u_long sector, u_long nblocks)
{ {
u_int32_t bsize, log_addr, virt_addr, old_addr, blk; uint32_t bsize, log_addr, virt_addr, old_addr, blk;
u_long i; u_long i;
int ret; int ret;
size_t retlen, offset; size_t retlen, offset;
......
...@@ -32,25 +32,25 @@ ...@@ -32,25 +32,25 @@
#define _LINUX_FTL_H #define _LINUX_FTL_H
typedef struct erase_unit_header_t { typedef struct erase_unit_header_t {
u_int8_t LinkTargetTuple[5]; uint8_t LinkTargetTuple[5];
u_int8_t DataOrgTuple[10]; uint8_t DataOrgTuple[10];
u_int8_t NumTransferUnits; uint8_t NumTransferUnits;
u_int32_t EraseCount; uint32_t EraseCount;
u_int16_t LogicalEUN; uint16_t LogicalEUN;
u_int8_t BlockSize; uint8_t BlockSize;
u_int8_t EraseUnitSize; uint8_t EraseUnitSize;
u_int16_t FirstPhysicalEUN; uint16_t FirstPhysicalEUN;
u_int16_t NumEraseUnits; uint16_t NumEraseUnits;
u_int32_t FormattedSize; uint32_t FormattedSize;
u_int32_t FirstVMAddress; uint32_t FirstVMAddress;
u_int16_t NumVMPages; uint16_t NumVMPages;
u_int8_t Flags; uint8_t Flags;
u_int8_t Code; uint8_t Code;
u_int32_t SerialNumber; uint32_t SerialNumber;
u_int32_t AltEUHOffset; uint32_t AltEUHOffset;
u_int32_t BAMOffset; uint32_t BAMOffset;
u_int8_t Reserved[12]; uint8_t Reserved[12];
u_int8_t EndTuple[2]; uint8_t EndTuple[2];
} erase_unit_header_t; } erase_unit_header_t;
/* Flags in erase_unit_header_t */ /* Flags in erase_unit_header_t */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment