a Linux Kernel still build correctly.
Set MTD_VERSION_CODE either from the kernel or by hand.
*/
const char *yaffs_mtdif_c_version =
- "$Id: yaffs_mtdif.c,v 1.19 2007-02-14 01:09:06 wookey Exp $";
+ "$Id: yaffs_mtdif.c,v 1.20 2007-12-12 18:08:15 colin Exp $";
#include "yportenv.h"
#include "linux/time.h"
#include "linux/mtd/nand.h"
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
+#if (MTD_VERSION_CODE < MTD_VERSION(2,6,18))
static struct nand_oobinfo yaffs_oobinfo = {
.useecc = 1,
.eccbytes = 6,
};
#endif
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
static inline void translate_spare2oob(const yaffs_Spare *spare, __u8 *oob)
{
oob[0] = spare->tagByte0;
const __u8 * data, const yaffs_Spare * spare)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
int retval = 0;
loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
__u8 spareAsBytes[8]; /* OOB */
if (data && !spare)
yaffs_Spare * spare)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
int retval = 0;
loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
__u8 spareAsBytes[8]; /* OOB */
if (data && !spare)
#include "linux/mtd/mtd.h"
/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
-const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.5 2007-10-29 14:59:57 imcd Exp $";
+const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.6 2007-12-12 18:08:15 colin Exp $";
#ifndef CONFIG_YAFFS_9BYTE_TAGS
# define YTAG1_SIZE 8
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+#if (MTD_VERSION_CODE < MTD_VERSION(2,6,20))
/* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug;
* help it out with ops.len = ops.ooblen when ops.datbuf == NULL.
*/
return YAFFS_OK;
}
-#endif /*KERNEL_VERSION*/
+#endif /*MTD_VERSION*/
/* mtd interface for YAFFS2 */
const char *yaffs_mtdif2_c_version =
- "$Id: yaffs_mtdif2.c,v 1.17 2007-02-14 01:09:06 wookey Exp $";
+ "$Id: yaffs_mtdif2.c,v 1.18 2007-12-12 18:08:15 colin Exp $";
#include "yportenv.h"
const yaffs_ExtendedTags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
struct mtd_oob_ops ops;
#else
size_t dummy;
("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p"
TENDSTR), chunkInNAND, data, tags));
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
if (tags)
yaffs_PackTags2(&pt, tags);
else
__u8 * data, yaffs_ExtendedTags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p"
TENDSTR), chunkInNAND, data, tags));
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
+#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
if (data && !tags)
retval = mtd->read(mtd, addr, dev->nDataBytesPerChunk,
&dummy, data);
#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.
+ */
+
+#define MTD_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+
#if defined CONFIG_YAFFS_WINCE
#include "ywinceenv.h"
#include "moduleconfig.h"
/* Linux kernel */
+
#include <linux/version.h>
+#define MTD_VERSION_CODE LINUX_VERSION_CODE
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <linux/config.h>
#endif
#elif defined CONFIG_YAFFS_DIRECT
+#define MTD_VERSION_CODE MTD_VERSION(2,6,22)
+
/* Direct interface */
#include "ydirectenv.h"