diff options
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/config/Config.in.flash | 32 | ||||
-rw-r--r-- | target/linux/config/Config.in.fs | 12 | ||||
-rw-r--r-- | target/linux/patches/3.10.40/bsd-compatibility.patch (renamed from target/linux/patches/3.10.37/bsd-compatibility.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.10.40/startup.patch (renamed from target/linux/patches/3.10.37/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.10.40/yaffs2.patch | 16547 | ||||
-rw-r--r-- | target/linux/patches/3.11.10/arm-spitz.patch | 27 | ||||
-rw-r--r-- | target/linux/patches/3.11.10/raspberry.patch | 97980 | ||||
-rw-r--r-- | target/linux/patches/3.11.10/startup.patch | 34 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/bsd-compatibility.patch | 2538 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/defaults.patch | 46 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/disable-netfilter.patch | 160 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/export-symbol-for-exmap.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/microblaze-ethernet.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/microblaze-setup.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/mips-lzo-fix.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/mtd-rootfs.patch | 26 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/ppc64-missing-zlib.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/usb-defaults-off.patch | 20 | ||||
-rw-r--r-- | target/linux/patches/3.12.18/vga-cons-default-off.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/bsd-compatibility.patch (renamed from target/linux/patches/3.11.10/bsd-compatibility.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/defaults.patch (renamed from target/linux/patches/3.11.10/defaults.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/disable-netfilter.patch (renamed from target/linux/patches/3.11.10/disable-netfilter.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/export-symbol-for-exmap.patch (renamed from target/linux/patches/3.11.10/export-symbol-for-exmap.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/gemalto.patch (renamed from target/linux/patches/3.11.10/gemalto.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/lemote-rfkill.patch (renamed from target/linux/patches/3.11.10/lemote-rfkill.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/microblaze-ethernet.patch (renamed from target/linux/patches/3.11.10/microblaze-ethernet.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/microblaze-setup.patch (renamed from target/linux/patches/3.11.10/microblaze-setup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/mips-lzo-fix.patch (renamed from target/linux/patches/3.11.10/mips-lzo-fix.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/mtd-rootfs.patch (renamed from target/linux/patches/3.11.10/mtd-rootfs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/non-static.patch (renamed from target/linux/patches/3.11.10/non-static.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/ppc64-missing-zlib.patch (renamed from target/linux/patches/3.11.10/ppc64-missing-zlib.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/startup.patch (renamed from target/linux/patches/3.12.18/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/usb-defaults-off.patch (renamed from target/linux/patches/3.11.10/usb-defaults-off.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/uuid.patch (renamed from target/linux/patches/3.11.10/uuid.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/vga-cons-default-off.patch (renamed from target/linux/patches/3.11.10/vga-cons-default-off.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/wlan-cf.patch (renamed from target/linux/patches/3.11.10/wlan-cf.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/xargs.patch (renamed from target/linux/patches/3.12.18/xargs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/yaffs2.patch | 16547 | ||||
-rw-r--r-- | target/linux/patches/3.12.20/zlib-inflate.patch (renamed from target/linux/patches/3.11.10/zlib-inflate.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.13.11/yaffs2.patch | 16547 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/gemalto.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/lemote-rfkill.patch | 21 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/non-static.patch | 33 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/uuid.patch | 263 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/wlan-cf.patch | 11 | ||||
-rw-r--r-- | target/linux/patches/3.4.87/zlib-inflate.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/bsd-compatibility.patch (renamed from target/linux/patches/3.4.87/bsd-compatibility.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/defaults.patch (renamed from target/linux/patches/3.4.87/defaults.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/gemalto.patch (renamed from target/linux/patches/3.12.18/gemalto.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/lemote-rfkill.patch (renamed from target/linux/patches/3.12.18/lemote-rfkill.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/mips-error.patch (renamed from target/linux/patches/3.4.87/mips-error.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/module-alloc-size-check.patch (renamed from target/linux/patches/3.4.87/module-alloc-size-check.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/non-static.patch (renamed from target/linux/patches/3.12.18/non-static.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/sparc-include.patch (renamed from target/linux/patches/3.4.87/sparc-include.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/startup.patch (renamed from target/linux/patches/3.4.87/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/usb-defaults-off.patch (renamed from target/linux/patches/3.4.87/usb-defaults-off.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/uuid.patch (renamed from target/linux/patches/3.12.18/uuid.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/vga-cons-default-off.patch (renamed from target/linux/patches/3.4.87/vga-cons-default-off.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/wlan-cf.patch (renamed from target/linux/patches/3.12.18/wlan-cf.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/yaffs2.patch | 16550 | ||||
-rw-r--r-- | target/linux/patches/3.4.90/zlib-inflate.patch (renamed from target/linux/patches/3.12.18/zlib-inflate.patch) | 0 |
61 files changed, 66202 insertions, 101284 deletions
diff --git a/target/linux/config/Config.in.flash b/target/linux/config/Config.in.flash index d35f1c866..47d6f6c35 100644 --- a/target/linux/config/Config.in.flash +++ b/target/linux/config/Config.in.flash @@ -110,38 +110,6 @@ config ADK_KERNEL_MTD_AR2315 default y if ADK_TARGET_SYSTEM_FON_FON2100 default n -config ADK_TARGET_NAND - boolean - select ADK_KERNEL_MISC_FILESYSTEMS - select ADK_KERNEL_YAFFS_FS - select ADK_KERNEL_YAFFS_YAFFS2 - select ADK_KERNEL_YAFFS_AUTO_YAFFS2 - select ADK_KERNEL_MTD - select ADK_KERNEL_MTD_PARTITIONS - select ADK_KERNEL_MTD_NAND - select ADK_KERNEL_MTD_NAND_PLATFORM - select ADK_KERNEL_MTD_CHAR - select ADK_KERNEL_MTD_BLKDEVS - select ADK_KERNEL_MTD_BLOCK - default y if ADK_TARGET_WITH_NAND - default n - -config ADK_TARGET_MTD - boolean - select ADK_KERNEL_MISC_FILESYSTEMS - select ADK_KERNEL_JFFS2_FS - select ADK_KERNEL_MTD - select ADK_KERNEL_MTD_PARTITIONS - select ADK_KERNEL_MTD_CHAR - select ADK_KERNEL_MTD_BLKDEVS - select ADK_KERNEL_MTD_BLOCK - select ADK_KERNEL_MTD_ROOTFS_ROOT_DEV - select ADK_KERNEL_MTD_CFI - select ADK_KERNEL_MTD_GEN_PROBE - select ADK_KERNEL_MTD_PHYSMAP - default y if ADK_TARGET_WITH_MTD - default n - config ADK_TARGET_MTD_SIZE int default "16777216" if ADK_TARGET_QEMU_MICROBLAZE_MODEL_S3ADSP1800 diff --git a/target/linux/config/Config.in.fs b/target/linux/config/Config.in.fs index 5efed48fb..353942ba8 100644 --- a/target/linux/config/Config.in.fs +++ b/target/linux/config/Config.in.fs @@ -223,11 +223,17 @@ config ADK_KERNEL_UDF_FS Please read <file:Documentation/filesystems/udf.txt>. config ADK_KERNEL_JFFS2_FS - tristate prompt "JFFS2 filesystem" + tristate select ADK_KERNEL_MISC_FILESYSTEMS + select ADK_KERNEL_MTD + select ADK_KERNEL_MTD_BLOCK select ADK_KERNEL_JFFS2_COMPRESSION_OPTIONS select ADK_KERNEL_JFFS2_ZLIB + depends on ADK_TARGET_WITH_MTD + default n + help + JFFS2 flash filesystem config ADK_KERNEL_SQUASHFS prompt "SquashFS filesystem" @@ -235,6 +241,8 @@ config ADK_KERNEL_SQUASHFS select ADK_KERNEL_MISC_FILESYSTEMS select ADK_KERNEL_SQUASHFS_XZ default n + help + Squashfs compressed read-only filesystem config ADK_KERNEL_YAFFS_FS prompt "YAFFS2 filesystem" @@ -245,6 +253,8 @@ config ADK_KERNEL_YAFFS_FS select ADK_KERNEL_YAFFS_YAFFS1 select ADK_KERNEL_YAFFS_YAFFS2 select ADK_KERNEL_YAFFS_AUTO_YAFFS2 + depends on ADK_TARGET_WITH_NAND + default n help YAFFS2 filesystem for NAND devices diff --git a/target/linux/patches/3.10.37/bsd-compatibility.patch b/target/linux/patches/3.10.40/bsd-compatibility.patch index b954b658f..b954b658f 100644 --- a/target/linux/patches/3.10.37/bsd-compatibility.patch +++ b/target/linux/patches/3.10.40/bsd-compatibility.patch diff --git a/target/linux/patches/3.10.37/startup.patch b/target/linux/patches/3.10.40/startup.patch index 3ebc5db1e..3ebc5db1e 100644 --- a/target/linux/patches/3.10.37/startup.patch +++ b/target/linux/patches/3.10.40/startup.patch diff --git a/target/linux/patches/3.10.40/yaffs2.patch b/target/linux/patches/3.10.40/yaffs2.patch new file mode 100644 index 000000000..172629530 --- /dev/null +++ b/target/linux/patches/3.10.40/yaffs2.patch @@ -0,0 +1,16547 @@ +diff -Nur linux-3.10.40.orig/fs/Kconfig linux-3.10.40/fs/Kconfig +--- linux-3.10.40.orig/fs/Kconfig 2014-05-13 14:00:04.000000000 +0200 ++++ linux-3.10.40/fs/Kconfig 2014-05-17 12:48:10.000000000 +0200 +@@ -193,6 +193,7 @@ + source "fs/befs/Kconfig" + source "fs/bfs/Kconfig" + source "fs/efs/Kconfig" ++source "fs/yaffs2/Kconfig" + source "fs/jffs2/Kconfig" + # UBIFS File system configuration + source "fs/ubifs/Kconfig" +diff -Nur linux-3.10.40.orig/fs/Makefile linux-3.10.40/fs/Makefile +--- linux-3.10.40.orig/fs/Makefile 2014-05-13 14:00:04.000000000 +0200 ++++ linux-3.10.40/fs/Makefile 2014-05-17 12:48:10.000000000 +0200 +@@ -126,3 +126,4 @@ + obj-$(CONFIG_CEPH_FS) += ceph/ + obj-$(CONFIG_PSTORE) += pstore/ + obj-$(CONFIG_EFIVAR_FS) += efivarfs/ ++obj-$(CONFIG_YAFFS_FS) += yaffs2/ +diff -Nur linux-3.10.40.orig/fs/yaffs2/Kconfig linux-3.10.40/fs/yaffs2/Kconfig +--- linux-3.10.40.orig/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.10.40/fs/yaffs2/Kconfig 2014-05-17 12:48:10.000000000 +0200 +@@ -0,0 +1,171 @@ ++# ++# yaffs file system configurations ++# ++ ++config YAFFS_FS ++ tristate "yaffs2 file system support" ++ default n ++ depends on MTD_BLOCK ++ select YAFFS_YAFFS1 ++ select YAFFS_YAFFS2 ++ help ++ yaffs2, or Yet Another Flash File System, is a file system ++ optimised for NAND Flash chips. ++ ++ To compile the yaffs2 file system support as a module, choose M ++ here: the module will be called yaffs2. ++ ++ If unsure, say N. ++ ++ Further information on yaffs2 is available at ++ <http://www.aleph1.co.uk/yaffs/>. ++ ++config YAFFS_YAFFS1 ++ bool "512 byte / page devices" ++ depends on YAFFS_FS ++ default y ++ help ++ Enable yaffs1 support -- yaffs for 512 byte / page devices ++ ++ Not needed for 2K-page devices. ++ ++ If unsure, say Y. ++ ++config YAFFS_9BYTE_TAGS ++ bool "Use older-style on-NAND data format with pageStatus byte" ++ depends on YAFFS_YAFFS1 ++ default n ++ help ++ ++ Older-style on-NAND data format has a "pageStatus" byte to record ++ chunk/page state. This byte is zero when the page is discarded. ++ Choose this option if you have existing on-NAND data using this ++ format that you need to continue to support. New data written ++ also uses the older-style format. Note: Use of this option ++ generally requires that MTD's oob layout be adjusted to use the ++ older-style format. See notes on tags formats and MTD versions ++ in yaffs_mtdif1.c. ++ ++ If unsure, say N. ++ ++config YAFFS_DOES_ECC ++ bool "Lets yaffs do its own ECC" ++ depends on YAFFS_FS && YAFFS_YAFFS1 && !YAFFS_9BYTE_TAGS ++ default n ++ help ++ This enables yaffs to use its own ECC functions instead of using ++ the ones from the generic MTD-NAND driver. ++ ++ If unsure, say N. ++ ++config YAFFS_ECC_WRONG_ORDER ++ bool "Use the same ecc byte order as Steven Hill's nand_ecc.c" ++ depends on YAFFS_FS && YAFFS_DOES_ECC && !YAFFS_9BYTE_TAGS ++ default n ++ help ++ This makes yaffs_ecc.c use the same ecc byte order as Steven ++ Hill's nand_ecc.c. If not set, then you get the same ecc byte ++ order as SmartMedia. ++ ++ If unsure, say N. ++ ++config YAFFS_YAFFS2 ++ bool "2048 byte (or larger) / page devices" ++ depends on YAFFS_FS ++ default y ++ help ++ Enable yaffs2 support -- yaffs for >= 2K bytes per page devices ++ ++ If unsure, say Y. ++ ++config YAFFS_AUTO_YAFFS2 ++ bool "Autoselect yaffs2 format" ++ depends on YAFFS_YAFFS2 ++ default y ++ help ++ Without this, you need to explicitely use yaffs2 as the file ++ system type. With this, you can say "yaffs" and yaffs or yaffs2 ++ will be used depending on the device page size (yaffs on ++ 512-byte page devices, yaffs2 on 2K page devices). ++ ++ If unsure, say Y. ++ ++config YAFFS_DISABLE_TAGS_ECC ++ bool "Disable yaffs from doing ECC on tags by default" ++ depends on YAFFS_FS && YAFFS_YAFFS2 ++ default n ++ help ++ This defaults yaffs to using its own ECC calculations on tags instead of ++ just relying on the MTD. ++ This behavior can also be overridden with tags_ecc_on and ++ tags_ecc_off mount options. ++ ++ If unsure, say N. ++ ++config YAFFS_ALWAYS_CHECK_CHUNK_ERASED ++ bool "Force chunk erase check" ++ depends on YAFFS_FS ++ default n ++ help ++ Normally yaffs only checks chunks before writing until an erased ++ chunk is found. This helps to detect any partially written ++ chunks that might have happened due to power loss. ++ ++ Enabling this forces on the test that chunks are erased in flash ++ before writing to them. This takes more time but is potentially ++ a bit more secure. ++ ++ Suggest setting Y during development and ironing out driver ++ issues etc. Suggest setting to N if you want faster writing. ++ ++ If unsure, say Y. ++ ++config YAFFS_EMPTY_LOST_AND_FOUND ++ bool "Empty lost and found on boot" ++ depends on YAFFS_FS ++ default n ++ help ++ If this is enabled then the contents of lost and found is ++ automatically dumped at mount. ++ ++ If unsure, say N. ++ ++config YAFFS_DISABLE_BLOCK_REFRESHING ++ bool "Disable yaffs2 block refreshing" ++ depends on YAFFS_FS ++ default n ++ help ++ If this is set, then block refreshing is disabled. ++ Block refreshing infrequently refreshes the oldest block in ++ a yaffs2 file system. This mechanism helps to refresh flash to ++ mitigate against data loss. This is particularly useful for MLC. ++ ++ If unsure, say N. ++ ++config YAFFS_DISABLE_BACKGROUND ++ bool "Disable yaffs2 background processing" ++ depends on YAFFS_FS ++ default n ++ help ++ If this is set, then background processing is disabled. ++ Background processing makes many foreground activities faster. ++ ++ If unsure, say N. ++ ++config YAFFS_DISABLE_BAD_BLOCK_MARKING ++ bool "Disable yaffs2 bad block marking" ++ depends on YAFFS_FS ++ default n ++ help ++ Useful during early flash bring up to prevent problems causing ++ lots of bad block marking. ++ ++ If unsure, say N. ++ ++config YAFFS_XATTR ++ bool "Enable yaffs2 xattr support" ++ depends on YAFFS_FS ++ default y ++ help ++ If this is set then yaffs2 will provide xattr support. ++ If unsure, say Y. +diff -Nur linux-3.10.40.orig/fs/yaffs2/Makefile linux-3.10.40/fs/yaffs2/Makefile +--- linux-3.10.40.orig/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.10.40/fs/yaffs2/Makefile 2014-05-17 12:48:10.000000000 +0200 +@@ -0,0 +1,18 @@ ++# ++# Makefile for the linux YAFFS filesystem routines. ++# ++ ++obj-$(CONFIG_YAFFS_FS) += yaffs.o ++ ++yaffs-y := yaffs_ecc.o yaffs_vfs.o yaffs_guts.o yaffs_checkptrw.o ++yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o ++yaffs-y += yaffs_tagscompat.o yaffs_tagsmarshall.o ++yaffs-y += yaffs_mtdif.o ++yaffs-y += yaffs_nameval.o yaffs_attribs.o ++yaffs-y += yaffs_allocator.o ++yaffs-y += yaffs_yaffs1.o ++yaffs-y += yaffs_yaffs2.o ++yaffs-y += yaffs_bitmap.o ++yaffs-y += yaffs_summary.o ++yaffs-y += yaffs_verify.o ++ +diff -Nur linux-3.10.40.orig/fs/yaffs2/yaffs_allocator.c linux-3.10.40/fs/yaffs2/yaffs_allocator.c +--- linux-3.10.40.orig/fs/yaffs2/yaffs_allocator.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-3.10.40/fs/yaffs2/yaffs_allocator.c 2014-05-17 12:48:10.000000000 +0200 +@@ -0,0 +1,357 @@ ++/* ++ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. ++ * ++ * Copyright (C) 2002-2011 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 General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include "yaffs_allocator.h" ++#include "yaffs_guts.h" ++#include "yaffs_trace.h" ++#include "yportenv.h" ++ ++/* ++ * Each entry in yaffs_tnode_list and yaffs_obj_list hold blocks ++ * of approx 100 objects that are themn allocated singly. ++ * This is basically a simplified slab allocator. ++ * ++ * We don't use the Linux slab allocator because slab does not allow ++ * us to dump all the objects in one hit when we do a umount and tear ++ * down all the tnodes and objects. slab requires that we first free ++ * the individual objects. ++ * ++ * Once yaffs has been mainlined I shall try to motivate for a change ++ * to slab to provide the extra features we need here. ++ */ ++ ++struct yaffs_tnode_list { ++ struct yaffs_tnode_list *next; ++ struct yaffs_tnode *tnodes; ++}; ++ ++struct yaffs_obj_list { ++ struct yaffs_obj_list *next; ++ struct yaffs_obj *objects; ++}; ++ ++struct yaffs_allocator { ++ int n_tnodes_created; ++ struct yaffs_tnode *free_tnodes; ++ int n_free_tnodes; ++ struct yaffs_tnode_list *alloc_tnode_list; ++ ++ int n_obj_created; ++ struct list_head free_objs; ++ int n_free_objects; ++ ++ struct yaffs_obj_list *allocated_obj_list; ++}; ++ ++static void yaffs_deinit_raw_tnodes(struct yaffs_dev *dev) ++{ ++ struct yaffs_allocator *allocator = ++ (struct yaffs_allocator *)dev->allocator; ++ struct yaffs_tnode_list *tmp; ++ ++ if (!allocator) { ++ BUG(); ++ return; ++ } ++ ++ while (allocator->alloc_tnode_list) { ++ tmp = allocator->alloc_tnode_list->next; ++ ++ kfree(allocator->alloc_tnode_list->tnodes); ++ kfree(allocator->alloc_tnode_list); ++ allocator->alloc_tnode_list = tmp; ++ } ++ ++ allocator->free_tnodes = NULL; ++ allocator->n_free_tnodes = 0; ++ allocator->n_tnodes_created = 0; ++} ++ ++static void yaffs_init_raw_tnodes(struct yaffs_dev *dev) ++{ ++ struct yaffs_allocator *allocator = dev->allocator; ++ ++ if (!allocator) { ++ BUG(); ++ return; ++ } ++ ++ allocator->alloc_tnode_list = NULL; ++ allocator->free_tnodes = NULL; ++ allocator->n_free_tnodes = 0; ++ allocator->n_tnodes_created = 0; ++} ++ ++static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes) ++{ ++ struct yaffs_allocator *allocator = ++ (struct yaffs_allocator *)dev->allocator; ++ int i; ++ struct yaffs_tnode *new_tnodes; ++ u8 *mem; ++ struct yaffs_tnode *curr; ++ struct yaffs_tnode *next; ++ struct yaffs_tnode_list *tnl; ++ ++ if (!allocator) { ++ BUG(); ++ return YAFFS_FAIL; ++ } ++ ++ if (n_tnodes < 1) ++ return YAFFS_OK; ++ ++ /* make these things */ ++ new_tnodes = kmalloc(n_tnodes * dev->tnode_size, GFP_NOFS); ++ mem = (u8 *) new_tnodes; ++ ++ if (!new_tnodes) { ++ yaffs_trace(YAFFS_TRACE_ERROR, ++ "yaffs: Could not allocate Tnodes"); ++ return YAFFS_FAIL; ++ } ++ ++ /* New hookup for wide tnodes */ ++ for (i = 0; i < n_tnodes - 1; i++) { ++ curr = (struct yaffs_tnode *)&mem[i * dev->tnode_size]; ++ next = (struct yaffs_tnode *)&mem[(i + 1) * dev->tnode_size]; ++ curr->internal[0] = next; ++ } ++ ++ curr = (struct yaffs_tnode *)&mem[(n_tnodes - 1) * dev->tnode_size]; ++ curr->internal[0] = allocator->free_tnodes; ++ allocator->free_tnodes = (struct yaffs_tnode *)mem; ++ ++ allocator->n_free_tnodes += n_tnodes; ++ allocator->n_tnodes_created += n_tnodes; ++ ++ /* Now add this bunch of tnodes to a list for freeing up. ++ * NB If we can't add this to the management list it isn't fatal ++ * but it just means we can't free this bunch of tnodes later. ++ */ ++ tnl = kmalloc(sizeof(struct yaffs_tnode_list), GFP_NOFS); ++ if (!tnl) { ++ yaffs_trace(YAFFS_TRACE_ERROR, ++ "Could not add tnodes to management list"); ++ return YAFFS_FAIL; ++ } else { ++ tnl->tnodes = new_tnodes; ++ tnl->next = allocator->alloc_tnode_list; ++ allocator->alloc_tnode_list = tnl; ++ } ++ ++ yaffs_trace(YAFFS_TRACE_ALLOCATE, "Tnodes added"); ++ ++ return YAFFS_OK; ++} ++ ++struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) ++{ ++ struct yaffs_allocator *allocator = ++ (struct yaffs_allocator *)dev->allocator; ++ struct yaffs_tnode *tn = NULL; ++ ++ if (!allocator) { ++ BUG(); ++ return NULL; ++ } ++ ++ /* If there are none left make more */ ++ if (!allocator->free_tnodes) ++ yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES); ++ ++ if (allocator->free_tnodes) { ++ tn = allocator->free_tnodes; ++ allocator->free_tnodes = allocator->free_tnodes->internal[0]; ++ allocator->n_free_tnodes--; ++ } ++ ++ return tn; ++} ++ ++/* FreeTnode frees up a tnode and puts it back on the free list */ ++void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn) ++{ ++ struct yaffs_allocator *allocator = dev->allocator; ++ ++ if (!allocator) { ++ BUG(); ++ return; ++ } ++ ++ if (tn) { ++ tn->internal[0] = allocator->free_tnodes; ++ allocator->free_tnodes = tn; ++ allocator->n_free_tnodes++; ++ } ++ dev->checkpoint_blocks_required = 0; /* force recalculation */ ++} ++ ++/*--------------- yaffs_obj alloaction ------------------------ ++ * ++ * Free yaffs_objs are stored in a list using obj->siblings. ++ * The blocks of allocated objects are stored in a linked list. ++ */ ++ ++static void yaffs_init_raw_objs(struct yaffs_dev *dev) ++{ ++ struct yaffs_allocator *allocator = dev->allocator; ++ ++ if (!allocator) { ++ BUG(); ++ return; ++ } ++ ++ allocator->allocated_obj_list = NULL; ++ INIT_LIST_HEAD(&allocator->free_objs); ++ allocator->n_free_objects = 0; ++} ++ ++static void yaffs_deinit_raw_objs(struct yaffs_dev *dev) ++{ ++ struct yaffs_allocator *allocator = dev->allocator; ++ struct yaffs_obj_list *tmp; ++ ++ if (!allocator) { ++ BUG(); ++ return; ++ } ++ ++ while (allocator->allocated_obj_list) { ++ tmp = allocator->allocated_obj_list->next; ++ kfree(allocator->allocated_obj_list->objects); ++ kfree(allocator->allocated_obj_list); ++ allocator->allocated_obj_list = tmp; ++ } ++ ++ INIT_LIST_HEAD(&allocator->free_objs); ++ allocator->n_free_objects = 0; ++ allocator->n_obj_created = 0; ++} ++ ++static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj) ++{ ++ struct yaffs_allocator *allocator = dev->allocator; ++ int i; |