Linux Kernel
3.7.1
|
#include <linux/types.h>
#include <linux/uio.h>
#include <linux/notifier.h>
#include <linux/device.h>
#include <mtd/mtd-abi.h>
#include <asm/div64.h>
Go to the source code of this file.
Data Structures | |
struct | erase_info |
struct | mtd_erase_region_info |
struct | mtd_oob_ops |
struct | nand_ecclayout |
struct | mtd_info |
struct | mtd_notifier |
Macros | |
#define | MTD_CHAR_MAJOR 90 |
#define | MTD_BLOCK_MAJOR 31 |
#define | MTD_ERASE_PENDING 0x01 |
#define | MTD_ERASING 0x02 |
#define | MTD_ERASE_SUSPEND 0x04 |
#define | MTD_ERASE_DONE 0x08 |
#define | MTD_ERASE_FAILED 0x10 |
#define | MTD_FAIL_ADDR_UNKNOWN -1LL |
#define | MTD_MAX_OOBFREE_ENTRIES_LARGE 32 |
#define | MTD_MAX_ECCPOS_ENTRIES_LARGE 448 |
#define | mtd_device_register(master, parts, nr_parts) mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) |
#define mtd_device_register | ( | master, | |
parts, | |||
nr_parts | |||
) | mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) |
get_mtd_device - obtain a validated handle for an MTD device : last known address of the required MTD device : internal device number of the required MTD device
Given a number and NULL address, return the num'th entry in the device table, if any. Given an address and num == -1, search the device table for a device with that address and return if it's still present. Given both, return the num'th driver only if its address matches. Return error code if not.
int mtd_device_parse_register | ( | struct mtd_info * | mtd, |
const char ** | types, | ||
struct mtd_part_parser_data * | parser_data, | ||
const struct mtd_partition * | parts, | ||
int | nr_parts | ||
) |
mtd_device_parse_register - parse partitions and register an MTD device.
: the MTD device to register : the list of MTD partition probes to try, see 'parse_mtd_partitions()' for more information : MTD partition parser-specific data : fallback partition information to register, if parsing fails; only valid if nr_parts > %0 : the number of partitions in parts, if zero then the full MTD device is registered if no partition info is found
This function aggregates MTD partitions parsing (done by 'parse_mtd_partitions()') and MTD device and partitions registering. It basically follows the most common pattern found in many MTD drivers:
Returns zero in case of success and a negative error code in case of failure.
int mtd_erase | ( | struct mtd_info * | mtd, |
struct erase_info * | instr | ||
) |
void mtd_erase_callback | ( | struct erase_info * | instr | ) |
mtd_kmalloc_up_to - allocate a contiguous buffer up to the specified size : mtd device description object pointer : a pointer to the ideal or maximum size of the allocation, points to the actual allocation size on success.
This routine attempts to allocate a contiguous kernel buffer up to the specified size, backing off the size of the request exponentially until the request succeeds or until the allocation size falls below the system page size. This attempts to make sure it does not adversely impact system performance, so when allocating more than one page, we ask the memory allocator to avoid re-trying, swapping, writing back or performing I/O.
Note, this function also makes sure that the allocated buffer is aligned to the MTD device's min. I/O unit, i.e. the "mtd->writesize" value.
This is called, for example by mtd_{read,write} and jffs2_scan_medium, to handle smaller (i.e. degraded) buffer allocations under low- or fragmented-memory situations where such reduced allocations, from a requested ideal, are allowed.
Returns a pointer to the allocated buffer on success; otherwise, NULL.
int mtd_read_oob | ( | struct mtd_info * | mtd, |
loff_t | from, | ||
struct mtd_oob_ops * | ops | ||
) |
void register_mtd_user | ( | struct mtd_notifier * | new | ) |
int unregister_mtd_user | ( | struct mtd_notifier * | old | ) |
unregister_mtd_user - unregister a 'user' of MTD devices. : pointer to notifier info structure
Removes a callback function pair from the list of 'users' to be notified upon addition or removal of MTD devices. Causes the 'remove' callback to be immediately invoked for each MTD device currently present in the system.