Skip to content

Commit

Permalink
Revert "yaffs: Sync with yaffs repo"
Browse files Browse the repository at this point in the history
This reverts commit 33aa12b.
  • Loading branch information
kmobs committed Aug 11, 2010
1 parent 33aa12b commit 701ff4c
Show file tree
Hide file tree
Showing 14 changed files with 6,386 additions and 3,989 deletions.
8 changes: 1 addition & 7 deletions fs/yaffs2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
obj-$(CONFIG_YAFFS_FS) += yaffs.o

yaffs-y := yaffs_ecc.o yaffs_fs.o yaffs_guts.o yaffs_checkptrw.o
yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o
yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o
yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o
yaffs-y += yaffs_mtdif.o yaffs_mtdif1.o yaffs_mtdif2.o
yaffs-y += yaffs_nameval.o
yaffs-y += yaffs_allocator.o
yaffs-y += yaffs_yaffs1.o
yaffs-y += yaffs_yaffs2.o
yaffs-y += yaffs_bitmap.o
yaffs-y += yaffs_verify.o
99 changes: 97 additions & 2 deletions fs/yaffs2/devextras.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#define __EXTRAS_H__


#include "yportenv.h"

#if !(defined __KERNEL__)

/* Definition of types */
Expand All @@ -35,6 +33,103 @@ typedef unsigned __u32;

#endif

/*
* This is a simple doubly linked list implementation that matches the
* way the Linux kernel doubly linked list implementation works.
*/

struct ylist_head {
struct ylist_head *next; /* next in chain */
struct ylist_head *prev; /* previous in chain */
};


/* Initialise a static list */
#define YLIST_HEAD(name) \
struct ylist_head name = { &(name), &(name)}



/* Initialise a list head to an empty list */
#define YINIT_LIST_HEAD(p) \
do { \
(p)->next = (p);\
(p)->prev = (p); \
} while (0)


/* Add an element to a list */
static __inline__ void ylist_add(struct ylist_head *newEntry,
struct ylist_head *list)
{
struct ylist_head *listNext = list->next;

list->next = newEntry;
newEntry->prev = list;
newEntry->next = listNext;
listNext->prev = newEntry;

}

static __inline__ void ylist_add_tail(struct ylist_head *newEntry,
struct ylist_head *list)
{
struct ylist_head *listPrev = list->prev;

list->prev = newEntry;
newEntry->next = list;
newEntry->prev = listPrev;
listPrev->next = newEntry;

}


/* Take an element out of its current list, with or without
* reinitialising the links.of the entry*/
static __inline__ void ylist_del(struct ylist_head *entry)
{
struct ylist_head *listNext = entry->next;
struct ylist_head *listPrev = entry->prev;

listNext->prev = listPrev;
listPrev->next = listNext;

}

static __inline__ void ylist_del_init(struct ylist_head *entry)
{
ylist_del(entry);
entry->next = entry->prev = entry;
}


/* Test if the list is empty */
static __inline__ int ylist_empty(struct ylist_head *entry)
{
return (entry->next == entry);
}


/* ylist_entry takes a pointer to a list entry and offsets it to that
* we can find a pointer to the object it is embedded in.
*/


#define ylist_entry(entry, type, member) \
((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member)))


/* ylist_for_each and list_for_each_safe iterate over lists.
* ylist_for_each_safe uses temporary storage to make the list delete safe
*/

#define ylist_for_each(itervar, list) \
for (itervar = (list)->next; itervar != (list); itervar = itervar->next)

#define ylist_for_each_safe(itervar, saveVar, list) \
for (itervar = (list)->next, saveVar = (list)->next->next; \
itervar != (list); itervar = saveVar, saveVar = saveVar->next)


#if !(defined __KERNEL__)

Expand Down
4 changes: 0 additions & 4 deletions fs/yaffs2/moduleconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
/* #define CONFIG_DISABLE_BACKGROUND */


/* Default: Selected */
/* Meaning: Enable XATTR support */
#define CONFIG_YAFFS_XATTR

