Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/seq_file.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/err.h>
#include <linux/ioctl.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/idr.h>
#include <linux/backing-dev.h>
#include <linux/gfp.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include "mtdcore.h"
Go to the source code of this file.
Macros | |
#define | MTD_DEVT(index) 0 |
add_mtd_device - register an MTD device : pointer to new MTD device info structure
Add a device to the list of MTD devices present in the system, and notify each currently active MTD 'user' of its arrival. Returns zero on success or 1 on failure, which currently will only happen if there is insufficient memory or a sysfs error.
DEFINE_MUTEX | ( | mtd_table_mutex | ) |
del_mtd_device - unregister an MTD device : pointer to MTD device info structure
Remove a device from the list of MTD devices present in the system, and notify each currently active MTD 'user' of its departure. Returns zero on success or 1 on failure, which currently will happen if the requested device does not appear to be present in the list.
EXPORT_SYMBOL_GPL | ( | mtd_table_mutex | ) |
EXPORT_SYMBOL_GPL | ( | __mtd_next_device | ) |
EXPORT_SYMBOL_GPL | ( | mtd_device_parse_register | ) |
EXPORT_SYMBOL_GPL | ( | mtd_device_unregister | ) |
EXPORT_SYMBOL_GPL | ( | register_mtd_user | ) |
EXPORT_SYMBOL_GPL | ( | unregister_mtd_user | ) |
EXPORT_SYMBOL_GPL | ( | get_mtd_device | ) |
EXPORT_SYMBOL_GPL | ( | __get_mtd_device | ) |
EXPORT_SYMBOL_GPL | ( | get_mtd_device_nm | ) |
EXPORT_SYMBOL_GPL | ( | put_mtd_device | ) |
EXPORT_SYMBOL_GPL | ( | __put_mtd_device | ) |
EXPORT_SYMBOL_GPL | ( | mtd_erase | ) |
EXPORT_SYMBOL_GPL | ( | mtd_point | ) |
EXPORT_SYMBOL_GPL | ( | mtd_unpoint | ) |
EXPORT_SYMBOL_GPL | ( | mtd_get_unmapped_area | ) |
EXPORT_SYMBOL_GPL | ( | mtd_read | ) |
EXPORT_SYMBOL_GPL | ( | mtd_write | ) |
EXPORT_SYMBOL_GPL | ( | mtd_panic_write | ) |
EXPORT_SYMBOL_GPL | ( | mtd_read_oob | ) |
EXPORT_SYMBOL_GPL | ( | mtd_get_fact_prot_info | ) |
EXPORT_SYMBOL_GPL | ( | mtd_read_fact_prot_reg | ) |
EXPORT_SYMBOL_GPL | ( | mtd_get_user_prot_info | ) |
EXPORT_SYMBOL_GPL | ( | mtd_read_user_prot_reg | ) |
EXPORT_SYMBOL_GPL | ( | mtd_write_user_prot_reg | ) |
EXPORT_SYMBOL_GPL | ( | mtd_lock_user_prot_reg | ) |
EXPORT_SYMBOL_GPL | ( | mtd_lock | ) |
EXPORT_SYMBOL_GPL | ( | mtd_unlock | ) |
EXPORT_SYMBOL_GPL | ( | mtd_is_locked | ) |
EXPORT_SYMBOL_GPL | ( | mtd_block_isbad | ) |
EXPORT_SYMBOL_GPL | ( | mtd_block_markbad | ) |
EXPORT_SYMBOL_GPL | ( | mtd_writev | ) |
EXPORT_SYMBOL_GPL | ( | mtd_kmalloc_up_to | ) |
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.
MODULE_AUTHOR | ( | "David Woodhouse <[email protected]>" | ) |
module_exit | ( | cleanup_mtd | ) |
module_init | ( | init_mtd | ) |
MODULE_LICENSE | ( | "GPL" | ) |
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 | ||
) |
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.