Skip to content

Commit

Permalink
yaffs: Sync with yaffs repo
Browse files Browse the repository at this point in the history
Merge recent changes by Charles Manning for yaffs and
2.6.34 kernel, including:

commit 10baaa5
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Skip checkpoint writing if mounted readonly

commit 4c78eb9
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Batter read-only support handling

commit ca04740
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Fix return value for yaffs direct sync

commit 66dfee0
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Add new follow link code for 2.6.34 support

commit 1079104
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs  Fix yaffs1 soft delete issue

commit 570d9b8
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs  Changes to direct tests

commit 9d8bb3a
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Get fuzz tester to run further

commit 2d221c0
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Fix issues kicked up by fuzz testing

commit d22f345
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Implement phase 1 fuzz testing.

commit 497c3cf
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Update RAM simulator to support start and end blocks

commit 2597593
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs: Fix AutoUnicode handling

commit a6fbf61
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Fix yaffs direct creating opening files with no name

commit 505255d
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Add another test to basic tests

commit 993de0d
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Keep unused linux alloactor code up to date

commit 2da4395
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Fix in-kernel makefile to use correct allocator

commit 32b9c53
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Fix xattrib headers for use with unicode

commit 227cbf5
Author: Charles Manning <cdhmanning@gmail.com>

    yaffs Move yaffscfg.h to where it should be

And more from http://yaffs.net/gitweb?p=yaffs2/.git
  • Loading branch information
Patrick Jacques authored and kmobs committed Aug 11, 2010
1 parent ab59ed6 commit 33aa12b
Show file tree
Hide file tree
Showing 14 changed files with 3,946 additions and 6,343 deletions.
8 changes: 7 additions & 1 deletion fs/yaffs2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
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_qsort.o
yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.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: 2 additions & 97 deletions fs/yaffs2/devextras.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define __EXTRAS_H__


#include "yportenv.h"

#if !(defined __KERNEL__)

/* Definition of types */
Expand All @@ -33,103 +35,6 @@ 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: 4 additions & 0 deletions fs/yaffs2/moduleconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
/* #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 yaffs_CheckpointSpaceOk(yaffs_Device *dev)
static int yaffs2_CheckpointSpaceOk(yaffs_Device *dev)
{
int blocksAvailable = dev->nErasedBlocks - dev->param.nReservedBlocks;

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


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

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


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

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


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


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

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

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

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

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

yaffs_ExtendedTags tags;

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

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


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

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

return i;
}

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

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

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

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

if (dev->checkpointOpenForWrite) {
if (dev->checkpointByteOffset != 0)
yaffs_CheckpointFlushBuffer(dev);
yaffs2_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 yaffs_CheckpointClose(yaffs_Device *dev)
return 0;
}

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

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

return yaffs_CheckpointErase(dev);
return yaffs2_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 yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting);
int yaffs2_CheckpointOpen(yaffs_Device *dev, int forWriting);

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

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

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

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

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


#endif
Loading

0 comments on commit 33aa12b

Please sign in to comment.