Refactor, replace deprecated setfsent() & C:o with setmntent()

The setfsent() family of APIs was never standardized and on Linux only
GLIBC implement them.  We've tried to overcome this limitation, and to
support uClibc/uClibc-ng and musl libc, by providing replacements APIs
in helpers.c.

However, and since we want to support alternative /etc/fstab files, the
setmntent() family of APIs is more widespread and supports reading from
any fstab or mtab file.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-04-20 07:20:33 +02:00
1 parent 05be281301
commit 5593372ffb
5 files changed
+31 -105

No files matched your search

-19
View File
@@ -27,9 +27,6 @@
#include "config.h"
#ifdef HAVE_FSTAB_H
#include <fstab.h>
#endif
#include <mntent.h>
#include <sched.h> /* sched_yield() */
#include <stdarg.h>
@@ -52,22 +49,6 @@ typedef enum {
PROGRESS_MODERN,
} pstyle_t;
#ifndef HAVE_FSTAB_H
struct fstab {
char *fs_spec; /* block device name */
char *fs_file; /* mount point */
char *fs_vfstype; /* file-system type */
char *fs_mntops; /* mount options */
const char *fs_type; /* rw/rq/ro/sw/xx option */
int fs_freq; /* dump frequency, in days */
int fs_passno; /* pass number on parallel dump */
};
int setfsent (void);
void endfsent (void);
struct fstab *getfsent (void);
#endif /* HAVE_FSTAB_H */
char *console (void);
void console_init (void);
ssize_t cprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));