+++ /dev/null
-/*
- * 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.
- */
-
-/*
- * This file is just holds extra declarations of macros that would normally
- * be providesd in the Linux kernel. These macros have been written from
- * scratch but are functionally equivalent to the Linux ones.
- *
- */
-
-#ifndef __EXTRAS_H__
-#define __EXTRAS_H__
-
-
-#include "yportenv.h"
-
-#if !(defined __KERNEL__)
-
-/* Definition of types */
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned u32;
-
-#endif
-
-
-#if !(defined __KERNEL__)
-
-
-#ifndef WIN32
-#include <sys/stat.h>
-#endif
-
-
-#ifdef CONFIG_YAFFS_PROVIDE_DEFS
-/* File types */
-
-
-#define DT_UNKNOWN 0
-#define DT_FIFO 1
-#define DT_CHR 2
-#define DT_DIR 4
-#define DT_BLK 6
-#define DT_REG 8
-#define DT_LNK 10
-#define DT_SOCK 12
-#define DT_WHT 14
-
-
-#ifndef WIN32
-#include <sys/stat.h>
-#endif
-
-/*
- * Attribute flags. These should be or-ed together to figure out what
- * has been changed!
- */
-#define ATTR_MODE 1
-#define ATTR_UID 2
-#define ATTR_GID 4
-#define ATTR_SIZE 8
-#define ATTR_ATIME 16
-#define ATTR_MTIME 32
-#define ATTR_CTIME 64
-
-struct iattr {
- unsigned int ia_valid;
- unsigned ia_mode;
- unsigned ia_uid;
- unsigned ia_gid;
- unsigned ia_size;
- unsigned ia_atime;
- unsigned ia_mtime;
- unsigned ia_ctime;
- unsigned int ia_attr_flags;
-};
-
-#endif
-
-#else
-
-#include <linux/types.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-
-#endif
-
-
-#endif
ALLOBJS = $(sort $(YAFFSTESTOBJS))
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
+YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \
yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \
yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.h yaffs_trace.h \
+ yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
yaffsfs.h yaffs_malloc.h ydirectenv.h \
yaffs_flashif.c yaffscfg.h yaffs_list.h \
- yaffs_qsort.c \
+ yaffs_qsort.c yportenv.h \
yaffs_nandif.c yaffs_nandif.h yaffs_nandemul2k.h
#include "yaffs_flashif.h"
#include "yaffs_guts.h"
-#include "devextras.h"
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "yaffs_flashif2.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "yaffs_flashif.h"
#include "yaffs_guts.h"
-#include "devextras.h"
-
#define SPARE_BYTES_PER_CHUNK 16
#define M18_SKIP 16
#define PROG_REGION_SIZE 1024
#include "yaffs_ramdisk.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#include "yaffs_packedtags1.h"
#include "yaffs_nandemul2k.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#include "yaffs_packedtags2.h"
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
+YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \
yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \
yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.h yaffs_trace.h \
+ yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
YAFFSDIRECTSYMLINKS = yaffsfs.c yaffsfs.h yaffscfg.h yaffs_malloc.h ydirectenv.h \
yaffs_flashif.c yaffs_flashif.h yaffs_flashif2.h yaffs_list.h \
- yaffs_nandif.c yaffs_nandif.h yaffs_qsort.c yaffs_nandemul2k.h
+ yaffs_nandif.c yaffs_nandif.h yaffs_qsort.c yaffs_nandemul2k.h \
+ yportenv.h
DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \
ALLOBJS = $(sort $(YAFFSTESTOBJS))
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
+YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \
yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \
yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.h yaffs_trace.h \
+ yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
yaffsfs.h yaffs_malloc.h ydirectenv.h \
yaffs_flashif.c yaffscfg.h yaffs_qsort.c \
yaffs_nandemul2k.h yaffs_list.h \
- yaffs_nandif.c yaffs_nandif.h
+ yaffs_nandif.c yaffs_nandif.h yportenv.h
DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
#include "yaffs_flashif.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#define SIZE_IN_MB 16
#include "yportenv.h"
#include "yaffs_guts.h"
-#include "devextras.h"
#include "yaffs_nandif.h"
#define __YAFFSCFG_H__
-#include "yportenv.h"
-#include "devextras.h"
+#include "yportenv.h"
#define YAFFSFS_N_HANDLES 100
#define yaffs_sprintf sprintf
#define yaffs_toupper(a) toupper(a)
+void yaffs_qsort(void *aa, size_t n, size_t es,
+ int (*cmp)(const void *, const void *));
+
+#define yaffs_sort(base, n, sz, cmp_fn) yaffs_qsort(base, n, sz, cmp_fn)
+
#define YAFFS_PATH_DIVIDERS "/"
#ifdef NO_Y_INLINE
--- /dev/null
+/*
+ * 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 __YPORTENV_H__
+#define __YPORTENV_H__
+
+/*
+ * Define the MTD version in terms of Linux Kernel versions
+ * This allows yaffs to be used independantly of the kernel
+ * as well as with it.
+ */
+
+
+#if defined CONFIG_YAFFS_WINCE
+
+#include "ywinceenv.h"
+
+
+#elif defined CONFIG_YAFFS_DIRECT
+
+/* Direct interface */
+#include "ydirectenv.h"
+
+#elif defined CONFIG_YAFFS_UTIL
+
+/* Stuff for YAFFS utilities */
+
+#include "stdlib.h"
+#include "stdio.h"
+#include "string.h"
+
+
+#define YMALLOC(x) malloc(x)
+#define YFREE(x) free(x)
+#define YMALLOC_ALT(x) malloc(x)
+#define YFREE_ALT(x) free(x)
+
+#define YCHAR char
+#define YUCHAR unsigned char
+#define _Y(x) x
+#define yaffs_strcat(a, b) strcat(a, b)
+#define yaffs_strcpy(a, b) strcpy(a, b)
+#define yaffs_strncpy(a, b, c) strncpy(a, b, c)
+#define yaffs_strnlen(s,m) strnlen(s,m)
+#define yaffs_sprintf sprintf
+#define yaffs_toupper(a) toupper(a)
+
+#define Y_INLINE inline
+
+/* #define YINFO(s) YPRINTF(( __FILE__ " %d %s\n",__LINE__,s)) */
+/* #define YALERT(s) YINFO(s) */
+
+#define TENDSTR "\n"
+#define TSTR(x) x
+#define TOUT(p) printf p
+
+#define YAFFS_LOSTNFOUND_NAME "lost+found"
+#define YAFFS_LOSTNFOUND_PREFIX "obj"
+/* #define YPRINTF(x) printf x */
+
+#define YAFFS_ROOT_MODE 0755
+#define YAFFS_LOSTNFOUND_MODE 0700
+
+#define yaffs_sum_cmp(x, y) ((x) == (y))
+#define yaffs_strcmp(a, b) strcmp(a, b)
+
+#else
+/* Should have specified a configuration type */
+#error Unknown configuration
+
+#endif
+
+#if defined(CONFIG_YAFFS_DIRECT) || defined(CONFIG_YAFFS_WINCE)
+
+#ifdef CONFIG_YAFFSFS_PROVIDE_VALUES
+
+#ifndef O_RDONLY
+#define O_RDONLY 00
+#endif
+
+#ifndef O_WRONLY
+#define O_WRONLY 01
+#endif
+
+#ifndef O_RDWR
+#define O_RDWR 02
+#endif
+
+#ifndef O_CREAT
+#define O_CREAT 0100
+#endif
+
+#ifndef O_EXCL
+#define O_EXCL 0200
+#endif
+
+#ifndef O_TRUNC
+#define O_TRUNC 01000
+#endif
+
+#ifndef O_APPEND
+#define O_APPEND 02000
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+
+#ifndef SEEK_END
+#define SEEK_END 2
+#endif
+
+#ifndef EBUSY
+#define EBUSY 16
+#endif
+
+#ifndef ENODEV
+#define ENODEV 19
+#endif
+
+#ifndef EINVAL
+#define EINVAL 22
+#endif
+
+#ifndef ENFILE
+#define ENFILE 23
+#endif
+
+#ifndef EBADF
+#define EBADF 9
+#endif
+
+#ifndef EACCES
+#define EACCES 13
+#endif
+
+#ifndef EXDEV
+#define EXDEV 18
+#endif
+
+#ifndef ENOENT
+#define ENOENT 2
+#endif
+
+#ifndef ENOSPC
+#define ENOSPC 28
+#endif
+
+#ifndef ERANGE
+#define ERANGE 34
+#endif
+
+#ifndef ENODATA
+#define ENODATA 61
+#endif
+
+#ifndef ENOTEMPTY
+#define ENOTEMPTY 39
+#endif
+
+#ifndef ENAMETOOLONG
+#define ENAMETOOLONG 36
+#endif
+
+#ifndef ENOMEM
+#define ENOMEM 12
+#endif
+
+#ifndef EEXIST
+#define EEXIST 17
+#endif
+
+#ifndef ENOTDIR
+#define ENOTDIR 20
+#endif
+
+#ifndef EISDIR
+#define EISDIR 21
+#endif
+
+
+// Mode flags
+
+#ifndef S_IFMT
+#define S_IFMT 0170000
+#endif
+
+#ifndef S_IFLNK
+#define S_IFLNK 0120000
+#endif
+
+#ifndef S_IFDIR
+#define S_IFDIR 0040000
+#endif
+
+#ifndef S_IFREG
+#define S_IFREG 0100000
+#endif
+
+#ifndef S_IREAD
+#define S_IREAD 0000400
+#endif
+
+#ifndef S_IWRITE
+#define S_IWRITE 0000200
+#endif
+
+#ifndef S_IEXEC
+#define S_IEXEC 0000100
+#endif
+
+#ifndef XATTR_CREATE
+#define XATTR_CREATE 1
+#endif
+
+#ifndef XATTR_REPLACE
+#define XATTR_REPLACE 2
+#endif
+
+#ifndef R_OK
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_OK 0
+#endif
+
+#else
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
+
+#endif
+
+#ifndef Y_DUMP_STACK
+#define Y_DUMP_STACK() do { } while (0)
+#endif
+
+#ifndef YBUG
+#define YBUG() do {\
+ T(YAFFS_TRACE_BUG,\
+ (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\
+ __LINE__));\
+ Y_DUMP_STACK();\
+} while (0)
+#endif
+
+
+#endif
+
+/*
+ * 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.
+ */
+
+/*
+ * This file is just holds extra declarations of macros that would normally
+ * be provided in the Linux kernel. These macros have been written from
+ * scratch but are functionally equivalent to the Linux ones.
+ *
+ */
+
+#ifndef __EXTRAS_H__
+#define __EXTRAS_H__
+
+
+/* Definition of types */
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned u32;
+
+
+#ifndef WIN32
+#include <sys/stat.h>
+#endif
+
+
+#ifdef CONFIG_YAFFS_PROVIDE_DEFS
+/* File types */
+
+
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+
+#ifndef WIN32
+#include <sys/stat.h>
+#endif
+
+/*
+ * Attribute flags. These should be or-ed together to figure out what
+ * has been changed!
+ */
+#define ATTR_MODE 1
+#define ATTR_UID 2
+#define ATTR_GID 4
+#define ATTR_SIZE 8
+#define ATTR_ATIME 16
+#define ATTR_MTIME 32
+#define ATTR_CTIME 64
+
+struct iattr {
+ unsigned int ia_valid;
+ unsigned ia_mode;
+ unsigned ia_uid;
+ unsigned ia_gid;
+ unsigned ia_size;
+ unsigned ia_atime;
+ unsigned ia_mtime;
+ unsigned ia_ctime;
+ unsigned int ia_attr_flags;
+};
+
+#endif
+
+
+
+#endif
VFS_CODE="yaffs_vfs_multi.c"
MTD1_CODE="yaffs_mtdif1_multi.c"
MTD2_CODE="yaffs_mtdif2_multi.c"
+ YPORTENV="yportenv_multi.h"
elif [ $MULTIORSINGLE = s ]; then
VFS_CODE="yaffs_vfs_single.c"
MTD1_CODE="yaffs_mtdif1_single.c"
MTD2_CODE="yaffs_mtdif2_single.c"
+ YPORTENV="yportenv_single.h"
echo ""
echo "*** Warning ***"
$CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2
$CPY $PWD/*.c $PWD/*.h $LINUXDIR/fs/yaffs2
rm $LINUXDIR/fs/yaffs2/yaffs_vfs*.c $LINUXDIR/fs/yaffs2/yaffs_mtdif[12]*.c
+ rm $LINUXDIR/fs/yaffs2/yportenv*.h
$CPY $PWD/$VFS_CODE $LINUXDIR/fs/yaffs2/yaffs_vfs.c
$CPY $PWD/$MTD1_CODE $LINUXDIR/fs/yaffs2/yaffs_mtdif1.c
$CPY $PWD/$MTD2_CODE $LINUXDIR/fs/yaffs2/yaffs_mtdif2.c
+ $CPY $PWD/$YPORTENV $LINUXDIR/fs/yaffs2/yportenv.h
fi
static int yaffs_apply_xattrib_mod(struct yaffs_obj *obj, char *buffer, struct yaffs_xattr_mod *xmod);
static void yaffs_remove_obj_from_dir(struct yaffs_obj *obj);
-static int yaffs_check_structures(void);
static int yaffs_generic_obj_del(struct yaffs_obj *in);
static int yaffs_check_chunk_erased(struct yaffs_dev *dev,
return YAFFS_FAIL;
}
- /* This is really a compilation check. */
- if (!yaffs_check_structures()) {
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs_check_structures failed\n" TENDSTR)));
- return YAFFS_FAIL;
- }
-
if (dev->is_mounted) {
T(YAFFS_TRACE_ALWAYS,
(TSTR("yaffs: device already mounted\n" TENDSTR)));
return n_free;
}
-
-
-/*---------------------------------------- YAFFS test code ----------------------*/
-
-#define yaffs_check_struct(structure, syze, name) \
- do { \
- if (sizeof(structure) != syze) { \
- T(YAFFS_TRACE_ALWAYS, (TSTR("%s should be %d but is %d\n" TENDSTR),\
- name, syze, (int) sizeof(structure))); \
- return YAFFS_FAIL; \
- } \
- } while (0)
-
-static int yaffs_check_structures(void)
-{
-/* yaffs_check_struct(struct yaffs_tags,8,"struct yaffs_tags"); */
-/* yaffs_check_struct(union yaffs_tags_union,8,"union yaffs_tags_union"); */
-/* yaffs_check_struct(struct yaffs_spare,16,"struct yaffs_spare"); */
-/* yaffs_check_struct(struct yaffs_tnode, 2 * YAFFS_NTNODES_LEVEL0, "struct yaffs_tnode"); */
-
-#ifndef CONFIG_YAFFS_WINCE
- yaffs_check_struct(struct yaffs_obj_hdr, 512, "struct yaffs_obj_hdr");
-#endif
- return YAFFS_OK;
-}
#define __YAFFS_GUTS_H__
#include "yportenv.h"
-#include "devextras.h"
#define YAFFS_OK 1
#define YAFFS_FAIL 0
#ifndef __YAFFS_LINUX_H__
#define __YAFFS_LINUX_H__
-#include "devextras.h"
#include "yportenv.h"
struct yaffs_linux_context {
#include "yaffs_guts.h"
-#if (MTD_VERSION_CODE < MTD_VERSION(2, 6, 18))
-extern struct nand_oobinfo yaffs_oobinfo;
-extern struct nand_oobinfo yaffs_noeccinfo;
-#endif
int nandmtd_erase_block(struct yaffs_dev *dev, int block_no);
int nandmtd_initialise(struct yaffs_dev *dev);
#endif
+++ /dev/null
-/*
- * 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 __YAFFS_QSORT_H__
-#define __YAFFS_QSORT_H__
-
-#ifdef __KERNEL__
-#include <linux/sort.h>
-
-extern void yaffs_qsort(void *const base, size_t total_elems, size_t size,
- int (*cmp)(const void *, const void *)){
- sort(base, total_elems, size, cmp, NULL);
-}
-
-#else
-
-extern void yaffs_qsort(void *const base, size_t total_elems, size_t size,
- int (*cmp)(const void *, const void *));
-
-#endif
-#endif
#include "yaffs_yaffs2.h"
#include "yaffs_checkptrw.h"
#include "yaffs_bitmap.h"
-#include "yaffs_qsort.h"
#include "yaffs_nand.h"
#include "yaffs_getblockinfo.h"
#include "yaffs_verify.h"
}
-typedef struct {
+struct yaffs_block_index{
int seq;
int block;
-} yaffs_block_index;
+};
static int yaffs2_ybicmp(const void *a, const void *b)
{
- register int aseq = ((yaffs_block_index *)a)->seq;
- register int bseq = ((yaffs_block_index *)b)->seq;
- register int ablock = ((yaffs_block_index *)a)->block;
- register int bblock = ((yaffs_block_index *)b)->block;
+ int aseq = ((struct yaffs_block_index *)a)->seq;
+ int bseq = ((struct yaffs_block_index *)b)->seq;
+ int ablock = ((struct yaffs_block_index *)a)->block;
+ int bblock = ((struct yaffs_block_index *)b)->block;
if (aseq == bseq)
return ablock - bblock;
else
int alloc_failed = 0;
- yaffs_block_index *block_index = NULL;
+ struct yaffs_block_index *block_index = NULL;
int alt_block_index = 0;
T(YAFFS_TRACE_SCAN,
dev->seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
- block_index = YMALLOC(n_blocks * sizeof(yaffs_block_index));
+ block_index = YMALLOC(n_blocks * sizeof(struct yaffs_block_index));
if (!block_index) {
- block_index = YMALLOC_ALT(n_blocks * sizeof(yaffs_block_index));
+ block_index = YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_index));
alt_block_index = 1;
}
YYIELD();
/* Sort the blocks by sequence number*/
- yaffs_qsort(block_index, n_to_scan, sizeof(yaffs_block_index), yaffs2_ybicmp);
+ yaffs_sort(block_index, n_to_scan, sizeof(struct yaffs_block_index), yaffs2_ybicmp);
YYIELD();
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
#include <linux/config.h>
#endif
-
+#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/vmalloc.h>
#include <linux/xattr.h>
#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/fs.h>
+#include <linux/stat.h>
+#include <linux/sort.h>
#define YCHAR char
#define YUCHAR unsigned char
#define yaffs_strnlen(s,m) strnlen(s,m)
#define yaffs_sprintf sprintf
#define yaffs_toupper(a) toupper(a)
+#define yaffs_sort(base, n, sz, cmp_fn) sort(base, n, sz, cmp_fn, NULL)
+
#define Y_INLINE __inline__
--- /dev/null
+/*
+ * 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 __YPORTENV_LINUX_H__
+#define __YPORTENV_LINUX_H__
+
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/xattr.h>
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/fs.h>
+#include <linux/stat.h>
+#include <linux/sort.h>
+
+#define YCHAR char
+#define YUCHAR unsigned char
+#define _Y(x) x
+#define yaffs_strcat(a, b) strcat(a, b)
+#define yaffs_strcpy(a, b) strcpy(a, b)
+#define yaffs_strncpy(a, b, c) strncpy(a, b, c)
+#define yaffs_strncmp(a, b, c) strncmp(a, b, c)
+#define yaffs_strnlen(s,m) strnlen(s,m)
+#define yaffs_sprintf sprintf
+#define yaffs_toupper(a) toupper(a)
+
+#define yaffs_sort(base, n, sz, cmp_fn) sort(base, n, sz, cmp_fn, NULL)
+
+#define Y_INLINE __inline__
+
+#define YAFFS_LOSTNFOUND_NAME "lost+found"
+#define YAFFS_LOSTNFOUND_PREFIX "obj"
+
+#define YMALLOC(x) kmalloc(x, GFP_NOFS)
+#define YFREE(x) kfree(x)
+#define YMALLOC_ALT(x) vmalloc(x)
+#define YFREE_ALT(x) vfree(x)
+#define YMALLOC_DMA(x) YMALLOC(x)
+
+#define YYIELD() schedule()
+#define Y_DUMP_STACK() dump_stack()
+
+#define YAFFS_ROOT_MODE 0755
+#define YAFFS_LOSTNFOUND_MODE 0700
+
+
+#define Y_CURRENT_TIME CURRENT_TIME.tv_sec
+#define Y_TIME_CONVERT(x) (x).tv_sec
+
+#define yaffs_sum_cmp(x, y) ((x) == (y))
+#define yaffs_strcmp(a, b) strcmp(a, b)
+
+#define TENDSTR "\n"
+#define TSTR(x) KERN_DEBUG x
+#define TCONT(x) x
+#define TOUT(p) printk p
+
+#define compile_time_assertion(assertion) \
+ ({ int x = __builtin_choose_expr(assertion, 0, (void)0); (void) x; })
+
+
+
+#ifndef Y_DUMP_STACK
+#define Y_DUMP_STACK() do { } while (0)
+#endif
+
+#ifndef YBUG
+#define YBUG() do {\
+ T(YAFFS_TRACE_BUG,\
+ (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR),\
+ __LINE__));\
+ Y_DUMP_STACK();\
+} while (0)
+#endif
+
+
+#endif