#include "yaffs_nandif.h"\r
\r
\r
-#ifdef __WINCE__\r
-#include <windows.h>\r
-#else\r
-#define DebugBreak() do { } while(0)\r
-#endif\r
-\r
-\r
#define DATA_SIZE 2048\r
#define SPARE_SIZE 64\r
#define PAGE_SIZE (DATA_SIZE + SPARE_SIZE)\r
static int yramsim_EraseBlockInternal(SymData *sym, unsigned blockId,int force)\r
{\r
if(blockId < 0 || blockId >= sym->nBlocks){\r
- DebugBreak();\r
return 0;\r
}\r
\r
if(!sym->blockList[blockId]){\r
- DebugBreak();\r
return 0;\r
}\r
\r
if(!force && !sym->blockList[blockId]->blockOk){\r
- DebugBreak();\r
return 0;\r
}\r
\r
spareLength > SPARE_SIZE ||\r
!eccStatus ||\r
!blockList[blockId]->blockOk){\r
- DebugBreak();\r
return 0;\r
}\r
\r
dataLength >DATA_SIZE ||\r
spareLength > SPARE_SIZE ||\r
!blockList[blockId]->blockOk){\r
- DebugBreak();\r
return 0;\r
}\r
\r
SymData *sym = DevToSym(dev);\r
Block **blockList = sym->blockList;\r
if(blockId >= sym->nBlocks){\r
- DebugBreak();\r
return 0;\r
}\r
\r
SymData *sym = DevToSym(dev);\r
Block **blockList = sym->blockList;\r
if(blockId >= sym->nBlocks){\r
- DebugBreak();\r
return 0;\r
}\r
\r
#include "yramsim.h"
#include "yaffs_trace.h"
-
+#include "yaffsfs.h"
/* NB For use with inband tags....
return retVal;
}
-
+#ifndef CONFIG_YAFFS_WINCE
/* xattrib functions */
return retVal;
}
+#endif
#ifdef CONFIG_YAFFS_WINCE
int yaffs_get_wince_times(int fd, unsigned *wctime, unsigned *watime, unsigned *wmtime)
#endif
-static int yaffs_DoXMod(yaffs_Object *obj, int set, const char *name, const void *value, int size, int flags)
+static int yaffs_DoXMod(yaffs_Object *obj, int set, const YCHAR *name, const void *value, int size, int flags)
{
yaffs_XAttrMod xmod;
return retval;
}
-static int yaffs_DoXFetch(yaffs_Object *obj, const char *name, void *value, int size)
+static int yaffs_DoXFetch(yaffs_Object *obj, const YCHAR *name, void *value, int size)
{
char *buffer = NULL;
int result;
return retval;
}
-int yaffs_SetXAttribute(yaffs_Object *obj, const char *name, const void * value, int size, int flags)
+int yaffs_SetXAttribute(yaffs_Object *obj, const YCHAR *name, const void * value, int size, int flags)
{
return yaffs_DoXMod(obj, 1, name, value, size, flags);
}
-int yaffs_RemoveXAttribute(yaffs_Object *obj, const char *name)
+int yaffs_RemoveXAttribute(yaffs_Object *obj, const YCHAR *name)
{
return yaffs_DoXMod(obj, 0, name, NULL, 0, 0);
}
-int yaffs_GetXAttribute(yaffs_Object *obj, const char *name, void *value, int size)
+int yaffs_GetXAttribute(yaffs_Object *obj, const YCHAR *name, void *value, int size)
{
return yaffs_DoXFetch(obj, name, value, size);
}
struct yaffs_DeviceParamStruct {
- const char *name;
+ const YCHAR *name;
/*
* Entry parameters set up way early. Yaffs sets up the rest.
/* Structure for doing xattr modifications */
typedef struct {
int set; /* If 0 then this is a deletion */
- const char *name;
+ const YCHAR *name;
const void *data;
int size;
int flags;
* nbytes value.
* ----------
* total size stored in record size
+ *
+ * This code has not been tested with unicode yet.
*/
#include "yportenv.h"
-static int nval_find(const char *xb, int xb_size, const char *name,
+static int nval_find(const char *xb, int xb_size, const YCHAR *name,
int *exist_size)
{
int pos=0;
memcpy(&size,xb,sizeof(int));
while(size > 0 && (size < xb_size) && (pos + size < xb_size)){
- if(strncmp(xb+pos+sizeof(int),name,size) == 0){
+ if(yaffs_strncmp((YCHAR *)(xb+pos+sizeof(int)),name,size) == 0){
if(exist_size)
*exist_size = size;
return pos;
return pos;
}
-int nval_del(char *xb, int xb_size, const char *name)
+int nval_del(char *xb, int xb_size, const YCHAR *name)
{
int pos = nval_find(xb, xb_size, name, NULL);
int size;
return -ENODATA;
}
-int nval_set(char *xb, int xb_size, const char *name, const char *buf, int bsize, int flags)
+int nval_set(char *xb, int xb_size, const YCHAR *name, const char *buf, int bsize, int flags)
{
int pos;
- int namelen = strnlen(name,xb_size);
+ int namelen = yaffs_strnlen(name,xb_size);
int reclen;
int size_exist = 0;
int space;
memcpy(xb + pos,&reclen,sizeof(int));
pos +=sizeof(int);
- strncpy(xb + pos, name, reclen);
+ yaffs_strncpy((YCHAR *)(xb + pos), name, reclen);
pos+= (namelen+1);
memcpy(xb + pos,buf,bsize);
return 0;
}
-int nval_get(const char *xb, int xb_size, const char *name, char *buf, int bsize)
+int nval_get(const char *xb, int xb_size, const YCHAR *name, char *buf, int bsize)
{
int pos = nval_find(xb,xb_size,name,NULL);
int size;
while(size > sizeof(int) && size <= xb_size && (pos + size) < xb_size && !filled){
pos+= sizeof(int);
size-=sizeof(int);
- name_len = strnlen(xb + pos, size);
+ name_len = yaffs_strnlen((YCHAR *)(xb + pos), size);
if(ncopied + name_len + 1 < bsize){
- memcpy(buf,xb+pos,name_len);
+ memcpy(buf,xb+pos,name_len * sizeof(YCHAR));
buf+= name_len;
*buf = '\0';
buf++;
+ if(sizeof(YCHAR) > 1){
+ *buf = '\0';
+ buf++;
+ }
ncopied += (name_len+1);
} else
filled = 1;
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
+ */
#ifndef __NAMEVAL_H__
#define __NAMEVAL_H__
-int nval_del(char *xb, int xb_size, const char *name);
-int nval_set(char *xb, int xb_size, const char *name, const char *buf, int bsize, int flags);
-int nval_get(const char *xb, int xb_size, const char *name, char *buf, int bsize);
+#include "yportenv.h"
+
+int nval_del(char *xb, int xb_size, const YCHAR *name);
+int nval_set(char *xb, int xb_size, const YCHAR *name, const char *buf, int bsize, int flags);
+int nval_get(const char *xb, int xb_size, const YCHAR *name, char *buf, int bsize);
int nval_list(const char *xb, int xb_size, char *buf, int bsize);
int nval_load(char *xb, int xb_size, const char *src, int src_size);
int nval_save(const char *xb, int xb_size, char *dest, int dest_size);
return failed ? YAFFS_FAIL : YAFFS_OK;
#else
+ in=in;
return YAFFS_OK;
#endif
}