[PATCH mtd-utils 0/2] Support referencing MTD devices by name
Brandon Maier
brandon.maier at collins.com
Mon Dec 12 10:01:56 PST 2022
This series adds an libmtd function and support to various MTD utilities
for looking up MTD devices by their name.
The first patch adds mtd_get_dev_info2(), an optimized function for
looking up MTD device by name with /sys/class/mtd or legacy /proc/mtd.
The second patch wraps mtd_get_dev_info2() with a helper function that
accepts Linux filesystem mount style "mtd:<name>" string and tries to
translate it to the /dev/mtdX device node. It then hooks the helper
function into a subset of tools.
There are probably many more tools in mtd-utils that could be hooked in,
but this is a proof-of-concept. More could be supported if this series
is acceptable.
Brandon Maier (2):
libmtd: Add function to get MTD info by device name
mtd-utils: Add new syntax to get devices by name
include/common.h | 1 +
include/libmtd.h | 13 +++++-
lib/common.c | 46 +++++++++++++++++++++
lib/libmtd.c | 68 +++++++++++++++++++++++++++++++-
lib/libmtd_int.h | 1 +
lib/libmtd_legacy.c | 38 ++++++++++++++++++
misc-utils/Makemodule.am | 5 +++
misc-utils/flash_erase.c | 6 ++-
misc-utils/flash_unlock.c | 9 ++++-
misc-utils/flashcp.c | 7 +++-
misc-utils/mtd_debug.c | 7 +++-
misc-utils/mtdpart.c | 7 +++-
tests/mtd-tests/flash_readtest.c | 10 +++--
tests/mtd-tests/flash_speed.c | 10 +++--
tests/mtd-tests/flash_stress.c | 10 +++--
tests/mtd-tests/flash_torture.c | 10 +++--
ubi-utils/mtdinfo.c | 13 ++++--
17 files changed, 237 insertions(+), 24 deletions(-)
--
2.38.2
More information about the linux-mtd
mailing list