| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * YAFFS: Yet another Flash File System . A NAND-flash specific file system. |
| 3 | * |
| 4 | * Copyright (C) 2002-2018 Aleph One Ltd. |
| 5 | * |
| 6 | * Created by Charles Manning <charles@aleph1.co.uk> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Lesser General Public License version 2.1 as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. |
| 13 | */ |
| 14 | |
| 15 | #ifndef __YAFFS_LINUX_H__ |
| 16 | #define __YAFFS_LINUX_H__ |
| 17 | |
| 18 | #include "yportenv.h" |
| 19 | |
| 20 | struct yaffs_linux_context { |
| 21 | struct list_head context_list; /* List of these we have mounted */ |
| 22 | struct yaffs_dev *dev; |
| 23 | struct super_block *super; |
| 24 | struct task_struct *bg_thread; /* Background thread for this device */ |
| 25 | int bg_running; |
| 26 | struct mutex gross_lock; /* Gross locking mutex*/ |
| 27 | u8 *spare_buffer; /* For mtdif2 use. Don't know the buffer size |
| 28 | * at compile time so we have to allocate it. |
| 29 | */ |
| 30 | struct list_head search_contexts; |
| 31 | struct task_struct *readdir_process; |
| 32 | unsigned mount_id; |
| 33 | int dirty; |
| 34 | }; |
| 35 | |
| 36 | #define yaffs_dev_to_lc(dev) ((struct yaffs_linux_context *)((dev)->os_context)) |
| 37 | #define yaffs_dev_to_mtd(dev) ((struct mtd_info *)((dev)->driver_context)) |
| 38 | |
| 39 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) |
| 40 | #define WRITE_SIZE_STR "writesize" |
| 41 | #define WRITE_SIZE(mtd) ((mtd)->writesize) |
| 42 | #else |
| 43 | #define WRITE_SIZE_STR "oobblock" |
| 44 | #define WRITE_SIZE(mtd) ((mtd)->oobblock) |
| 45 | #endif |
| 46 | |
| 47 | #endif |