The attached patch is long but the bulk of it consists of adding yaffs_ in front of all the list_ bits so as to avoid name collision.
The remainder of it does the following:
1) Add initializers to variable declarations to get gcc to shut up about them.
2) Removes unused declarations to get gcc to shut up about them.
3) Changes some variable names in inner blocks to get gcc to shut up about aliasing
4) Changes a format to match types (%d -> %lu) to get gcc to shut up about wrong format strings.
5) Reference yaffs_qsort.h in yaffs_qsort.c to get gcc to shut up about no prototype.
6) Ifdef out a pair of functions in yaffs_guts.c that aren't used in NetBSD, using the new CONFIG_NETBSD flag
7) Add CONFIG_NETBSD flag and reference it in yportenv.h to cause ynetbsdenv.h to be included in a NetBSD build.
I have not included ynetbsdenv.h in the patch, as I am releasing the patch to Aleph1, but I don't yet have the authority to release parts of the actual netbsd port.
All of the changes made *should* be cosmetic on a yaffs Linux or yaffs direct port, but I don't have either to test against.
Marty
diff -ru /space/projects/aleph1/cvs/yaffs2/devextras.h ./devextras.h
--- /space/projects/aleph1/cvs/yaffs2/devextras.h 2007-02-12 08:55:25.000000000 -0800
+++ ./devextras.h 2007-10-03 21:21:01.000000000 -0700
@@ -28,7 +28,7 @@
#define new newHack
#endif
-#if !(defined __KERNEL__) || (defined WIN32)
+#if (defined CONFIG_YAFFS_NETBSD) || !(defined __KERNEL__) || (defined WIN32)
/* User space defines */
@@ -48,16 +48,16 @@
#define prefetch(x) 1
-struct list_head {
- struct list_head *next, *prev;
+struct yaffs_list_head {
+ struct yaffs_list_head *next, *prev;
};
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
+#define YAFFS_LIST_HEAD_INIT(name) { &(name), &(name) }
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
+#define YAFFS_LIST_HEAD(name) \
+ struct yaffs_list_head name = YAFFS_LIST_HEAD_INIT(name)
-#define INIT_LIST_HEAD(ptr) do { \
+#define INIT_YAFFS_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
@@ -67,9 +67,9 @@
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static __inline__ void __list_add(struct list_head *new,
- struct list_head *prev,
- struct list_head *next)
+static __inline__ void __yaffs_list_add(struct yaffs_list_head *new,
+ struct yaffs_list_head *prev,
+ struct yaffs_list_head *next)
{
next->prev = new;
new->next = next;
@@ -85,9 +85,9 @@
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
-static __inline__ void list_add(struct list_head *new, struct list_head *head)
+static __inline__ void yaffs_list_add(struct yaffs_list_head *new, struct yaffs_list_head *head)
{
- __list_add(new, head, head->next);
+ __yaffs_list_add(new, head, head->next);
}
/**
@@ -98,10 +98,10 @@
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
-static __inline__ void list_add_tail(struct list_head *new,
- struct list_head *head)
+static __inline__ void yaffs_list_add_tail(struct yaffs_list_head *new,
+ struct yaffs_list_head *head)
{
- __list_add(new, head->prev, head);
+ __yaffs_list_add(new, head->prev, head);
}
/*
@@ -111,8 +111,8 @@
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static __inline__ void __list_del(struct list_head *prev,
- struct list_head *next)
+static __inline__ void __yaffs_list_del(struct yaffs_list_head *prev,
+ struct yaffs_list_head *next)
{
next->prev = prev;
prev->next = next;
@@ -124,26 +124,26 @@
* Note: list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
-static __inline__ void list_del(struct list_head *entry)
+static __inline__ void yaffs_list_del(struct yaffs_list_head *entry)
{
- __list_del(entry->prev, entry->next);
+ __yaffs_list_del(entry->prev, entry->next);
}
/**
- * list_del_init - deletes entry from list and reinitialize it.
+ * yaffs_list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
-static __inline__ void list_del_init(struct list_head *entry)
+static __inline__ void yaffs_list_del_init(struct yaffs_list_head *entry)
{
- __list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
+ __yaffs_list_del(entry->prev, entry->next);
+ INIT_YAFFS_LIST_HEAD(entry);
}
/**
- * list_empty - tests whether a list is empty
+ * yaffs_list_empty - tests whether a list is empty
* @head: the list to test.
*/
-static __inline__ int list_empty(struct list_head *head)
+static __inline__ int yaffs_list_empty(struct yaffs_list_head *head)
{
return head->next == head;
}
@@ -153,14 +153,14 @@
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
-static __inline__ void list_splice(struct list_head *list,
- struct list_head *head)
+static __inline__ void yaffs_list_splice(struct yaffs_list_head *yaffs_list,
+ struct yaffs_list_head *head)
{
- struct list_head *first = list->next;
+ struct yaffs_list_head *first = yaffs_list->next;
- if (first != list) {
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
+ if (first != yaffs_list) {
+ struct yaffs_list_head *last = yaffs_list->prev;
+ struct yaffs_list_head *at = head->next;
first->prev = head;
head->next = first;
@@ -176,7 +176,7 @@
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
-#define list_entry(ptr, type, member) \
+#define yaffs_list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
/**
@@ -184,7 +184,7 @@
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
-#define list_for_each(pos, head) \
+#define yaffs_list_for_each(pos, head) \
for (pos = (head)->next, prefetch(pos->next); pos != (head); \
pos = pos->next, prefetch(pos->next))
@@ -195,7 +195,7 @@
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
-#define list_for_each_safe(pos, n, head) \
+#define yaffs_list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
@@ -248,7 +248,7 @@
#else
-#ifndef WIN32
+#ifdef LINUX
#include <linux/types.h>
#include <linux/list.h>
#include <linux/fs.h>
diff -ru /space/projects/aleph1/cvs/yaffs2/yaffs_guts.c ./yaffs_guts.c
--- /space/projects/aleph1/cvs/yaffs2/yaffs_guts.c 2007-10-29 12:28:21.000000000 -0700
+++ ./yaffs_guts.c 2007-10-30 12:47:16.000000000 -0700
@@ -76,7 +76,7 @@
int chunkOffset, int *limit);
static int yaffs_DoGenericObjectDeletion(yaffs_Object * in);
-static yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blockNo);
+yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blockNo);
static __u8 *yaffs_GetTempBuffer(yaffs_Device * dev, int lineNo);
static void yaffs_ReleaseTempBuffer(yaffs_Device * dev, __u8 * buffer,
@@ -264,10 +264,11 @@
}
+#if !defined CONFIG_YAFFS_NETBSD
/*
* Determine if we have a managed buffer.
*/
-int yaffs_IsManagedTempBuffer(yaffs_Device * dev, const __u8 * buffer)
+static int yaffs_IsManagedTempBuffer(yaffs_Device * dev, const __u8 * buffer)
{
int i;
for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) {
@@ -289,7 +290,7 @@
(TSTR("yaffs: unmaged buffer detected.\n" TENDSTR)));
return 0;
}
-
+#endif
/*
@@ -390,10 +391,12 @@
return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL));
}
+#if !defined CONFIG_YAFFS_NETBSD
static int yaffs_SkipFullVerification(yaffs_Device *dev)
{
return !(yaffs_traceMask & (YAFFS_TRACE_VERIFY_FULL));
}
+#endif
static int yaffs_SkipNANDVerification(yaffs_Device *dev)
{
@@ -597,7 +600,6 @@
int i;
yaffs_Device *dev = obj->myDev;
int ok = 1;
- int nTnodeBytes = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8;
if (tn) {
if (level > 0) {
@@ -611,13 +613,13 @@
}
}
} else if (level == 0) {
- int i;
+ int i0;
yaffs_ExtendedTags tags;
__u32 objectId = obj->objectId;
chunkOffset <<= YAFFS_TNODES_LEVEL0_BITS;
- for(i = 0; i < YAFFS_NTNODES_LEVEL0; i++){
+ for(i0 = 0; i0 < YAFFS_NTNODES_LEVEL0; i0++){
__u32 theChunk = yaffs_GetChunkGroupBase(dev,tn,i);
if(theChunk > 0){
@@ -646,7 +648,6 @@
__u32 lastChunk;
__u32 x;
__u32 i;
- int ok;
yaffs_Device *dev;
yaffs_ExtendedTags tags;
yaffs_Tnode *tn;
@@ -829,7 +830,7 @@
{
yaffs_Object *obj;
int i;
- struct list_head *lh;
+ struct yaffs_list_head *lh;
if(yaffs_SkipVerification(dev))
return;
@@ -837,9 +838,9 @@
/* Iterate through the objects in each hash entry */
for(i = 0; i < YAFFS_NOBJECT_BUCKETS; i++){
- list_for_each(lh, &dev->objectBucket[i].list) {
+ yaffs_list_for_each(lh, &dev->objectBucket[i].list) {
if (lh) {
- obj = list_entry(lh, yaffs_Object, hashLink);
+ obj = yaffs_list_entry(lh, yaffs_Object, hashLink);
yaffs_VerifyObject(obj);
}
}
@@ -1295,7 +1296,7 @@
}
-void yaffs_PutLevel0Tnode(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos, unsigned val)
+static void yaffs_PutLevel0Tnode(yaffs_Device *dev, yaffs_Tnode *tn, unsigned pos, unsigned val)
{
__u32 *map = (__u32 *)tn;
__u32 bitInMap;
@@ -1857,7 +1858,7 @@
/* Hook them into the free list */
for (i = 0; i < nObjects - 1; i++) {
newObjects[i].siblings.next =
- (struct list_head *)(&newObjects[i + 1]);
+ (struct yaffs_list_head *)(&newObjects[i + 1]);
}
newObjects[nObjects - 1].siblings.next = (void *)dev->freeObjects;
@@ -1897,9 +1898,9 @@
tn->myDev = dev;
tn->chunkId = -1;
tn->variantType = YAFFS_OBJECT_TYPE_UNKNOWN;
- INIT_LIST_HEAD(&(tn->hardLinks));
- INIT_LIST_HEAD(&(tn->hashLink));
- INIT_LIST_HEAD(&tn->siblings);
+ INIT_YAFFS_LIST_HEAD(&(tn->hardLinks));
+ INIT_YAFFS_LIST_HEAD(&(tn->hashLink));
+ INIT_YAFFS_LIST_HEAD(&tn->siblings);
/* Add it to the lost and found directory.
* NB Can't put root or lostNFound in lostNFound so
@@ -1940,8 +1941,8 @@
yaffs_Device *dev = tn->myDev;
/* If it is still linked into the bucket list, free from the list */
- if (!list_empty(&tn->hashLink)) {
- list_del_init(&tn->hashLink);
+ if (!yaffs_list_empty(&tn->hashLink)) {
+ yaffs_list_del_init(&tn->hashLink);
bucket = yaffs_HashFunction(tn->objectId);
dev->objectBucket[bucket].count--;
}
@@ -1967,7 +1968,7 @@
yaffs_UnhashObject(tn);
/* Link into the free list. */
- tn->siblings.next = (struct list_head *)(dev->freeObjects);
+ tn->siblings.next = (struct yaffs_list_head *)(dev->freeObjects);
dev->freeObjects = tn;
dev->nFreeObjects++;
}
@@ -2010,7 +2011,7 @@
dev->nFreeObjects = 0;
for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) {
- INIT_LIST_HEAD(&dev->objectBucket[i].list);
+ INIT_YAFFS_LIST_HEAD(&dev->objectBucket[i].list);
dev->objectBucket[i].count = 0;
}
@@ -2061,7 +2062,7 @@
*/
int found = 0;
- struct list_head *i;
+ struct yaffs_list_head *i;
__u32 n = (__u32) bucket;
@@ -2071,10 +2072,10 @@
found = 1;
n += YAFFS_NOBJECT_BUCKETS;
if (1 || dev->objectBucket[bucket].count > 0) {
- list_for_each(i, &dev->objectBucket[bucket].list) {
+ yaffs_list_for_each(i, &dev->objectBucket[bucket].list) {
/* If there is already one in the list */
if (i
- && list_entry(i, yaffs_Object,
+ && yaffs_list_entry(i, yaffs_Object,
hashLink)->objectId == n) {
found = 0;
}
@@ -2091,7 +2092,7 @@
int bucket = yaffs_HashFunction(in->objectId);
yaffs_Device *dev = in->myDev;
- list_add(&in->hashLink, &dev->objectBucket[bucket].list);
+ yaffs_list_add(&in->hashLink, &dev->objectBucket[bucket].list);
dev->objectBucket[bucket].count++;
}
@@ -2099,13 +2100,13 @@
yaffs_Object *yaffs_FindObjectByNumber(yaffs_Device * dev, __u32 number)
{
int bucket = yaffs_HashFunction(number);
- struct list_head *i;
+ struct yaffs_list_head *i;
yaffs_Object *in;
- list_for_each(i, &dev->objectBucket[bucket].list) {
+ yaffs_list_for_each(i, &dev->objectBucket[bucket].list) {
/* Look if it is in the list */
if (i) {
- in = list_entry(i, yaffs_Object, hashLink);
+ in = yaffs_list_entry(i, yaffs_Object, hashLink);
if (in->objectId == number) {
#ifdef __KERNEL__
/* Don't tell the VFS about this one if it is defered free */
@@ -2126,7 +2127,7 @@
{
yaffs_Object *theObject;
- yaffs_Tnode *tn;
+ yaffs_Tnode *tn = 0;
if (number < 0) {
number = yaffs_CreateNewObjectNumber(dev);
@@ -2174,7 +2175,7 @@
theObject->variant.fileVariant.top = tn;
break;
case YAFFS_OBJECT_TYPE_DIRECTORY:
- INIT_LIST_HEAD(&theObject->variant.directoryVariant.
+ INIT_YAFFS_LIST_HEAD(&theObject->variant.directoryVariant.
children);
break;
case YAFFS_OBJECT_TYPE_SYMLINK:
@@ -2241,7 +2242,7 @@
const YCHAR * aliasString, __u32 rdev)
{
yaffs_Object *in;
- YCHAR *str;
+ YCHAR *str = 0;
yaffs_Device *dev = parent->myDev;
@@ -2299,7 +2300,7 @@
equivalentObject;
in->variant.hardLinkVariant.equivalentObjectId =
equivalentObject->objectId;
- list_add(&in->hardLinks, &equivalentObject->hardLinks);
+ yaffs_list_add(&in->hardLinks, &equivalentObject->hardLinks);
break;
case YAFFS_OBJECT_TYPE_FILE:
case YAFFS_OBJECT_TYPE_DIRECTORY:
@@ -2460,7 +2461,7 @@
existingTarget = yaffs_FindObjectByName(newDir, newName);
if (existingTarget &&
existingTarget->variantType == YAFFS_OBJECT_TYPE_DIRECTORY &&
- !list_empty(&existingTarget->variant.directoryVariant.children)) {
+ !yaffs_list_empty(&existingTarget->variant.directoryVariant.children)) {
/* There is a target that is a non-empty directory, so we fail */
return YAFFS_FAIL; /* EEXIST or ENOTEMPTY */
} else if (existingTarget && existingTarget != obj) {
@@ -4318,7 +4319,7 @@
yaffs_CheckpointObject cp;
int i;
int ok = 1;
- struct list_head *lh;
+ struct yaffs_list_head *lh;
/* Iterate through the objects in each hash entry,
@@ -4326,9 +4327,9 @@
*/
for(i = 0; ok && i < YAFFS_NOBJECT_BUCKETS; i++){
- list_for_each(lh, &dev->objectBucket[i].list) {
+ yaffs_list_for_each(lh, &dev->objectBucket[i].list) {
if (lh) {
- obj = list_entry(lh, yaffs_Object, hashLink);
+ obj = yaffs_list_entry(lh, yaffs_Object, hashLink);
if (!obj->deferedFree) {
yaffs_ObjectToCheckpointObject(&cp,obj);
cp.structType = sizeof(cp);
@@ -4368,7 +4369,7 @@
while(ok && !done) {
ok = (yaffs_CheckpointRead(dev,&cp,sizeof(cp)) == sizeof(cp));
if(cp.structType != sizeof(cp)) {
- T(YAFFS_TRACE_CHECKPOINT,(TSTR("struct size %d instead of %d ok %d"TENDSTR),
+ T(YAFFS_TRACE_CHECKPOINT,(TSTR("struct size %d instead of %lu ok %d"TENDSTR),
cp.structType,sizeof(cp),ok));
ok = 0;
}
@@ -4386,7 +4387,7 @@
ok = yaffs_ReadCheckpointTnodes(obj);
} else if(obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) {
obj->hardLinks.next =
- (struct list_head *)
+ (struct yaffs_list_head *)
hardList;
hardList = obj;
}
@@ -4554,7 +4555,7 @@
yaffs_WriteCheckpointData(dev);
}
- T(YAFFS_TRACE_ALWAYS,(TSTR("save exit: isCheckpointed %d"TENDSTR),dev->isCheckpointed));
+ T(YAFFS_TRACE_CHECKPOINT,(TSTR("save exit: isCheckpointed %d"TENDSTR),dev->isCheckpointed));
return dev->isCheckpointed;
}
@@ -5147,7 +5148,7 @@
static int yaffs_DeleteDirectory(yaffs_Object * in)
{
/* First check that the directory is empty. */
- if (list_empty(&in->variant.directoryVariant.children)) {
+ if (yaffs_list_empty(&in->variant.directoryVariant.children)) {
return yaffs_DoGenericObjectDeletion(in);
}
@@ -5167,7 +5168,7 @@
/* remove this hardlink from the list assocaited with the equivalent
* object
*/
- list_del(&in->hardLinks);
+ yaffs_list_del(&in->hardLinks);
return yaffs_DoGenericObjectDeletion(in);
}
@@ -5199,7 +5200,7 @@
if (obj->variantType == YAFFS_OBJECT_TYPE_HARDLINK) {
return yaffs_DeleteHardLink(obj);
- } else if (!list_empty(&obj->hardLinks)) {
+ } else if (!yaffs_list_empty(&obj->hardLinks)) {
/* Curve ball: We're unlinking an object that has a hardlink.
*
* This problem arises because we are not strictly following
@@ -5218,10 +5219,10 @@
int retVal;
YCHAR name[YAFFS_MAX_NAME_LENGTH + 1];
- hl = list_entry(obj->hardLinks.next, yaffs_Object, hardLinks);
+ hl = yaffs_list_entry(obj->hardLinks.next, yaffs_Object, hardLinks);
- list_del_init(&hl->hardLinks);
- list_del_init(&hl->siblings);
+ yaffs_list_del_init(&hl->hardLinks);
+ yaffs_list_del_init(&hl->siblings);
yaffs_GetObjectName(hl, name, YAFFS_MAX_NAME_LENGTH + 1);
@@ -5328,13 +5329,13 @@
if (in) {
/* Add the hardlink pointers */
hl->variant.hardLinkVariant.equivalentObject = in;
- list_add(&hl->hardLinks, &in->hardLinks);
+ yaffs_list_add(&hl->hardLinks, &in->hardLinks);
} else {
/* Todo Need to report/handle this better.
* Got a problem... hardlink to a non-existant object
*/
hl->variant.hardLinkVariant.equivalentObject = NULL;
- INIT_LIST_HEAD(&hl->hardLinks);
+ INIT_YAFFS_LIST_HEAD(&hl->hardLinks);
}
@@ -5726,7 +5727,7 @@
/* Set up as a directory */
parent->variantType =
YAFFS_OBJECT_TYPE_DIRECTORY;
- INIT_LIST_HEAD(&parent->variant.
+ INIT_YAFFS_LIST_HEAD(&parent->variant.
directoryVariant.
children);
} else if (parent->variantType !=
@@ -5784,7 +5785,7 @@
equivalentObjectId =
oh->equivalentObjectId;
in->hardLinks.next =
- (struct list_head *)
+ (struct yaffs_list_head *)
hardList;
hardList = in;
break;
@@ -5843,16 +5844,16 @@
* just delete them.
*/
{
- struct list_head *i;
- struct list_head *n;
+ struct yaffs_list_head *i;
+ struct yaffs_list_head *n;
yaffs_Object *l;
/* Soft delete all the unlinked files */
- list_for_each_safe(i, n,
+ yaffs_list_for_each_safe(i, n,
&dev->unlinkedDir->variant.directoryVariant.
children) {
if (i) {
- l = list_entry(i, yaffs_Object, siblings);
+ l = yaffs_list_entry(i, yaffs_Object, siblings);
yaffs_DestroyObject(l);
}
}
@@ -6305,7 +6306,7 @@
(oh) ? oh->
parentObjectId : tags.
extraParentObjectId;
- unsigned isShrink =
+ unsigned isShrink0 =
(oh) ? oh->isShrink : tags.
extraIsShrinkHeader;
@@ -6320,7 +6321,7 @@
isShrink = 1;
}
- if (isShrink &&
+ if (isShrink0 &&
in->variant.fileVariant.
shrinkSize > thisSize) {
in->variant.fileVariant.
@@ -6328,7 +6329,7 @@
thisSize;
}
- if (isShrink) {
+ if (isShrink0) {
bi->hasShrinkHeader = 1;
}
@@ -6439,7 +6440,7 @@
/* Set up as a directory */
parent->variantType =
YAFFS_OBJECT_TYPE_DIRECTORY;
- INIT_LIST_HEAD(&parent->variant.
+ INIT_YAFFS_LIST_HEAD(&parent->variant.
directoryVariant.
children);
} else if (parent->variantType !=
@@ -6503,7 +6504,7 @@
in->variant.hardLinkVariant.equivalentObjectId =
equivalentObjectId;
in->hardLinks.next =
- (struct list_head *) hardList;
+ (struct yaffs_list_head *) hardList;
hardList = in;
}
break;
@@ -6563,27 +6564,27 @@
* Sort out state of unlinked and deleted objects.
*/
{
- struct list_head *i;
- struct list_head *n;
+ struct yaffs_list_head *i;
+ struct yaffs_list_head *n;
yaffs_Object *l;
/* Soft delete all the unlinked files */
- list_for_each_safe(i, n,
+ yaffs_list_for_each_safe(i, n,
&dev->unlinkedDir->variant.directoryVariant.
children) {
if (i) {
- l = list_entry(i, yaffs_Object, siblings);
+ l = yaffs_list_entry(i, yaffs_Object, siblings);
yaffs_DestroyObject(l);
}
}
/* Soft delete all the deletedDir files */
- list_for_each_safe(i, n,
+ yaffs_list_for_each_safe(i, n,
&dev->deletedDir->variant.directoryVariant.
children) {
if (i) {
- l = list_entry(i, yaffs_Object, siblings);
+ l = yaffs_list_entry(i, yaffs_Object, siblings);
yaffs_DestroyObject(l);
}
@@ -6610,7 +6611,7 @@
if(dev && dev->removeObjectCallback)
dev->removeObjectCallback(obj);
- list_del_init(&obj->siblings);
+ yaffs_list_del_init(&obj->siblings);
obj->parent = NULL;
}
@@ -6636,14 +6637,14 @@
if (obj->siblings.prev == NULL) {
/* Not initialised */
- INIT_LIST_HEAD(&obj->siblings);
+ INIT_YAFFS_LIST_HEAD(&obj->siblings);
- } else if (!list_empty(&obj->siblings)) {
+ } else if (!yaffs_list_empty(&obj->siblings)) {
/* If it is holed up somewhere else, un hook it */
yaffs_RemoveObjectFromDirectory(obj);
}
/* Now add it */
- list_add(&obj->siblings, &directory->variant.directoryVariant.children);
+ yaffs_list_add(&obj->siblings, &directory->variant.directoryVariant.children);
obj->parent = directory;
if (directory == obj->myDev->unlinkedDir
@@ -6659,7 +6660,7 @@
{
int sum;
- struct list_head *i;
+ struct yaffs_list_head *i;
YCHAR buffer[YAFFS_MAX_NAME_LENGTH + 1];
yaffs_Object *l;
@@ -6684,9 +6685,9 @@
sum = yaffs_CalcNameSum(name);
- list_for_each(i, &directory->variant.directoryVariant.children) {
+ yaffs_list_for_each(i, &directory->variant.directoryVariant.children) {
if (i) {
- l = list_entry(i, yaffs_Object, siblings);
+ l = yaffs_list_entry(i, yaffs_Object, siblings);
yaffs_CheckObjectDetailsLoaded(l);
@@ -6718,7 +6719,7 @@
int yaffs_ApplyToDirectoryChildren(yaffs_Object * theDir,
int (*fn) (yaffs_Object *))
{
- struct list_head *i;
+ struct yaffs_list_head *i;
yaffs_Object *l;
if (!theDir) {
@@ -6735,9 +6736,9 @@
YBUG();
}
- list_for_each(i, &theDir->variant.directoryVariant.children) {
+ yaffs_list_for_each(i, &theDir->variant.directoryVariant.children) {
if (i) {
- l = list_entry(i, yaffs_Object, siblings);
+ l = yaffs_list_entry(i, yaffs_Object, siblings);
if (l && !fn(l)) {
return YAFFS_FAIL;
}
@@ -6826,12 +6827,12 @@
int yaffs_GetObjectLinkCount(yaffs_Object * obj)
{
int count = 0;
- struct list_head *i;
+ struct yaffs_list_head *i;
if (!obj->unlinked) {
count++; /* the object itself */
}
- list_for_each(i, &obj->hardLinks) {
+ yaffs_list_for_each(i, &obj->hardLinks) {
count++; /* add the hard links; */
}
return count;
@@ -7215,8 +7216,10 @@
dev->nShortOpCaches = YAFFS_MAX_SHORT_OP_CACHES;
}
- buf = dev->srCache = YMALLOC(srCacheBytes);
-
+ dev->srCache = (yaffs_ChunkCache *)YMALLOC(srCacheBytes);
+
+ buf = (__u8 *)dev->srCache;
+
if(dev->srCache)
memset(dev->srCache,0,srCacheBytes);
@@ -7455,7 +7458,7 @@
#define yaffs_CheckStruct(structure,syze, name) \
if(sizeof(structure) != syze) \
{ \
- T(YAFFS_TRACE_ALWAYS,(TSTR("%s should be %d but is %d\n" TENDSTR),\
+ T(YAFFS_TRACE_ALWAYS,(TSTR("%s should be %d but is %lu\n" TENDSTR),\
name,syze,sizeof(structure))); \
return YAFFS_FAIL; \
}
diff -ru /space/projects/aleph1/cvs/yaffs2/yaffs_guts.h ./yaffs_guts.h
--- /space/projects/aleph1/cvs/yaffs2/yaffs_guts.h 2007-07-18 12:40:38.000000000 -0700
+++ ./yaffs_guts.h 2007-10-30 13:51:15.000000000 -0700
@@ -381,7 +381,7 @@
} yaffs_FileStructure;
typedef struct {
- struct list_head children; /* list of child links */
+ struct yaffs_list_head children; /* list of child links */
} yaffs_DirectoryStructure;
typedef struct {
@@ -424,14 +424,14 @@
struct yaffs_DeviceStruct *myDev; /* The device I'm on */
- struct list_head hashLink; /* list of objects in this hash bucket */
+ struct yaffs_list_head hashLink; /* list of objects in this hash bucket */
- struct list_head hardLinks; /* all the equivalent hard linked objects */
+ struct yaffs_list_head hardLinks; /* all the equivalent hard linked objects */
/* directory structure stuff */
/* also used for linking up the free list */
struct yaffs_ObjectStruct *parent;
- struct list_head siblings;
+ struct yaffs_list_head siblings;
/* Where's my object header in NAND? */
int chunkId;
@@ -485,7 +485,7 @@
typedef struct yaffs_ObjectList_struct yaffs_ObjectList;
typedef struct {
- struct list_head list;
+ struct yaffs_list_head list;
int count;
} yaffs_ObjectBucket;
@@ -528,7 +528,7 @@
/*----------------- Device ---------------------------------*/
struct yaffs_DeviceStruct {
- struct list_head devList;
+ struct yaffs_list_head devList;
const char *name;
/* Entry parameters set up way early. Yaffs sets up the rest.*/
@@ -798,6 +798,7 @@
} yaffs_CheckpointValidity;
/* Function to manipulate block info */
+static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk);
static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk)
{
if (blk < dev->internalStartBlock || blk > dev->internalEndBlock) {
diff -ru /space/projects/aleph1/cvs/yaffs2/yaffs_qsort.c ./yaffs_qsort.c
--- /space/projects/aleph1/cvs/yaffs2/yaffs_qsort.c 2007-07-18 12:40:38.000000000 -0700
+++ ./yaffs_qsort.c 2007-09-28 15:03:11.000000000 -0700
@@ -28,7 +28,7 @@
*/
#include "yportenv.h"
-//#include <linux/string.h>
+#include "yaffs_qsort.h"
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
diff -ru /space/projects/aleph1/cvs/yaffs2/yaffs_tagscompat.c ./yaffs_tagscompat.c
--- /space/projects/aleph1/cvs/yaffs2/yaffs_tagscompat.c 2007-07-18 12:40:38.000000000 -0700
+++ ./yaffs_tagscompat.c 2007-10-26 11:32:55.000000000 -0700
@@ -54,7 +54,7 @@
/********** Tags ECC calculations *********/
-void yaffs_CalcECC(const __u8 * data, yaffs_Spare * spare)
+static void yaffs_CalcECC(const __u8 * data, yaffs_Spare * spare)
{
yaffs_ECCCalculate(data, spare->ecc1);
yaffs_ECCCalculate(&data[256], spare->ecc2);
@@ -435,7 +435,7 @@
yaffs_Spare spare;
yaffs_Tags tags;
- yaffs_ECCResult eccResult;
+ yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_NO_ERROR;
static yaffs_Spare spareFF;
static int init;
diff -ru /space/projects/aleph1/cvs/yaffs2/yportenv.h ./yportenv.h
--- /space/projects/aleph1/cvs/yaffs2/yportenv.h 2007-10-01 15:23:53.000000000 -0700
+++ ./yportenv.h 2007-10-26 11:12:05.000000000 -0700
@@ -88,6 +90,10 @@
#define compile_time_assertion(assertion) \
({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
+#elif defined CONFIG_YAFFS_NETBSD
+
+#include "ynetbsdenv.h"
+
#elif defined CONFIG_YAFFS_DIRECT
/* Direct interface */