__u32 -> u32 and such.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
#if !(defined __KERNEL__)
/* Definition of types */
-typedef unsigned char __u8;
-typedef unsigned short __u16;
-typedef unsigned __u32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned u32;
#endif
n = yaffs_getxattr(path,name,buffer,sizeof(buffer));
if(n >= 0){
- __u8 *b = (__u8 *)buffer;
+ u8 *b = (u8 *)buffer;
printf("%d bytes:",n);
if(n > 10)
typedef struct
{
- __u8 data[528]; // Data + spare
+ u8 data[528]; // Data + spare
} yflash_Page;
typedef struct
return 1;
}
-int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare)
+int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare)
{
int written;
}
-int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare)
+int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare)
{
int nread;
typedef struct
{
- __u8 data[PAGE_SIZE]; // Data + spare
+ u8 data[PAGE_SIZE]; // Data + spare
} yflash_Page;
typedef struct
-static __u8 localBuffer[PAGE_SIZE];
+static u8 localBuffer[PAGE_SIZE];
static char *NToName(char *buf,int n)
{
return filedisk.nBlocks;
}
-int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
+int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags)
{
int written;
int pos;
{
yaffs_packed_tags2 pt;
yaffs_pack_tags2(&pt,tags, !dev->param.no_tags_ecc);
- __u8 * ptab = (__u8 *)&pt;
+ u8 * ptab = (u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
{
yaffs_packed_tags2 pt;
yaffs_pack_tags2(&pt,tags,!dev->param.no_tags_ecc);
- __u8 * ptab = (__u8 *)&pt;
+ u8 * ptab = (u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
for(i = error = 0; REPORT_ERROR && i < sizeof(pt) && !error; i++){
}
-int yaffs_check_all_ff(const __u8 *ptr, int n)
+int yaffs_check_all_ff(const u8 *ptr, int n)
{
while(n)
{
static int failRead10 = 2;
-int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
+int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags)
{
int nread;
int pos;
nread= read(h,tags,sizeof(yaffs_ext_tags));
if(nread != sizeof(yaffs_ext_tags))
retval = YAFFS_FAIL;
- if(yaffs_check_all_ff((__u8 *)tags,sizeof(yaffs_ext_tags)))
+ if(yaffs_check_all_ff((u8 *)tags,sizeof(yaffs_ext_tags)))
{
yaffs_init_tags(tags);
}
else
{
- __u8 pg[PAGE_SIZE];
+ u8 pg[PAGE_SIZE];
int syz = PAGE_SIZE;
int pos;
-int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number)
+int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number)
{
yaffs_ext_tags tags;
int chunkNo;
#define DEVICE_BASE (32 * 1024 * 1024)
#endif
-__u32 *Block2Addr(yaffs_dev_t *dev, int blockNumber)
+u32 *Block2Addr(yaffs_dev_t *dev, int blockNumber)
{
- __u32 addr;
+ u32 addr;
dev=dev;
- addr = (__u32) DEVICE_BASE;
+ addr = (u32) DEVICE_BASE;
addr += blockNumber * BLOCK_SIZE_IN_BYTES;
- return (__u32 *) addr;
+ return (u32 *) addr;
}
-__u32 *Block2FormatAddr(yaffs_dev_t *dev,int blockNumber)
+u32 *Block2FormatAddr(yaffs_dev_t *dev,int blockNumber)
{
- __u32 addr;
+ u32 addr;
- addr = (__u32) Block2Addr(dev,blockNumber);
+ addr = (u32) Block2Addr(dev,blockNumber);
addr += FORMAT_OFFSET;
- return (__u32 *)addr;
+ return (u32 *)addr;
}
-__u32 *Chunk2DataAddr(yaffs_dev_t *dev,int chunk_id)
+u32 *Chunk2DataAddr(yaffs_dev_t *dev,int chunk_id)
{
unsigned block;
unsigned chunkInBlock;
- __u32 addr;
+ u32 addr;
block = chunk_id/dev->param.chunks_per_block;
chunkInBlock = chunk_id % dev->param.chunks_per_block;
- addr = (__u32) Block2Addr(dev,block);
+ addr = (u32) Block2Addr(dev,block);
addr += chunkInBlock * DATA_BYTES_PER_CHUNK;
- return (__u32 *)addr;
+ return (u32 *)addr;
}
-__u32 *Chunk2SpareAddr(yaffs_dev_t *dev,int chunk_id)
+u32 *Chunk2SpareAddr(yaffs_dev_t *dev,int chunk_id)
{
unsigned block;
unsigned chunkInBlock;
- __u32 addr;
+ u32 addr;
block = chunk_id/dev->param.chunks_per_block;
chunkInBlock = chunk_id % dev->param.chunks_per_block;
- addr = (__u32) Block2Addr(dev,block);
+ addr = (u32) Block2Addr(dev,block);
addr += SPARE_AREA_OFFSET;
addr += chunkInBlock * (SPARE_BYTES_PER_CHUNK + M18_SKIP);
- return (__u32 *)addr;
+ return (u32 *)addr;
}
-void ynorif1_AndBytes(__u8*target, const __u8 *src, int nbytes)
+void ynorif1_AndBytes(u8*target, const u8 *src, int nbytes)
{
while(nbytes > 0){
*target &= *src;
}
}
-int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare)
+int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare)
{
- __u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
- __u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
+ u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
+ u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
yaffs_spare tmpSpare;
/* Write a pre-marker */
memset(&tmpSpare,0xff,sizeof(tmpSpare));
tmpSpare.page_status = YNOR_PREMARKER;
- ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
+ ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
/* Write the data */
- ynorif1_FlashWrite32(dataAddr,(__u32 *)data,dev->param.total_bytes_per_chunk / 4);
+ ynorif1_FlashWrite32(dataAddr,(u32 *)data,dev->param.total_bytes_per_chunk / 4);
memcpy(&tmpSpare,spare,sizeof(yaffs_spare));
/* Write the real tags, but override the premarker*/
tmpSpare.page_status = YNOR_PREMARKER;
- ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
+ ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4);
/* Write a post-marker */
tmpSpare.page_status = YNOR_POSTMARKER;
- ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,sizeof(tmpSpare)/4);
+ ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(tmpSpare)/4);
} else if(spare){
/* This has to be a read-modify-write operation to handle NOR-ness */
- ynorif1_FlashRead32(spareAddr,(__u32 *)&tmpSpare,16/ 4);
+ ynorif1_FlashRead32(spareAddr,(u32 *)&tmpSpare,16/ 4);
- ynorif1_AndBytes((__u8 *)&tmpSpare,(__u8 *)spare,sizeof(yaffs_spare));
+ ynorif1_AndBytes((u8 *)&tmpSpare,(u8 *)spare,sizeof(yaffs_spare));
- ynorif1_FlashWrite32(spareAddr,(__u32 *)&tmpSpare,16/ 4);
+ ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,16/ 4);
}
else {
YBUG();
}
-int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare)
+int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare)
{
- __u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
- __u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
+ u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk);
+ u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk);
if(data)
{
- ynorif1_FlashRead32(dataAddr,(__u32 *)data,dev->param.total_bytes_per_chunk / 4);
+ ynorif1_FlashRead32(dataAddr,(u32 *)data,dev->param.total_bytes_per_chunk / 4);
}
if(spare)
{
- ynorif1_FlashRead32(spareAddr,(__u32 *)spare,16/ 4);
+ ynorif1_FlashRead32(spareAddr,(u32 *)spare,16/ 4);
/* If the page status is YNOR_POSTMARKER then it was written properly
* so change that to 0xFF so that the rest of yaffs is happy.
static int ynorif1_FormatBlock(yaffs_dev_t *dev, int blockNumber)
{
- __u32 *blockAddr = Block2Addr(dev,blockNumber);
- __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
- __u32 formatValue = FORMAT_VALUE;
+ u32 *blockAddr = Block2Addr(dev,blockNumber);
+ u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
+ u32 formatValue = FORMAT_VALUE;
ynorif1_FlashEraseBlock(blockAddr);
ynorif1_FlashWrite32(formatAddr,&formatValue,1);
static int ynorif1_UnformatBlock(yaffs_dev_t *dev, int blockNumber)
{
- __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
- __u32 formatValue = 0;
+ u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
+ u32 formatValue = 0;
ynorif1_FlashWrite32(formatAddr,&formatValue,1);
static int ynorif1_IsBlockFormatted(yaffs_dev_t *dev, int blockNumber)
{
- __u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
- __u32 formatValue;
+ u32 *formatAddr = Block2FormatAddr(dev,blockNumber);
+ u32 formatValue;
ynorif1_FlashRead32(formatAddr,&formatValue,1);
#include "yaffs_guts.h"
-int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
-int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
+int ynorif1_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare);
+int ynorif1_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare);
int ynorif1_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
int ynorif1_InitialiseNAND(yaffs_dev_t *dev);
int ynorif1_Deinitialise_flash_fn(yaffs_dev_t *dev);
typedef struct
{
- __u8 data[528]; // Data + spare
+ u8 data[528]; // Data + spare
} yramdisk_page;
typedef struct
return 1;
}
-int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
+int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags)
{
int blk;
int pg;
}
-int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
+int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags)
{
int blk;
int pg;
#include "yaffs_guts.h"
int yramdisk_erase(yaffs_dev_t *dev, int blockNumber);
-int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
-int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags);
+int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags);
int yramdisk_initialise(yaffs_dev_t *dev);
int yramdisk_mark_block_bad(yaffs_dev_t *dev,int blockNumber);
int yramdisk_query_block(yaffs_dev_t *dev, int block_no, yaffs_block_state_t *state, int *seq_number);
typedef struct
{
- __u8 data[PAGE_TOTAL_SIZE]; // Data + spare
+ u8 data[PAGE_TOTAL_SIZE]; // Data + spare
int empty; // is this empty?
} nandemul_Page;
return 1;
}
-int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags)
+int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags)
{
int blk;
int pg;
int i;
- __u8 *x;
+ u8 *x;
blk = nand_chunk/PAGES_PER_BLOCK;
}
-int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags)
+int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags)
{
int blk;
int pg;
- __u8 *x;
+ u8 *x;
int nandemul2k_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
{
- __u8 *x;
+ u8 *x;
x = &ned.block[block_no]->page[0]->data[PAGE_DATA_SIZE];
}
-int nandemul2k_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number)
+int nandemul2k_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number)
{
yaffs_ext_tags tags;
int chunkNo;
{
}
-__u32 yaffsfs_CurrentTime(void)
+u32 yaffsfs_CurrentTime(void)
{
return 0;
}
{
}
-__u32 yaffsfs_CurrentTime(void)
+u32 yaffsfs_CurrentTime(void)
{
return 0;
}
{
}
-__u32 yaffsfs_CurrentTime(void)
+u32 yaffsfs_CurrentTime(void)
{
return 0;
}
#define YNORSIM_DEV_SIZE_U32 (8*1024 * 1024/4)
#endif
-static __u32 word[YNORSIM_DEV_SIZE_U32];
+static u32 word[YNORSIM_DEV_SIZE_U32];
extern int random_seed;
extern int simulate_power_failure;
ynorsim_restore_image();
}
-void ynorsim_rd32(__u32 *addr,__u32 *buf, int nwords)
+void ynorsim_rd32(u32 *addr,u32 *buf, int nwords)
{
while(nwords > 0){
*buf = *addr;
}
}
-void ynorsim_wr_one_word32(__u32 *addr,__u32 val)
+void ynorsim_wr_one_word32(u32 *addr,u32 val)
{
- __u32 tmp;
- __u32 m;
+ u32 tmp;
+ u32 m;
int i;
tmp = *addr;
ynorsim_maybe_power_fail();
}
-void ynorsim_wr32(__u32 *addr, __u32 *buf, int nwords)
+void ynorsim_wr32(u32 *addr, u32 *buf, int nwords)
{
while(nwords >0){
ynorsim_wr_one_word32(addr,*buf);
}
}
-void ynorsim_erase(__u32 *addr)
+void ynorsim_erase(u32 *addr)
{
/* Todo... bit flipping */
memset(addr,0xFF,YNORSIM_BLOCK_SIZE_U32 * 4);
initialised=0;
}
-__u32 *ynorsim_get_base(void)
+u32 *ynorsim_get_base(void)
{
return word;
}
#include "yaffs_guts.h"
-void ynorsim_rd32(__u32 *addr, __u32 *data, int nwords);
-void ynorsim_wr32(__u32 *addr, __u32 *data, int nwords);
-void ynorsim_erase(__u32 *addr);
+void ynorsim_rd32(u32 *addr, u32 *data, int nwords);
+void ynorsim_wr32(u32 *addr, u32 *data, int nwords);
+void ynorsim_erase(u32 *addr);
void ynorsim_shutdown(void);
void ynorsim_initialise(void);
-__u32 * ynorsim_get_base(void);
+u32 * ynorsim_get_base(void);
#endif
}
-static SimData *yramsim_alloc_sim_data(__u32 devId, __u32 nBlocks)
+static SimData *yramsim_alloc_sim_data(u32 devId, u32 nBlocks)
{
int ok = 1;
Block **blockList;
SimData *sim;
Block *b;
- __u32 i;
+ u32 i;
if(devId >= N_RAM_SIM_DEVS)
return NULL;
struct yaffs_dev_s *yramsim_CreateRamSim(const YCHAR *name,
- __u32 devId, __u32 nBlocks,
- __u32 start_block, __u32 end_block)
+ u32 devId, u32 nBlocks,
+ u32 start_block, u32 end_block)
{
SimData *sim;
ynandif_Geometry *g;
#define N_RAM_SIM_DEVS 2
struct yaffs_dev_s *yramsim_CreateRamSim(const YCHAR *name,
- __u32 devId, __u32 nBlocks,
- __u32 start_block, __u32 end_block);
+ u32 devId, u32 nBlocks,
+ u32 start_block, u32 end_block);
#endif
typedef struct
{
- __u8 data[528]; // Data + spare
+ u8 data[528]; // Data + spare
} yflash_Page;
typedef struct
return 1;
}
-int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, yaffs_ext_tags *tags)
+int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, yaffs_ext_tags *tags)
{
int blk;
int pg;
}
-int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_tags_t *tags)
+int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_tags_t *tags)
{
int blk;
int pg;
#include "yaffs_guts.h"
int yflash_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
-int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
-int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
-int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
-int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yflash_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare);
+int yflash_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags);
+int yflash_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare);
+int yflash_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags);
int yflash_InitialiseNAND(yaffs_dev_t *dev);
int yflash_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
-int yflash_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
+int yflash_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number);
#endif
#include "yaffs_guts.h"
int yflash2_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
-int yflash2_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_spare *spare);
-int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
-int yflash2_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_spare *spare);
-int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int yflash2_WriteChunkToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare);
+int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags);
+int yflash2_ReadChunkFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_spare *spare);
+int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags);
int yflash2_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
int yflash2_InitialiseNAND(yaffs_dev_t *dev);
int yflash2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
-int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
+int yflash2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number);
#endif
#include "yaffs_guts.h"
int nandemul2k_WriteChunkWithTagsToNAND(struct yaffs_dev_s *dev,
- int nand_chunk, const __u8 *data,
+ int nand_chunk, const u8 *data,
const yaffs_ext_tags *tags);
int nandemul2k_ReadChunkWithTagsFromNAND(struct yaffs_dev_s *dev,
- int nand_chunk, __u8 *data,
+ int nand_chunk, u8 *data,
yaffs_ext_tags *tags);
int nandemul2k_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
int nandemul2k_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state, __u32 *seq_number);
+ yaffs_block_state_t *state, u32 *seq_number);
int nandemul2k_EraseBlockInNAND(struct yaffs_dev_s *dev,
int flash_block);
int nandemul2k_InitialiseNAND(struct yaffs_dev_s *dev);
* use it to load the tags.
*/
int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
- const __u8 * data,
+ const u8 * data,
const yaffs_ext_tags * tags)
{
}
int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
- __u8 * data, yaffs_ext_tags * tags)
+ u8 * data, yaffs_ext_tags * tags)
{
yaffs_packed_tags2 pt;
int localData = 0;
return geometry->checkBlockOk(dev,blockId);
}
-int ynandif_QueryNANDBlock(struct yaffs_dev_s *dev, int blockId, yaffs_block_state_t *state, __u32 *seq_number)
+int ynandif_QueryNANDBlock(struct yaffs_dev_s *dev, int blockId, yaffs_block_state_t *state, u32 *seq_number)
{
unsigned chunkNo;
yaffs_ext_tags tags;
#if 0
-int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const yaffs_ext_tags *tags);
-int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tags *tags);
+int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const u8 *data, const yaffs_ext_tags *tags);
+int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, u8 *data, yaffs_ext_tags *tags);
int ynandif_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
int ynandif_InitialiseNAND(yaffs_dev_t *dev);
int ynandif_MarkNANDBlockBad(yaffs_dev_t *dev,int blockNumber);
-int ynandif_QueryNANDBlock(yaffs_dev_t *dev, int block_no, yaffs_block_state_t *state, __u32 *seq_number);
+int ynandif_QueryNANDBlock(yaffs_dev_t *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number);
int ynandif_GetGeometry(yaffs_dev_t *dev, ynandif_Geometry *geometry);
#endif
void yaffsfs_Lock(void);
void yaffsfs_Unlock(void);
-__u32 yaffsfs_CurrentTime(void);
+u32 yaffsfs_CurrentTime(void);
void yaffsfs_SetError(int err);
} yaffsfs_Inode;
typedef struct{
- __u8 reading:1;
- __u8 writing:1;
- __u8 append:1;
- __u8 shareRead:1;
- __u8 shareWrite:1;
+ u8 reading:1;
+ u8 writing:1;
+ u8 append:1;
+ u8 shareRead:1;
+ u8 shareWrite:1;
int inodeId:12; /* Index to corresponding yaffsfs_Inode */
int useCount:10; /* Use count for this handle */
- __u32 position; /* current position in file */
+ u32 position; /* current position in file */
}yaffsfs_Handle;
static yaffsfs_Inode yaffsfs_inode[YAFFSFS_N_HANDLES];
int symDepth = 0;
int errorReported = 0;
int rwflags = oflag & ( O_RDWR | O_RDONLY | O_WRONLY);
- __u8 shareRead = (sharing & YAFFS_SHARE_READ) ? 1 : 0;
- __u8 shareWrite = (sharing & YAFFS_SHARE_WRITE) ? 1 : 0;
- __u8 sharedReadAllowed;
- __u8 sharedWriteAllowed;
- __u8 alreadyReading;
- __u8 alreadyWriting;
- __u8 readRequested;
- __u8 writeRequested;
+ u8 shareRead = (sharing & YAFFS_SHARE_READ) ? 1 : 0;
+ u8 shareWrite = (sharing & YAFFS_SHARE_WRITE) ? 1 : 0;
+ u8 sharedReadAllowed;
+ u8 sharedWriteAllowed;
+ u8 alreadyReading;
+ u8 alreadyWriting;
+ u8 readRequested;
+ u8 writeRequested;
/* O_EXCL only has meaning if O_CREAT is specified */
if(!(oflag & O_CREAT))
int nToRead = 0;
int totalRead = 0;
unsigned int maxRead;
- __u8 *buf = (__u8 *)vbuf;
+ u8 *buf = (u8 *)vbuf;
yaffsfs_Lock();
h = yaffsfs_GetHandlePointer(fd);
int totalWritten = 0;
int write_trhrough = 0;
int nToWrite = 0;
- const __u8 *buf = (const __u8 *)vbuf;
+ const u8 *buf = (const u8 *)vbuf;
yaffsfs_Lock();
h = yaffsfs_GetHandlePointer(fd);
typedef struct
{
- __u32 magic;
+ u32 magic;
yaffs_dirent de; /* directory entry being used by this dsc */
YCHAR name[NAME_MAX+1]; /* name of directory being searched */
yaffs_obj_t *dirObj; /* ptr to directory being searched */
typedef struct
{
- __u8 data[PAGE_TOTAL_SIZE]; // Data + spare
+ u8 data[PAGE_TOTAL_SIZE]; // Data + spare
int empty; // is this empty?
} nandemul_Page;
{
int pg = page%PAGES_PER_BLOCK;
int blk = page/PAGES_PER_BLOCK;
- __u8 *p;
- __u8 *b = (__u8 *)buffer;
+ u8 *p;
+ u8 *b = (u8 *)buffer;
p = &ned.block[blk]->page[pg]->data[start];
-static int nandemul2k_ReadId(__u8 *vendorId, __u8 *deviceId)
+static int nandemul2k_ReadId(u8 *vendorId, u8 *deviceId)
{
*vendorId = 'Y';
*deviceId = '2';
}
-static int nandemul2k_ReadStatus(__u8 *status)
+static int nandemul2k_ReadStatus(u8 *status)
{
*status = 0;
return 1;
void nandmtd2_pt2buf(yaffs_dev_t *dev, yaffs_PackedTags2 *pt, int is_raw)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
- __u8 *ptab = (__u8 *)pt; /* packed tags as bytes */
+ u8 *ptab = (u8 *)pt; /* packed tags as bytes */
int i, j = 0, k, n;
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
int i, j = 0, k, n;
- __u8 *ptab = (__u8 *)pt; /* packed tags as bytes */
+ u8 *ptab = (u8 *)pt; /* packed tags as bytes */
if (!is_raw) {
}
int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
- const __u8 * data,
+ const u8 * data,
const yaffs_ext_tags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
}
int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
- __u8 * data, yaffs_ext_tags * tags)
+ u8 * data, yaffs_ext_tags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
size_t dummy;
memcpy(spareData, pt, sizeof(*pt));
}
-static int write_chunk(__u8 *data, __u32 id, __u32 chunk_id, __u32 n_bytes)
+static int write_chunk(u8 *data, u32 id, u32 chunk_id, u32 n_bytes)
{
yaffs_ext_tags t;
yaffs_packed_tags2 pt;
int i;
oh->type = SWAP32(oh->type); // GCC makes enums 32 bits.
oh->parent_obj_id = SWAP32(oh->parent_obj_id); // int
- oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // __u16 - Not used, but done for completeness.
+ oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // u16 - Not used, but done for completeness.
// name = skip. Char array. Not swapped.
oh->yst_mode = SWAP32(oh->yst_mode);
#ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case.
static int write_object_header(int id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
{
- __u8 bytes[chunkSize];
+ u8 bytes[chunkSize];
yaffs_obj_header *oh = (yaffs_obj_header *)bytes;
static void pad_image(void)
{
- __u8 data[chunkSize + spareSize];
+ u8 data[chunkSize + spareSize];
int padPages = (nPages % pagesPerBlock);
if (padPages)
if(write_object_header(newObj, YAFFS_OBJECT_TYPE_FILE, &stats, parent, entry->d_name, -1, NULL) == 0)
{
int h;
- __u8 bytes[chunkSize];
+ u8 bytes[chunkSize];
int n_bytes;
int chunk = 0;
}
// NCB added 10/9/2002
-static __u16 yaffs_calc_name_sum(const char *name)
+static u16 yaffs_calc_name_sum(const char *name)
{
- __u16 sum = 0;
- __u16 i = 1;
+ u16 sum = 0;
+ u16 i = 1;
- __u8 *bname = (__u8 *)name;
+ u8 *bname = (u8 *)name;
while (*bname)
{
}
-static void yaffs_calc_ecc(const __u8 *data, yaffs_spare *spare)
+static void yaffs_calc_ecc(const u8 *data, yaffs_spare *spare)
{
yaffs_ecc_cacl(data , spare->ecc1);
yaffs_ecc_cacl(&data[256] , spare->ecc2);
tags->as_bytes[7] = temp.as_bytes[7];
}
-static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
+static int write_chunk(u8 *data, u32 obj_id, u32 chunk_id, u32 n_bytes)
{
yaffs_tags_t t;
yaffs_spare s;
{
oh->type = SWAP32(oh->type); // GCC makes enums 32 bits.
oh->parent_obj_id = SWAP32(oh->parent_obj_id); // int
- oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // __u16 - Not used, but done for completeness.
+ oh->sum_no_longer_used = SWAP16(oh->sum_no_longer_used); // u16 - Not used, but done for completeness.
// name = skip. Char array. Not swapped.
oh->yst_mode = SWAP32(oh->yst_mode);
#ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case.
static int write_object_header(int obj_id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
{
- __u8 bytes[512];
+ u8 bytes[512];
yaffs_obj_header *oh = (yaffs_obj_header *)bytes;
if(error >= 0)
{
int h;
- __u8 bytes[512];
+ u8 bytes[512];
int n_bytes;
int chunk = 0;
struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator;
int i;
yaffs_tnode_t *new_tnodes;
- __u8 *mem;
+ u8 *mem;
yaffs_tnode_t *curr;
yaffs_tnode_t *next;
yaffs_tnodelist_t *tnl;
/* make these things */
new_tnodes = YMALLOC(n_tnodes * dev->tnode_size);
- mem = (__u8 *)new_tnodes;
+ mem = (u8 *)new_tnodes;
if (!new_tnodes) {
T(YAFFS_TRACE_ERROR,
* Chunk bitmap manipulations
*/
-static Y_INLINE __u8 *yaffs_block_bits(yaffs_dev_t *dev, int blk)
+static Y_INLINE u8 *yaffs_block_bits(yaffs_dev_t *dev, int blk)
{
if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
T(YAFFS_TRACE_ERROR,
void yaffs_clear_chunk_bits(yaffs_dev_t *dev, int blk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
memset(blk_bits, 0, dev->chunk_bit_stride);
}
void yaffs_clear_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
void yaffs_set_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
int yaffs_check_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
return (blk_bits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0;
int yaffs_still_some_chunks(yaffs_dev_t *dev, int blk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
int i;
for (i = 0; i < dev->chunk_bit_stride; i++) {
if (*blk_bits)
int yaffs_count_chunk_bits(yaffs_dev_t *dev, int blk)
{
- __u8 *blk_bits = yaffs_block_bits(dev, blk);
+ u8 *blk_bits = yaffs_block_bits(dev, blk);
int i;
int n = 0;
for (i = 0; i < dev->chunk_bit_stride; i++) {
- __u8 x = *blk_bits;
+ u8 x = *blk_bits;
while (x) {
if (x & 1)
n++;
return 1;
}
-int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum)
+int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, u32 *sum)
{
- __u32 composite_sum;
+ u32 composite_sum;
composite_sum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
*sum = composite_sum;
return 1;
int ok = 1;
- __u8 * data_bytes = (__u8 *)data;
+ u8 * data_bytes = (u8 *)data;
int chunk;
int realigned_chunk;
- __u8 *data_bytes = (__u8 *)data;
+ u8 *data_bytes = (u8 *)data;
if (!dev->checkpt_buffer)
return 0;
int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes);
-int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum);
+int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, u32 *sum);
int yaffs_checkpt_close(yaffs_dev_t *dev);
static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk,
int erased_ok);
static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *tags);
static void yaffs_handle_chunk_update(yaffs_dev_t *dev, int nand_chunk,
const yaffs_ext_tags *tags);
static int yaffs_obj_cache_dirty(yaffs_obj_t *obj);
static int yaffs_write_new_chunk(yaffs_dev_t *dev,
- const __u8 *buffer,
+ const u8 *buffer,
yaffs_ext_tags *tags,
int use_reserver);
static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *data,
+ const u8 *data,
yaffs_ext_tags *tags);
/* Function to calculate chunk and offset */
static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunk_out,
- __u32 *offset_out)
+ u32 *offset_out)
{
int chunk;
- __u32 offset;
+ u32 offset;
- chunk = (__u32)(addr >> dev->chunk_shift);
+ chunk = (u32)(addr >> dev->chunk_shift);
if (dev->chunk_div == 1) {
/* easy power of 2 case */
- offset = (__u32)(addr & dev->chunk_mask);
+ offset = (u32)(addr & dev->chunk_mask);
} else {
/* Non power-of-2 case */
chunk /= dev->chunk_div;
chunk_base = ((loff_t)chunk) * dev->data_bytes_per_chunk;
- offset = (__u32)(addr - chunk_base);
+ offset = (u32)(addr - chunk_base);
}
*chunk_out = chunk;
* be hellishly efficient.
*/
-static __u32 calc_shifts_ceiling(__u32 x)
+static u32 calc_shifts_ceiling(u32 x)
{
int extra_bits;
int shifts;
/* Function to return the number of shifts to get a 1 in bit 0
*/
-static __u32 calc_shifts(__u32 x)
+static u32 calc_shifts(u32 x)
{
- __u32 shifts;
+ u32 shifts;
shifts = 0;
static int yaffs_init_tmp_buffers(yaffs_dev_t *dev)
{
int i;
- __u8 *buf = (__u8 *)1;
+ u8 *buf = (u8 *)1;
memset(dev->temp_buffer, 0, sizeof(dev->temp_buffer));
return buf ? YAFFS_OK : YAFFS_FAIL;
}
-__u8 *yaffs_get_temp_buffer(yaffs_dev_t *dev, int line_no)
+u8 *yaffs_get_temp_buffer(yaffs_dev_t *dev, int line_no)
{
int i, j;
}
-void yaffs_release_temp_buffer(yaffs_dev_t *dev, __u8 *buffer,
+void yaffs_release_temp_buffer(yaffs_dev_t *dev, u8 *buffer,
int line_no)
{
int i;
/*
* Determine if we have a managed buffer.
*/
-int yaffs_is_managed_tmp_buffer(yaffs_dev_t *dev, const __u8 *buffer)
+int yaffs_is_managed_tmp_buffer(yaffs_dev_t *dev, const u8 *buffer)
{
int i;
* Erased NAND checking functions
*/
-int yaffs_check_ff(__u8 *buffer, int n_bytes)
+int yaffs_check_ff(u8 *buffer, int n_bytes)
{
/* Horrible, slow implementation */
while (n_bytes--) {
int nand_chunk)
{
int retval = YAFFS_OK;
- __u8 *data = yaffs_get_temp_buffer(dev, __LINE__);
+ u8 *data = yaffs_get_temp_buffer(dev, __LINE__);
yaffs_ext_tags tags;
int result;
static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *data,
+ const u8 *data,
yaffs_ext_tags *tags)
{
int retval = YAFFS_OK;
yaffs_ext_tags temp_tags;
- __u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
+ u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
int result;
result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&temp_tags);
}
static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
- const __u8 *data,
+ const u8 *data,
yaffs_ext_tags *tags,
int use_reserver)
{
yaffs_ext_tags tags;
int chunk_id = flash_block * dev->param.chunks_per_block;
- __u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
+ u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
memset(buffer, 0xff, dev->data_bytes_per_chunk);
yaffs_init_tags(&tags);
*/
static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *tags)
{
dev=dev;
/*---------------- Name handling functions ------------*/
-static __u16 yaffs_calc_name_sum(const YCHAR *name)
+static u16 yaffs_calc_name_sum(const YCHAR *name)
{
- __u16 sum = 0;
- __u16 i = 1;
+ u16 sum = 0;
+ u16 i = 1;
const YUCHAR *bname = (const YUCHAR *) name;
if (bname) {
void yaffs_load_tnode_0(yaffs_dev_t *dev, yaffs_tnode_t *tn, unsigned pos,
unsigned val)
{
- __u32 *map = (__u32 *)tn;
- __u32 bit_in_map;
- __u32 bit_in_word;
- __u32 word_in_map;
- __u32 mask;
+ u32 *map = (u32 *)tn;
+ u32 bit_in_map;
+ u32 bit_in_word;
+ u32 word_in_map;
+ u32 mask;
pos &= YAFFS_TNODES_LEVEL0_MASK;
val >>= dev->chunk_grp_bits;
}
}
-__u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn,
+u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn,
unsigned pos)
{
- __u32 *map = (__u32 *)tn;
- __u32 bit_in_map;
- __u32 bit_in_word;
- __u32 word_in_map;
- __u32 val;
+ u32 *map = (u32 *)tn;
+ u32 bit_in_map;
+ u32 bit_in_word;
+ u32 word_in_map;
+ u32 val;
pos &= YAFFS_TNODES_LEVEL0_MASK;
/* FindLevel0Tnode finds the level 0 tnode, if one exists. */
yaffs_tnode_t *yaffs_find_tnode_0(yaffs_dev_t *dev,
yaffs_file_s *file_struct,
- __u32 chunk_id)
+ u32 chunk_id)
{
yaffs_tnode_t *tn = file_struct->top;
- __u32 i;
+ u32 i;
int required_depth;
int level = file_struct->top_level;
yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
yaffs_file_s *file_struct,
- __u32 chunk_id,
+ u32 chunk_id,
yaffs_tnode_t *passed_tn)
{
int required_depth;
int l;
yaffs_tnode_t *tn;
- __u32 x;
+ u32 x;
/* Check sane level and page Id */
*/
static int yaffs_soft_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
- __u32 level, int chunk_offset)
+ u32 level, int chunk_offset)
{
int i;
int the_chunk;
*/
static yaffs_tnode_t *yaffs_prune_worker(yaffs_dev_t *dev, yaffs_tnode_t *tn,
- __u32 level, int del0)
+ u32 level, int del0)
{
int i;
int has_data;
has_data++;
}
} else {
- int tnode_size_u32 = dev->tnode_size/sizeof(__u32);
- __u32 *map = (__u32 *)tn;
+ int tnode_size_u32 = dev->tnode_size/sizeof(u32);
+ u32 *map = (u32 *)tn;
for(i = 0; !has_data && i < tnode_size_u32; i++){
if(map[i])
}
static yaffs_obj_t *yaffs_create_fake_dir(yaffs_dev_t *dev, int number,
- __u32 mode)
+ u32 mode)
{
yaffs_obj_t *obj =
int found = 0;
struct ylist_head *i;
- __u32 n = (__u32) bucket;
+ u32 n = (u32) bucket;
/* yaffs_check_obj_hash_sane(); */
dev->obj_bucket[bucket].count++;
}
-yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, __u32 number)
+yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, u32 number)
{
int bucket = yaffs_hash_fn(number);
struct ylist_head *i;
case YAFFS_OBJECT_TYPE_FILE:
the_obj->variant.file_variant.file_size = 0;
the_obj->variant.file_variant.scanned_size = 0;
- the_obj->variant.file_variant.shrink_size = 0xFFFFFFFF; /* max __u32 */
+ the_obj->variant.file_variant.shrink_size = 0xFFFFFFFF; /* max u32 */
the_obj->variant.file_variant.top_level = 0;
the_obj->variant.file_variant.top = tn;
break;
static yaffs_obj_t *yaffs_create_obj(yaffs_obj_type type,
yaffs_obj_t *parent,
const YCHAR *name,
- __u32 mode,
- __u32 uid,
- __u32 gid,
+ u32 mode,
+ u32 uid,
+ u32 gid,
yaffs_obj_t *equiv_obj,
- const YCHAR *alias_str, __u32 rdev)
+ const YCHAR *alias_str, u32 rdev)
{
yaffs_obj_t *in;
YCHAR *str = NULL;
}
yaffs_obj_t *yaffs_create_file(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid)
+ u32 mode, u32 uid, u32 gid)
{
return yaffs_create_obj(YAFFS_OBJECT_TYPE_FILE, parent, name, mode,
uid, gid, NULL, NULL, 0);
}
yaffs_obj_t *yaffs_create_dir(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid)
+ u32 mode, u32 uid, u32 gid)
{
return yaffs_create_obj(YAFFS_OBJECT_TYPE_DIRECTORY, parent, name,
mode, uid, gid, NULL, NULL, 0);
}
yaffs_obj_t *yaffs_create_special(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid, __u32 rdev)
+ u32 mode, u32 uid, u32 gid, u32 rdev)
{
return yaffs_create_obj(YAFFS_OBJECT_TYPE_SPECIAL, parent, name, mode,
uid, gid, NULL, NULL, rdev);
}
yaffs_obj_t *yaffs_create_symlink(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid,
+ u32 mode, u32 uid, u32 gid,
const YCHAR *alias)
{
return yaffs_create_obj(YAFFS_OBJECT_TYPE_SYMLINK, parent, name, mode,
yaffs_block_became_dirty(dev, block);
} else {
- __u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
+ u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
yaffs_verify_blk(dev, bi, block);
yaffs_verify_oh(object, oh, &tags, 1);
new_chunk =
- yaffs_write_new_chunk(dev,(__u8 *) oh, &tags, 1);
+ yaffs_write_new_chunk(dev,(u8 *) oh, &tags, 1);
} else
new_chunk =
yaffs_write_new_chunk(dev, buffer, &tags, 1);
}
static int yaffs_rd_data_obj(yaffs_obj_t *in, int inode_chunk,
- __u8 *buffer)
+ u8 *buffer)
{
int nand_chunk = yaffs_find_chunk_in_file(in, inode_chunk, NULL);
}
static int yaffs_wr_data_obj(yaffs_obj_t *in, int inode_chunk,
- const __u8 *buffer, int n_bytes,
+ const u8 *buffer, int n_bytes,
int use_reserve)
{
/* Find old chunk Need to do this to get serial number
yaffs_ext_tags old_tags;
const YCHAR *alias = NULL;
- __u8 *buffer = NULL;
+ u8 *buffer = NULL;
YCHAR old_name[YAFFS_MAX_NAME_LENGTH + 1];
yaffs_obj_header *oh = NULL;
* Curve-balls: the first chunk might also be the last chunk.
*/
-int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
+int yaffs_file_rd(yaffs_obj_t *in, u8 *buffer, loff_t offset,
int n_bytes)
{
int chunk;
- __u32 start;
+ u32 start;
int n_copy;
int n = n_bytes;
int n_done = 0;
} else {
/* Read into the local buffer then copy..*/
- __u8 *local_buffer =
+ u8 *local_buffer =
yaffs_get_temp_buffer(dev, __LINE__);
yaffs_rd_data_obj(in, chunk,
local_buffer);
return n_done;
}
-int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
+int yaffs_do_file_wr(yaffs_obj_t *in, const u8 *buffer, loff_t offset,
int n_bytes, int write_trhrough)
{
int chunk;
- __u32 start;
+ u32 start;
int n_copy;
int n = n_bytes;
int n_done = 0;
int n_writeback;
int start_write = offset;
int chunk_written = 0;
- __u32 n_bytes_read;
- __u32 chunk_start;
+ u32 n_bytes_read;
+ u32 chunk_start;
yaffs_dev_t *dev;
* Read into the local buffer then copy, then copy over and write back.
*/
- __u8 *local_buffer =
+ u8 *local_buffer =
yaffs_get_temp_buffer(dev, __LINE__);
yaffs_rd_data_obj(in, chunk,
return n_done;
}
-int yaffs_wr_file(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
+int yaffs_wr_file(yaffs_obj_t *in, const u8 *buffer, loff_t offset,
int n_bytes, int write_trhrough)
{
yaffs2_handle_hole(in,offset);
void yaffs_resize_file_down( yaffs_obj_t *obj, loff_t new_size)
{
int new_full;
- __u32 new_partial;
+ u32 new_partial;
yaffs_dev_t *dev = obj->my_dev;
yaffs_addr_to_chunk(dev, new_size, &new_full, &new_partial);
if (new_partial != 0) {
int last_chunk = 1 + new_full;
- __u8 *local_buffer = yaffs_get_temp_buffer(dev, __LINE__);
+ u8 *local_buffer = yaffs_get_temp_buffer(dev, __LINE__);
/* Got to read and rewrite the last chunk with its new size and zero pad */
yaffs_rd_data_obj(obj, last_chunk, local_buffer);
static void yaffs_check_obj_details_loaded(yaffs_obj_t *in)
{
- __u8 *chunk_data;
+ u8 *chunk_data;
yaffs_obj_header *oh;
yaffs_dev_t *dev;
yaffs_ext_tags tags;
#endif
else if(obj->hdr_chunk > 0) {
int result;
- __u8 *buffer = yaffs_get_temp_buffer(obj->my_dev, __LINE__);
+ u8 *buffer = yaffs_get_temp_buffer(obj->my_dev, __LINE__);
yaffs_obj_header *oh = (yaffs_obj_header *) buffer;
if(!buffer)
return -ENOMEM;
- result = yaffs_rd_chunk_tags_nand(dev,obj->hdr_chunk, (__u8 *)buffer, &tags);
+ result = yaffs_rd_chunk_tags_nand(dev,obj->hdr_chunk, (u8 *)buffer, &tags);
if(result != YAFFS_OK)
retval = -ENOENT;
else
retval = nval_list(x_buffer, x_size, value,size);
}
- yaffs_release_temp_buffer(dev,(__u8 *)buffer,__LINE__);
+ yaffs_release_temp_buffer(dev,(u8 *)buffer,__LINE__);
return retval;
}
dev->cache = YMALLOC(cache_bytes);
- buf = (__u8 *) dev->cache;
+ buf = (u8 *) dev->cache;
if (dev->cache)
memset(dev->cache, 0, cache_bytes);
dev->cache_hits = 0;
if (!init_failed) {
- dev->gc_cleanup_list = YMALLOC(dev->param.chunks_per_block * sizeof(__u32));
+ dev->gc_cleanup_list = YMALLOC(dev->param.chunks_per_block * sizeof(u32));
if (!dev->gc_cleanup_list)
init_failed = 1;
}
int dirty;
int n_bytes; /* Only valid if the cache is dirty */
int locked; /* Can't push out or flush while locked. */
- __u8 *data;
+ u8 *data;
} yaffs_cache_t;
typedef union {
yaffs_tags_t as_tags;
- __u8 as_bytes[8];
+ u8 as_bytes[8];
} yaffs_tags_union_t;
#endif
/* Spare structure for YAFFS1 */
typedef struct {
- __u8 tb0;
- __u8 tb1;
- __u8 tb2;
- __u8 tb3;
- __u8 page_status; /* set to 0 to delete the chunk */
- __u8 block_status;
- __u8 tb4;
- __u8 tb5;
- __u8 ecc1[3];
- __u8 tb6;
- __u8 tb7;
- __u8 ecc2[3];
+ u8 tb0;
+ u8 tb1;
+ u8 tb2;
+ u8 tb3;
+ u8 page_status; /* set to 0 to delete the chunk */
+ u8 block_status;
+ u8 tb4;
+ u8 tb5;
+ u8 ecc1[3];
+ u8 tb6;
+ u8 tb7;
+ u8 ecc2[3];
} yaffs_spare;
/*Special structure for passing through to mtd */
int soft_del_pages:10; /* number of soft deleted pages */
int pages_in_use:10; /* number of pages in use */
unsigned block_state:4; /* One of the above block states. NB use unsigned because enum is sometimes an int */
- __u32 needs_retiring:1; /* Data has failed on this block, need to get valid data off */
+ u32 needs_retiring:1; /* Data has failed on this block, need to get valid data off */
/* and retire the block. */
- __u32 skip_erased_check:1; /* If this is set we can skip the erased check on this block */
- __u32 gc_prioritise:1; /* An ECC check or blank check has failed on this block.
+ u32 skip_erased_check:1; /* If this is set we can skip the erased check on this block */
+ u32 gc_prioritise:1; /* An ECC check or blank check has failed on this block.
It should be prioritised for GC */
- __u32 chunk_error_strikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */
+ u32 chunk_error_strikes:3; /* How many times we've had ecc etc failures on this block and tried to reuse it */
#ifdef CONFIG_YAFFS_YAFFS2
- __u32 has_shrink_hdr:1; /* This block has at least one shrink object header */
- __u32 seq_number; /* block sequence number for yaffs2 */
+ u32 has_shrink_hdr:1; /* This block has at least one shrink object header */
+ u32 seq_number; /* block sequence number for yaffs2 */
#endif
} yaffs_block_info_t;
/* Apply to everything */
int parent_obj_id;
- __u16 sum_no_longer_used; /* checksum of name. No longer used */
+ u16 sum_no_longer_used; /* checksum of name. No longer used */
YCHAR name[YAFFS_MAX_NAME_LENGTH + 1];
/* The following apply to directories, files, symlinks - not hard links */
- __u32 yst_mode; /* protection */
+ u32 yst_mode; /* protection */
#ifdef CONFIG_YAFFS_WINCE
- __u32 not_for_wince[5];
+ u32 not_for_wince[5];
#else
- __u32 yst_uid;
- __u32 yst_gid;
- __u32 yst_atime;
- __u32 yst_mtime;
- __u32 yst_ctime;
+ u32 yst_uid;
+ u32 yst_gid;
+ u32 yst_atime;
+ u32 yst_mtime;
+ u32 yst_ctime;
#endif
/* File size applies to files only */
/* Alias is for symlinks only. */
YCHAR alias[YAFFS_MAX_ALIAS_LENGTH + 1];
- __u32 yst_rdev; /* device stuff for block and char devices (major/min) */
+ u32 yst_rdev; /* device stuff for block and char devices (major/min) */
#ifdef CONFIG_YAFFS_WINCE
- __u32 win_ctime[2];
- __u32 win_atime[2];
- __u32 win_mtime[2];
+ u32 win_ctime[2];
+ u32 win_atime[2];
+ u32 win_mtime[2];
#else
- __u32 room_to_grow[6];
+ u32 room_to_grow[6];
#endif
- __u32 inband_shadowed_obj_id;
- __u32 inband_is_shrink;
+ u32 inband_shadowed_obj_id;
+ u32 inband_is_shrink;
- __u32 reserved[2];
+ u32 reserved[2];
int shadows_obj; /* This object header shadows the specified object if > 0 */
/* is_shrink applies to object headers written when we shrink the file (ie resize) */
- __u32 is_shrink;
+ u32 is_shrink;
} yaffs_obj_header;
*/
typedef struct {
- __u32 file_size;
- __u32 scanned_size;
- __u32 shrink_size;
+ u32 file_size;
+ u32 scanned_size;
+ u32 shrink_size;
int top_level;
yaffs_tnode_t *top;
} yaffs_file_s;
typedef struct {
struct yaffs_obj_s *equiv_obj;
- __u32 equiv_id;
+ u32 equiv_id;
} yaffs_hard_link_s;
typedef union {
struct yaffs_obj_s {
- __u8 deleted:1; /* This should only apply to unlinked files. */
- __u8 soft_del:1; /* it has also been soft deleted */
- __u8 unlinked:1; /* An unlinked file. The file should be in the unlinked directory.*/
- __u8 fake:1; /* A fake object has no presence on NAND. */
- __u8 rename_allowed:1; /* Some objects are not allowed to be renamed. */
- __u8 unlink_allowed:1;
- __u8 dirty:1; /* the object needs to be written to flash */
- __u8 valid:1; /* When the file system is being loaded up, this
+ u8 deleted:1; /* This should only apply to unlinked files. */
+ u8 soft_del:1; /* it has also been soft deleted */
+ u8 unlinked:1; /* An unlinked file. The file should be in the unlinked directory.*/
+ u8 fake:1; /* A fake object has no presence on NAND. */
+ u8 rename_allowed:1; /* Some objects are not allowed to be renamed. */
+ u8 unlink_allowed:1;
+ u8 dirty:1; /* the object needs to be written to flash */
+ u8 valid:1; /* When the file system is being loaded up, this
* object might be created before the data
* is available (ie. file data records appear before the header).
*/
- __u8 lazy_loaded:1; /* This object has been lazy loaded and is missing some detail */
+ u8 lazy_loaded:1; /* This object has been lazy loaded and is missing some detail */
- __u8 defered_free:1; /* For Linux kernel. Object is removed from NAND, but is
+ u8 defered_free:1; /* For Linux kernel. Object is removed from NAND, but is
* still in the inode cache. Free of object is defered.
* until the inode is released.
*/
- __u8 being_created:1; /* This object is still being created so skip some checks. */
- __u8 is_shadowed:1; /* This object is shadowed on the way to being renamed. */
+ u8 being_created:1; /* This object is still being created so skip some checks. */
+ u8 is_shadowed:1; /* This object is shadowed on the way to being renamed. */
- __u8 xattr_known:1; /* We know if this has object has xattribs or not. */
- __u8 has_xattr:1; /* This object has xattribs. Valid if xattr_known. */
+ u8 xattr_known:1; /* We know if this has object has xattribs or not. */
+ u8 has_xattr:1; /* This object has xattribs. Valid if xattr_known. */
- __u8 serial; /* serial number of chunk in NAND. Cached here */
- __u16 sum; /* sum of the name to speed searching */
+ u8 serial; /* serial number of chunk in NAND. Cached here */
+ u16 sum; /* sum of the name to speed searching */
struct yaffs_dev_s *my_dev; /* The device I'm on */
int n_data_chunks; /* Number of data chunks attached to the file. */
- __u32 obj_id; /* the object id value */
+ u32 obj_id; /* the object id value */
- __u32 yst_mode;
+ u32 yst_mode;
#ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
YCHAR short_name[YAFFS_SHORT_NAME_LENGTH + 1];
#endif
#ifdef CONFIG_YAFFS_WINCE
- __u32 win_ctime[2];
- __u32 win_mtime[2];
- __u32 win_atime[2];
+ u32 win_ctime[2];
+ u32 win_mtime[2];
+ u32 win_atime[2];
#else
- __u32 yst_uid;
- __u32 yst_gid;
- __u32 yst_atime;
- __u32 yst_mtime;
- __u32 yst_ctime;
+ u32 yst_uid;
+ u32 yst_gid;
+ u32 yst_atime;
+ u32 yst_mtime;
+ u32 yst_ctime;
#endif
- __u32 yst_rdev;
+ u32 yst_rdev;
void *my_inode;
typedef struct {
int struct_type;
- __u32 obj_id;
- __u32 parent_id;
+ u32 obj_id;
+ u32 parent_id;
int hdr_chunk;
yaffs_obj_type variant_type:3;
- __u8 deleted:1;
- __u8 soft_del:1;
- __u8 unlinked:1;
- __u8 fake:1;
- __u8 rename_allowed:1;
- __u8 unlink_allowed:1;
- __u8 serial;
+ u8 deleted:1;
+ u8 soft_del:1;
+ u8 unlinked:1;
+ u8 fake:1;
+ u8 rename_allowed:1;
+ u8 unlink_allowed:1;
+ u8 serial;
int n_data_chunks;
- __u32 size_or_equiv_obj;
+ u32 size_or_equiv_obj;
} yaffs_checkpt_obj_t;
/*--------------------- Temporary buffers ----------------
*/
typedef struct {
- __u8 *buffer;
+ u8 *buffer;
int line; /* track from whence this buffer was allocated */
int max_line;
} yaffs_buffer_t;
*/
int inband_tags; /* Use unband tags */
- __u32 total_bytes_per_chunk; /* Should be >= 512, does not need to be a power of 2 */
+ u32 total_bytes_per_chunk; /* Should be >= 512, does not need to be a power of 2 */
int chunks_per_block; /* does not need to be a power of 2 */
int spare_bytes_per_chunk; /* spare area size */
int start_block; /* Start block we're allowed to use */
int refresh_period; /* How often we should check to do a block refresh */
/* Checkpoint control. Can be set before or after initialisation */
- __u8 skip_checkpt_rd;
- __u8 skip_checkpt_wr;
+ u8 skip_checkpt_rd;
+ u8 skip_checkpt_wr;
int enable_xattr; /* Enable xattribs */
/* NAND access functions (Must be set before calling YAFFS)*/
int (*write_chunk_fn) (struct yaffs_dev_s *dev,
- int nand_chunk, const __u8 *data,
+ int nand_chunk, const u8 *data,
const yaffs_spare *spare);
int (*read_chunk_fn) (struct yaffs_dev_s *dev,
- int nand_chunk, __u8 *data,
+ int nand_chunk, u8 *data,
yaffs_spare *spare);
int (*erase_fn) (struct yaffs_dev_s *dev,
int flash_block);
#ifdef CONFIG_YAFFS_YAFFS2
int (*write_chunk_tags_fn) (struct yaffs_dev_s *dev,
- int nand_chunk, const __u8 *data,
+ int nand_chunk, const u8 *data,
const yaffs_ext_tags *tags);
int (*read_chunk_tags_fn) (struct yaffs_dev_s *dev,
- int nand_chunk, __u8 *data,
+ int nand_chunk, u8 *data,
yaffs_ext_tags *tags);
int (*bad_block_fn) (struct yaffs_dev_s *dev, int block_no);
int (*query_block_fn) (struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state, __u32 *seq_number);
+ yaffs_block_state_t *state, u32 *seq_number);
#endif
/* The remove_obj_fn function must be supplied by OS flavours that
int data_bytes_per_chunk;
/* Non-wide tnode stuff */
- __u16 chunk_grp_bits; /* Number of bits that need to be resolved if
+ u16 chunk_grp_bits; /* Number of bits that need to be resolved if
* the tnodes are not wide enough.
*/
- __u16 chunk_grp_size; /* == 2^^chunk_grp_bits */
+ u16 chunk_grp_size; /* == 2^^chunk_grp_bits */
/* Stuff to support wide tnodes */
- __u32 tnode_width;
- __u32 tnode_mask;
- __u32 tnode_size;
+ u32 tnode_width;
+ u32 tnode_mask;
+ u32 tnode_size;
/* Stuff for figuring out file offset to chunk conversions */
- __u32 chunk_shift; /* Shift value */
- __u32 chunk_div; /* Divisor after shifting: 1 for power-of-2 sizes */
- __u32 chunk_mask; /* Mask to use for power-of-2 case */
+ u32 chunk_shift; /* Shift value */
+ u32 chunk_div; /* Divisor after shifting: 1 for power-of-2 sizes */
+ u32 chunk_mask; /* Mask to use for power-of-2 case */
int checkpt_page_seq; /* running sequence number of checkpoint pages */
int checkpt_byte_count;
int checkpt_byte_offs;
- __u8 *checkpt_buffer;
+ u8 *checkpt_buffer;
int checkpt_open_write;
int blocks_in_checkpt;
int checkpt_cur_chunk;
int checkpt_next_block;
int *checkpt_block_list;
int checkpt_max_blocks;
- __u32 checkpt_sum;
- __u32 checkpt_xor;
+ u32 checkpt_sum;
+ u32 checkpt_xor;
int checkpoint_blocks_required; /* Number of blocks needed to store current checkpoint set */
/* Block Info */
yaffs_block_info_t *block_info;
- __u8 *chunk_bits; /* bitmap of chunks in use */
+ u8 *chunk_bits; /* bitmap of chunks in use */
unsigned block_info_alt:1; /* was allocated using alternative strategy */
unsigned chunk_bits_alt:1; /* was allocated using alternative strategy */
int chunk_bit_stride; /* Number of bytes of chunk_bits per block.
int n_erased_blocks;
int alloc_block; /* Current block being allocated off */
- __u32 alloc_page;
+ u32 alloc_page;
int alloc_block_finder; /* Used to search for next allocation block */
/* Object and Tnode memory management */
int n_hardlinks;
yaffs_obj_bucket obj_bucket[YAFFS_NOBJECT_BUCKETS];
- __u32 bucket_finder;
+ u32 bucket_finder;
int n_free_chunks;
/* Garbage collection control */
- __u32 *gc_cleanup_list; /* objects to delete at the end of a GC. */
- __u32 n_clean_ups;
+ u32 *gc_cleanup_list; /* objects to delete at the end of a GC. */
+ u32 n_clean_ups;
unsigned has_pending_prioritised_gc; /* We think this device might have pending prioritised gcs */
unsigned gc_disable;
yaffs_obj_t *lost_n_found;
/* Buffer areas for storing data to recover from write failures TODO
- * __u8 buffered_data[YAFFS_CHUNKS_PER_BLOCK][YAFFS_BYTES_PER_CHUNK];
+ * u8 buffered_data[YAFFS_CHUNKS_PER_BLOCK][YAFFS_BYTES_PER_CHUNK];
* yaffs_spare buffered_spare[YAFFS_CHUNKS_PER_BLOCK];
*/
/* Statistcs */
- __u32 n_page_writes;
- __u32 n_page_reads;
- __u32 n_erasures;
- __u32 n_erase_failures;
- __u32 n_gc_copies;
- __u32 all_gcs;
- __u32 passive_gc_count;
- __u32 oldest_dirty_gc_count;
- __u32 n_gc_blocks;
- __u32 bg_gcs;
- __u32 n_retired_writes;
- __u32 n_retired_blocks;
- __u32 n_ecc_fixed;
- __u32 n_ecc_unfixed;
- __u32 n_tags_ecc_fixed;
- __u32 n_tags_ecc_unfixed;
- __u32 n_deletions;
- __u32 n_unmarked_deletions;
- __u32 refresh_count;
- __u32 cache_hits;
+ u32 n_page_writes;
+ u32 n_page_reads;
+ u32 n_erasures;
+ u32 n_erase_failures;
+ u32 n_gc_copies;
+ u32 all_gcs;
+ u32 passive_gc_count;
+ u32 oldest_dirty_gc_count;
+ u32 n_gc_blocks;
+ u32 bg_gcs;
+ u32 n_retired_writes;
+ u32 n_retired_blocks;
+ u32 n_ecc_fixed;
+ u32 n_ecc_unfixed;
+ u32 n_tags_ecc_fixed;
+ u32 n_tags_ecc_unfixed;
+ u32 n_deletions;
+ u32 n_unmarked_deletions;
+ u32 refresh_count;
+ u32 cache_hits;
};
int struct_type;
int n_erased_blocks;
int alloc_block; /* Current block being allocated off */
- __u32 alloc_page;
+ u32 alloc_page;
int n_free_chunks;
int n_deleted_files; /* Count of files awaiting deletion;*/
typedef struct {
int struct_type;
- __u32 magic;
- __u32 version;
- __u32 head;
+ u32 magic;
+ u32 version;
+ u32 head;
} yaffs_checkpt_validty_t;
int yaffs_get_attribs(yaffs_obj_t *obj, struct iattr *attr);
/* File operations */
-int yaffs_file_rd(yaffs_obj_t *obj, __u8 *buffer, loff_t offset,
+int yaffs_file_rd(yaffs_obj_t *obj, u8 *buffer, loff_t offset,
int n_bytes);
-int yaffs_wr_file(yaffs_obj_t *obj, const __u8 *buffer, loff_t offset,
+int yaffs_wr_file(yaffs_obj_t *obj, const u8 *buffer, loff_t offset,
int n_bytes, int write_trhrough);
int yaffs_resize_file(yaffs_obj_t *obj, loff_t new_size);
yaffs_obj_t *yaffs_create_file(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid);
+ u32 mode, u32 uid, u32 gid);
int yaffs_flush_file(yaffs_obj_t *obj, int update_time, int data_sync);
/* Directory operations */
yaffs_obj_t *yaffs_create_dir(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid);
+ u32 mode, u32 uid, u32 gid);
yaffs_obj_t *yaffs_find_by_name(yaffs_obj_t *the_dir, const YCHAR *name);
-yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, __u32 number);
+yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, u32 number);
/* Link operations */
yaffs_obj_t *yaffs_link_obj(yaffs_obj_t *parent, const YCHAR *name,
/* Symlink operations */
yaffs_obj_t *yaffs_create_symlink(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid,
+ u32 mode, u32 uid, u32 gid,
const YCHAR *alias);
YCHAR *yaffs_get_symlink_alias(yaffs_obj_t *obj);
/* Special inodes (fifos, sockets and devices) */
yaffs_obj_t *yaffs_create_special(yaffs_obj_t *parent, const YCHAR *name,
- __u32 mode, __u32 uid, __u32 gid, __u32 rdev);
+ u32 mode, u32 uid, u32 gid, u32 rdev);
int yaffs_set_xattrib(yaffs_obj_t *obj, const YCHAR *name, const void * value, int size, int flags);
#ifdef CONFIG_YAFFS_WINCE
/* CONFIG_YAFFS_WINCE special stuff */
-void yfsd_win_file_time_now(__u32 target[2]);
+void yfsd_win_file_time_now(u32 target[2]);
#endif
void yaffs_handle_defered_free(yaffs_obj_t *obj);
/* A few useful functions to be used within the core files*/
void yaffs_chunk_del(yaffs_dev_t *dev, int chunk_id, int mark_flash, int lyn);
-int yaffs_check_ff(__u8 *buffer, int n_bytes);
+int yaffs_check_ff(u8 *buffer, int n_bytes);
void yaffs_handle_chunk_error(yaffs_dev_t *dev, yaffs_block_info_t *bi);
-__u8 *yaffs_get_temp_buffer(yaffs_dev_t *dev, int line_no);
-void yaffs_release_temp_buffer(yaffs_dev_t *dev, __u8 *buffer, int line_no);
+u8 *yaffs_get_temp_buffer(yaffs_dev_t *dev, int line_no);
+void yaffs_release_temp_buffer(yaffs_dev_t *dev, u8 *buffer, int line_no);
yaffs_obj_t *yaffs_find_or_create_by_number(yaffs_dev_t *dev,
int number,
yaffs_tnode_t *yaffs_get_tnode(yaffs_dev_t *dev);
yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
yaffs_file_s *file_struct,
- __u32 chunk_id,
+ u32 chunk_id,
yaffs_tnode_t *passed_tn);
-int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
+int yaffs_do_file_wr(yaffs_obj_t *in, const u8 *buffer, loff_t offset,
int n_bytes, int write_trhrough);
void yaffs_resize_file_down( yaffs_obj_t *obj, loff_t new_size);
void yaffs_skip_rest_of_block(yaffs_dev_t *dev);
yaffs_tnode_t *yaffs_find_tnode_0(yaffs_dev_t *dev,
yaffs_file_s *file_struct,
- __u32 chunk_id);
+ u32 chunk_id);
-__u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn, unsigned pos);
+u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn, unsigned pos);
#endif
struct task_struct *bg_thread; /* Background thread for this device */
int bg_running;
struct semaphore gross_lock; /* Gross locking semaphore */
- __u8 *spare_buffer; /* For mtdif2 use. Don't know the size of the buffer
+ u8 *spare_buffer; /* For mtdif2 use. Don't know the size of the buffer
* at compile time so we have to allocate it.
*/
struct ylist_head search_contexts;
* Returns YAFFS_OK or YAFFS_FAIL.
*/
int nandmtd1_write_chunk_tags(yaffs_dev_t *dev,
- int nand_chunk, const __u8 *data, const yaffs_ext_tags *etags)
+ int nand_chunk, const u8 *data, const yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int chunk_bytes = dev->data_bytes_per_chunk;
pt1.deleted = 0;
}
#else
- ((__u8 *)&pt1)[8] = 0xff;
+ ((u8 *)&pt1)[8] = 0xff;
if (etags->is_deleted) {
memset(&pt1, 0xff, 8);
/* zero page_status byte to indicate deleted */
- ((__u8 *)&pt1)[8] = 0;
+ ((u8 *)&pt1)[8] = 0;
}
#endif
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunk_bytes : 0;
ops.ooblen = YTAG1_SIZE;
- ops.datbuf = (__u8 *)data;
- ops.oobbuf = (__u8 *)&pt1;
+ ops.datbuf = (u8 *)data;
+ ops.oobbuf = (u8 *)&pt1;
retval = mtd->write_oob(mtd, addr, &ops);
if (retval) {
* Returns YAFFS_OK or YAFFS_FAIL.
*/
int nandmtd1_read_chunk_tags(yaffs_dev_t *dev,
- int nand_chunk, __u8 *data, yaffs_ext_tags *etags)
+ int nand_chunk, u8 *data, yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int chunk_bytes = dev->data_bytes_per_chunk;
ops.len = (data) ? chunk_bytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
- ops.oobbuf = (__u8 *)&pt1;
+ ops.oobbuf = (u8 *)&pt1;
/* Read page and oob using MTD.
* Check status and determine ECC result.
/* Check for a blank/erased chunk.
*/
- if (yaffs_check_ff((__u8 *)&pt1, 8)) {
+ if (yaffs_check_ff((u8 *)&pt1, 8)) {
/* when blank, upper layers want ecc_result to be <= NO_ERROR */
return rettags(etags, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_OK);
}
deleted = !pt1.deleted;
pt1.deleted = 1;
#else
- deleted = (yaffs_count_bits(((__u8 *)&pt1)[8]) < 7);
+ deleted = (yaffs_count_bits(((u8 *)&pt1)[8]) < 7);
#endif
/* Check the packed tags mini-ECC and correct if necessary/possible.
* Always returns YAFFS_OK.
*/
int nandmtd1_query_block(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state_ptr, __u32 *seq_ptr)
+ yaffs_block_state_t *state_ptr, u32 *seq_ptr)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int chunk_num = block_no * dev->param.chunks_per_block;
* use it to load the tags.
*/
int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *tags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
ops.len = dev->param.total_bytes_per_chunk;
ops.ooboffs = 0;
- ops.datbuf = (__u8 *)data;
+ ops.datbuf = (u8 *)data;
ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
retval = mtd->write_oob(mtd, addr, &ops);
}
int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- __u8 *data, yaffs_ext_tags *tags)
+ u8 *data, yaffs_ext_tags *tags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
struct mtd_oob_ops ops;
}
int nandmtd2_query_block(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state, __u32 *seq_number)
+ yaffs_block_state_t *state, u32 *seq_number)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int retval;
int nandmtd_erase_block(yaffs_dev_t *dev, int block_no)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- __u32 addr =
+ u32 addr =
((loff_t) block_no) * dev->param.total_bytes_per_chunk
* dev->param.chunks_per_block;
struct erase_info ei;
#define __YAFFS_MTDIF1_H__
int nandmtd1_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- const __u8 *data, const yaffs_ext_tags *tags);
+ const u8 *data, const yaffs_ext_tags *tags);
int nandmtd1_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- __u8 *data, yaffs_ext_tags *tags);
+ u8 *data, yaffs_ext_tags *tags);
int nandmtd1_mark_block_bad(struct yaffs_dev_s *dev, int block_no);
int nandmtd1_query_block(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state, __u32 *seq_number);
+ yaffs_block_state_t *state, u32 *seq_number);
#endif
#include "yaffs_guts.h"
int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *tags);
int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
- __u8 *data, yaffs_ext_tags *tags);
+ u8 *data, yaffs_ext_tags *tags);
int nandmtd2_mark_block_bad(struct yaffs_dev_s *dev, int block_no);
int nandmtd2_query_block(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *state, __u32 *seq_number);
+ yaffs_block_state_t *state, u32 *seq_number);
#endif
#include "yaffs_getblockinfo.h"
int yaffs_rd_chunk_tags_nand(yaffs_dev_t *dev, int nand_chunk,
- __u8 *buffer,
+ u8 *buffer,
yaffs_ext_tags *tags)
{
int result;
int yaffs_wr_chunk_tags_nand(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *buffer,
+ const u8 *buffer,
yaffs_ext_tags *tags)
{
int yaffs_query_init_block_state(yaffs_dev_t *dev,
int block_no,
yaffs_block_state_t *state,
- __u32 *seq_number)
+ u32 *seq_number)
{
block_no -= dev->block_offset;
int yaffs_rd_chunk_tags_nand(yaffs_dev_t *dev, int nand_chunk,
- __u8 *buffer,
+ u8 *buffer,
yaffs_ext_tags *tags);
int yaffs_wr_chunk_tags_nand(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *buffer,
+ const u8 *buffer,
yaffs_ext_tags *tags);
int yaffs_mark_bad(yaffs_dev_t *dev, int block_no);
void yaffs_unpack_tags1(yaffs_ext_tags *t, const yaffs_packed_tags1 *pt)
{
- static const __u8 all_ff[] =
+ static const u8 all_ff[] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff };
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
};
-int yaffs_count_bits(__u8 x)
+int yaffs_count_bits(u8 x)
{
int ret_val;
ret_val = yaffs_count_bits_table[x];
/********** Tags ECC calculations *********/
-void yaffs_calc_ecc(const __u8 *data, yaffs_spare *spare)
+void yaffs_calc_ecc(const u8 *data, yaffs_spare *spare)
{
yaffs_ecc_cacl(data, spare->ecc1);
yaffs_ecc_cacl(&data[256], spare->ecc2);
}
static int yaffs_wr_nand(struct yaffs_dev_s *dev,
- int nand_chunk, const __u8 *data,
+ int nand_chunk, const u8 *data,
yaffs_spare *spare)
{
if (nand_chunk < dev->param.start_block * dev->param.chunks_per_block) {
static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev,
int nand_chunk,
- __u8 *data,
+ u8 *data,
yaffs_spare *spare,
yaffs_ecc_result *ecc_result,
int correct_errors)
/* Do ECC correction */
/* Todo handle any errors */
int ecc_result1, ecc_result2;
- __u8 calc_ecc[3];
+ u8 calc_ecc[3];
yaffs_ecc_cacl(data, calc_ecc);
ecc_result1 =
int yaffs_tags_compat_wr(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *ext_tags)
{
yaffs_spare spare;
int yaffs_tags_compat_rd(yaffs_dev_t *dev,
int nand_chunk,
- __u8 *data,
+ u8 *data,
yaffs_ext_tags *ext_tags)
{
int yaffs_tags_compat_query_block(struct yaffs_dev_s *dev,
int block_no,
yaffs_block_state_t *state,
- __u32 *seq_number)
+ u32 *seq_number)
{
yaffs_spare spare0, spare1;
#include "yaffs_guts.h"
int yaffs_tags_compat_wr(yaffs_dev_t *dev,
int nand_chunk,
- const __u8 *data,
+ const u8 *data,
const yaffs_ext_tags *tags);
int yaffs_tags_compat_rd(yaffs_dev_t *dev,
int nand_chunk,
- __u8 *data,
+ u8 *data,
yaffs_ext_tags *tags);
int yaffs_tags_compat_mark_bad(struct yaffs_dev_s *dev,
int block_no);
int yaffs_tags_compat_query_block(struct yaffs_dev_s *dev,
int block_no,
yaffs_block_state_t *state,
- __u32 *seq_number);
+ u32 *seq_number);
void yaffs_calc_tags_ecc(yaffs_tags_t *tags);
int yaffs_check_tags_ecc(yaffs_tags_t *tags);
-int yaffs_count_bits(__u8 byte);
+int yaffs_count_bits(u8 byte);
#endif
(TSTR("Obj %d header name is NULL"TENDSTR),
obj->obj_id));
- if (tags->obj_id > 1 && ((__u8)(oh->name[0])) == 0xff) /* Trashed name */
+ if (tags->obj_id > 1 && ((u8)(oh->name[0])) == 0xff) /* Trashed name */
T(YAFFS_TRACE_VERIFY,
(TSTR("Obj %d header name is 0xFF"TENDSTR),
obj->obj_id));
{
int required_depth;
int actual_depth;
- __u32 last_chunk;
- __u32 x;
- __u32 i;
+ u32 last_chunk;
+ u32 x;
+ u32 i;
yaffs_dev_t *dev;
yaffs_ext_tags tags;
yaffs_tnode_t *tn;
- __u32 obj_id;
+ u32 obj_id;
if (!obj)
return;
tn = yaffs_find_tnode_0(dev, &obj->variant.file_variant, i);
if (tn) {
- __u32 the_chunk = yaffs_get_group_base(dev, tn, i);
+ u32 the_chunk = yaffs_get_group_base(dev, tn, i);
if (the_chunk > 0) {
/* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),obj_id,i,the_chunk)); */
yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL, &tags);
{
yaffs_dev_t *dev;
- __u32 chunk_min;
- __u32 chunk_max;
+ u32 chunk_min;
+ u32 chunk_max;
- __u32 chunk_id_ok;
- __u32 chunk_in_range;
- __u32 chunk_wrongly_deleted;
- __u32 chunk_valid;
+ u32 chunk_id_ok;
+ u32 chunk_in_range;
+ u32 chunk_wrongly_deleted;
+ u32 chunk_valid;
if (!obj)
return;
if (chunk_valid && !yaffs_skip_nand_verification(dev)) {
yaffs_ext_tags tags;
yaffs_obj_header *oh;
- __u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
+ u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
oh = (yaffs_obj_header *)buffer;
/* Check mode against the variant type and attempt to repair if broken. */
- __u32 mode = obj->yst_mode;
+ u32 mode = obj->yst_mode;
switch (obj->variant_type) {
case YAFFS_OBJECT_TYPE_FILE:
if (!S_ISREG(mode)) {
/* Check mode against the variant type and attempt to repair if broken. */
- __u32 mode = obj->yst_mode;
+ u32 mode = obj->yst_mode;
switch (obj->variant_type) {
case YAFFS_OBJECT_TYPE_FILE:
if (!S_ISREG(mode)) {
yaffs_block_state_t state;
yaffs_obj_t *hard_list = NULL;
yaffs_block_info_t *bi;
- __u32 seq_number;
+ u32 seq_number;
yaffs_obj_header *oh;
yaffs_obj_t *in;
yaffs_obj_t *parent;
struct yaffs_shadow_fixer_s *shadow_fixers = NULL;
- __u8 *chunk_data;
+ u8 *chunk_data;
* periodically finds the oldest full block by sequence number for refreshing.
* Only for yaffs2.
*/
-__u32 yaffs2_find_refresh_block(yaffs_dev_t *dev)
+u32 yaffs2_find_refresh_block(yaffs_dev_t *dev)
{
- __u32 b ;
+ u32 b ;
- __u32 oldest = 0;
- __u32 oldest_seq = 0;
+ u32 oldest = 0;
+ u32 oldest_seq = 0;
yaffs_block_info_t *bi;
n_bytes += sizeof(yaffs_checkpt_dev_t);
n_bytes += dev_blocks * sizeof(yaffs_block_info_t);
n_bytes += dev_blocks * dev->chunk_bit_stride;
- n_bytes += (sizeof(yaffs_checkpt_obj_t) + sizeof(__u32)) * (dev->n_obj);
- n_bytes += (dev->tnode_size + sizeof(__u32)) * (dev->n_tnodes);
+ n_bytes += (sizeof(yaffs_checkpt_obj_t) + sizeof(u32)) * (dev->n_obj);
+ n_bytes += (dev->tnode_size + sizeof(u32)) * (dev->n_tnodes);
n_bytes += sizeof(yaffs_checkpt_validty_t);
- n_bytes += sizeof(__u32); /* checksum*/
+ n_bytes += sizeof(u32); /* checksum*/
/* Round up and add 2 blocks to allow for some bad blocks, so add 3 */
static int yaffs2_wr_checkpt_dev(yaffs_dev_t *dev)
{
yaffs_checkpt_dev_t cp;
- __u32 n_bytes;
- __u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
+ u32 n_bytes;
+ u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
int ok;
static int yaffs2_rd_checkpt_dev(yaffs_dev_t *dev)
{
yaffs_checkpt_dev_t cp;
- __u32 n_bytes;
- __u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
+ u32 n_bytes;
+ u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
int ok;
static int yaffs2_checkpt_tnode_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
- __u32 level, int chunk_offset)
+ u32 level, int chunk_offset)
{
int i;
yaffs_dev_t *dev = in->my_dev;
}
}
} else if (level == 0) {
- __u32 base_offset = chunk_offset << YAFFS_TNODES_LEVEL0_BITS;
+ u32 base_offset = chunk_offset << YAFFS_TNODES_LEVEL0_BITS;
ok = (yaffs2_checkpt_wr(dev, &base_offset, sizeof(base_offset)) ==
sizeof(base_offset));
if (ok)
static int yaffs2_wr_checkpt_tnodes(yaffs_obj_t *obj)
{
- __u32 end_marker = ~0;
+ u32 end_marker = ~0;
int ok = 1;
if (obj->variant_type == YAFFS_OBJECT_TYPE_FILE) {
static int yaffs2_rd_checkpt_tnodes(yaffs_obj_t *obj)
{
- __u32 base_chunk;
+ u32 base_chunk;
int ok = 1;
yaffs_dev_t *dev = obj->my_dev;
yaffs_file_s *file_stuct_ptr = &obj->variant.file_variant;
static int yaffs2_wr_checkpt_sum(yaffs_dev_t *dev)
{
- __u32 checkpt_sum;
+ u32 checkpt_sum;
int ok;
yaffs2_get_checkpt_sum(dev, &checkpt_sum);
static int yaffs2_rd_checkpt_sum(yaffs_dev_t *dev)
{
- __u32 checkpt_sum0;
- __u32 checkpt_sum1;
+ u32 checkpt_sum0;
+ u32 checkpt_sum1;
int ok;
yaffs2_get_checkpt_sum(dev, &checkpt_sum0);
int result = YAFFS_OK;
yaffs_dev_t *dev = NULL;
- __u8 *local_buffer = NULL;
+ u8 *local_buffer = NULL;
int small_increase_ok = 0;
yaffs_block_state_t state;
yaffs_obj_t *hard_list = NULL;
yaffs_block_info_t *bi;
- __u32 seq_number;
+ u32 seq_number;
yaffs_obj_header *oh;
yaffs_obj_t *in;
yaffs_obj_t *parent;
int n_blocks = dev->internal_end_block - dev->internal_start_block + 1;
int is_unlinked;
- __u8 *chunk_data;
+ u8 *chunk_data;
int file_size;
int is_shrink;
} else if (tags.chunk_id > 0) {
/* chunk_id > 0 so it is a data chunk... */
unsigned int endpos;
- __u32 chunk_base =
+ u32 chunk_base =
(tags.chunk_id - 1) * dev->data_bytes_per_chunk;
found_chunks = 1;
oh->type == YAFFS_OBJECT_TYPE_FILE) ||
(tags.extra_available &&
tags.extra_obj_type == YAFFS_OBJECT_TYPE_FILE))) {
- __u32 this_size =
+ u32 this_size =
(oh) ? oh->file_size : tags.
extra_length;
- __u32 parent_obj_id =
+ u32 parent_obj_id =
(oh) ? oh->
parent_obj_id : tags.
extra_parent_id;
void yaffs2_clear_oldest_dirty_seq(yaffs_dev_t *dev, yaffs_block_info_t *bi);
void yaffs2_update_oldest_dirty_seq(yaffs_dev_t *dev, unsigned block_no, yaffs_block_info_t *bi);
int yaffs_block_ok_for_gc(yaffs_dev_t *dev, yaffs_block_info_t *bi);
-__u32 yaffs2_find_refresh_block(yaffs_dev_t *dev);
+u32 yaffs2_find_refresh_block(yaffs_dev_t *dev);
int yaffs2_checkpt_required(yaffs_dev_t *dev);
int yaffs_calc_checkpt_blocks_required(yaffs_dev_t *dev);