[PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open()

Pavel Reichl
2021-08-06T21:23:44Z

---
fsr/xfs_fsr.c | 2 +-
include/linux.h | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 25eb2e12..38afafb1 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -314,7 +314,7 @@ initallfs(char *mtab)
mi = 0;
fs = fsbase;

- if (platform_mntent_open(&cursor, mtab) != 0){
+ if (mntent_open(&cursor, mtab) != 0){
fprintf(stderr, "Error: can't get mntent entries.\n");
exit(1);
}
diff --git a/include/linux.h b/include/linux.h
index ae32f0e0..b6249284 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -166,7 +166,7 @@ struct mntent_cursor {
FILE *mtabp;
};

-static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab)
+static inline int mntent_open(struct mntent_cursor * cursor, char *mtab)
{
cursor->mtabp = setmntent(mtab, "r");
if (!cursor->mtabp) {
@@ -176,6 +176,11 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab
return 0;
}

+static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtab)
+{
+ return mntent_open(cursor, mtab);
+}
+
static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursor)
{
return getmntent(cursor->mtabp);
--
2.31.1