summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Walter <dwalter@sigma-star.at>2016-08-31 10:05:36 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:56 +0100
commite7974ec2eae0f0142112028d8b7bd0af0c0c5ebb (patch)
treebe7dbf58e3ca03c68de2570695114a93e2c080b2 /lib
parent4adc61baeba93bc08749c7586d0a36bee01ece8d (diff)
Add support for sysfs mocking
In order to use test files, allow sysfs root to be set during compile time Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/libmtd.c2
-rw-r--r--lib/libmtd_int.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 8c0157e..8bc532f 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -561,7 +561,7 @@ libmtd_t libmtd_open(void)
lib->offs64_ioctls = OFFS64_IOCTLS_UNKNOWN;
- lib->sysfs_mtd = mkpath("/sys", SYSFS_MTD);
+ lib->sysfs_mtd = mkpath(SYSFS_ROOT, SYSFS_MTD);
if (!lib->sysfs_mtd)
goto out_error;
diff --git a/lib/libmtd_int.h b/lib/libmtd_int.h
index 8ff33ad..db2f1cf 100644
--- a/lib/libmtd_int.h
+++ b/lib/libmtd_int.h
@@ -30,6 +30,10 @@ extern "C" {
#define PROGRAM_NAME "libmtd"
+#ifndef SYSFS_ROOT
+#define SYSFS_ROOT "/sys"
+#endif
+
#define SYSFS_MTD "class/mtd"
#define MTD_NAME_PATT "mtd%d"
#define MTD_DEV "dev"