/*
Older-style on-NAND data format has a "pageStatus" byte to record
chunk/page state. This byte is zeroed when the page is discarded.
Expand Down
36 changes: 18 additions & 18 deletions fs/yaffs2/yaffs_checkptrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "yaffs_checkptrw.h"
#include "yaffs_getblockinfo.h"

static int yaffs2_CheckpointSpaceOk(yaffs_Device *dev)
static int yaffs_CheckpointSpaceOk(yaffs_Device *dev)
{
int blocksAvailable = dev->nErasedBlocks - dev->param.nReservedBlocks;

Expand All @@ -26,7 +26,7 @@ static int yaffs2_CheckpointSpaceOk(yaffs_Device *dev)
}


static int yaffs2_CheckpointErase(yaffs_Device *dev)
static int yaffs_CheckpointErase(yaffs_Device *dev)
{
int i;

Expand Down Expand Up @@ -59,7 +59,7 @@ static int yaffs2_CheckpointErase(yaffs_Device *dev)
}


static void yaffs2_CheckpointFindNextErasedBlock(yaffs_Device *dev)
static void yaffs_CheckpointFindNextErasedBlock(yaffs_Device *dev)
{
int i;
int blocksAvailable = dev->nErasedBlocks - dev->param.nReservedBlocks;
Expand Down Expand Up @@ -87,7 +87,7 @@ static void yaffs2_CheckpointFindNextErasedBlock(yaffs_Device *dev)
dev->checkpointCurrentBlock = -1;
}

static void yaffs2_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
{
int i;
yaffs_ExtendedTags tags;
Expand Down Expand Up @@ -123,7 +123,7 @@ static void yaffs2_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
}


int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting)
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
{


Expand All @@ -136,7 +136,7 @@ int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting)
!dev->param.markNANDBlockBad)
return 0;

if (forWriting && !yaffs2_CheckpointSpaceOk(dev))
if (forWriting && !yaffs_CheckpointSpaceOk(dev))
return 0;

if (!dev->checkpointBuffer)
Expand All @@ -157,7 +157,7 @@ int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting)
if (forWriting) {
memset(dev->checkpointBuffer, 0, dev->nDataBytesPerChunk);
dev->checkpointByteOffset = 0;
return yaffs2_CheckpointErase(dev);
return yaffs_CheckpointErase(dev);
} else {
int i;
/* Set to a value that will kick off a read */
Expand All @@ -177,23 +177,23 @@ int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting)
return 1;
}

int yaffs2_GetCheckpointSum(yaffs_Device *dev, __u32 *sum)
int yaffs_GetCheckpointSum(yaffs_Device *dev, __u32 *sum)
{
__u32 compositeSum;
compositeSum = (dev->checkpointSum << 8) | (dev->checkpointXor & 0xFF);
*sum = compositeSum;
return 1;
}

static int yaffs2_CheckpointFlushBuffer(yaffs_Device *dev)
static int yaffs_CheckpointFlushBuffer(yaffs_Device *dev)
{
int chunk;
int realignedChunk;

yaffs_ExtendedTags tags;

if (dev->checkpointCurrentBlock < 0) {
yaffs2_CheckpointFindNextErasedBlock(dev);
yaffs_CheckpointFindNextErasedBlock(dev);
dev->checkpointCurrentChunk = 0;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ static int yaffs2_CheckpointFlushBuffer(yaffs_Device *dev)
}


int yaffs2_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes)
int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes)
{
int i = 0;
int ok = 1;
Expand Down Expand Up @@ -267,13 +267,13 @@ int yaffs2_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes)

if (dev->checkpointByteOffset < 0 ||
dev->checkpointByteOffset >= dev->nDataBytesPerChunk)
ok = yaffs2_CheckpointFlushBuffer(dev);
ok = yaffs_CheckpointFlushBuffer(dev);
}

return i;
}

int yaffs2_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
{
int i = 0;
int ok = 1;
Expand All @@ -298,7 +298,7 @@ int yaffs2_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
dev->checkpointByteOffset >= dev->nDataBytesPerChunk) {

if (dev->checkpointCurrentBlock < 0) {
yaffs2_CheckpointFindNextCheckpointBlock(dev);
yaffs_CheckpointFindNextCheckpointBlock(dev);
dev->checkpointCurrentChunk = 0;
}

Expand Down Expand Up @@ -348,12 +348,12 @@ int yaffs2_CheckpointRead(yaffs_Device *dev, void *data, int nBytes)
return i;
}

int yaffs2_CheckpointClose(yaffs_Device *dev)
int yaffs_CheckpointClose(yaffs_Device *dev)
{

if (dev->checkpointOpenForWrite) {
if (dev->checkpointByteOffset != 0)
yaffs2_CheckpointFlushBuffer(dev);
yaffs_CheckpointFlushBuffer(dev);
} else if(dev->checkpointBlockList){
int i;
for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) {
Expand Down Expand Up @@ -387,14 +387,14 @@ int yaffs2_CheckpointClose(yaffs_Device *dev)
return 0;
}

int yaffs2_CheckpointInvalidateStream(yaffs_Device *dev)
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev)
{
/* Erase the checkpoint data */

T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate of %d blocks"TENDSTR),
dev->blocksInCheckpoint));

return yaffs2_CheckpointErase(dev);
return yaffs_CheckpointErase(dev);
}


Expand Down
12 changes: 6 additions & 6 deletions fs/yaffs2/yaffs_checkptrw.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@

#include "yaffs_guts.h"

int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting);
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting);

int yaffs2_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes);
int yaffs_CheckpointWrite(yaffs_Device *dev, const void *data, int nBytes);

int yaffs2_CheckpointRead(yaffs_Device *dev, void *data, int nBytes);
int yaffs_CheckpointRead(yaffs_Device *dev, void *data, int nBytes);

int yaffs2_GetCheckpointSum(yaffs_Device *dev, __u32 *sum);
int yaffs_GetCheckpointSum(yaffs_Device *dev, __u32 *sum);

int yaffs2_CheckpointClose(yaffs_Device *dev);
int yaffs_CheckpointClose(yaffs_Device *dev);

int yaffs2_CheckpointInvalidateStream(yaffs_Device *dev);
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev);


#endif
Loading

0 comments on commit 701ff4c

Please sign in to comment.