lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit b6f8ee3b4e99516ae57d107bbc32fd75651947f6
parent fc18b0f5efc84277669406c123d224694a89b367
Author: Duncaen <mail@duncano.de>
Date:   Wed,  8 Mar 2017 20:55:13 +0100

lib/libopenbsd: dont wrap statfs(2) by default

Diffstat:
include/sys/mount.h | 34++++++++++++++++++----------------
lib/libopenbsd/gen/getmntinfo.c | 8++++----
lib/libopenbsd/sys/getfsstat.c | 3---
lib/libopenbsd/sys/statfs.c | 6++----
4 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/include/sys/mount.h b/include/sys/mount.h @@ -6,11 +6,11 @@ #include <stdlib.h> -#define MNT_NOWAIT 0x01 -#define MNT_WAIT 0x02 -#define MNT_LOCAL 0x10 -#define MFSNAMELEN 128 -#define MNAMELEN 128 +#define MNT_NOWAIT 0x01 +#define MNT_WAIT 0x02 +#define MNT_LOCAL 0x10 +#define MFSNAMELEN 128 +#define MNAMELEN 128 union mount_info { @@ -26,19 +26,21 @@ struct openbsd_statfs { union mount_info mount_info; /* per-filesystem mount options */ }; -#define statfs openbsd_statfs +#ifdef __NEED_OPENBSD_statfs +#define statfs openbsd_statfs -#define f_blocks buf.f_blocks -#define f_bsize buf.f_bsize -#define f_bfree buf.f_bfree -#define f_bavail buf.f_bavail +#define f_blocks buf.f_blocks +#define f_bsize buf.f_bsize +#define f_bfree buf.f_bfree +#define f_bavail buf.f_bavail -#define f_files buf.f_files -#define f_ffree buf.f_ffree -#define f_flags buf.f_flags +#define f_files buf.f_files +#define f_ffree buf.f_ffree +#define f_flags buf.f_flags +#endif /* !__NEED_OPENBSD_statfs */ -int getmntinfo(struct statfs **, int); -int getfsstat(struct statfs *, size_t, int); -int openbsd_statfs(const char *, struct statfs *); +int getmntinfo(struct openbsd_statfs **, int); +int getfsstat(struct openbsd_statfs *, size_t, int); +int openbsd_statfs(const char *, struct openbsd_statfs *); #endif /* _COMPAT_SYS_MOUNT_H_ */ diff --git a/lib/libopenbsd/gen/getmntinfo.c b/lib/libopenbsd/gen/getmntinfo.c @@ -36,9 +36,9 @@ * Return information about mounted filesystems. */ int -getmntinfo(struct statfs **mntbufp, int flags) +getmntinfo(struct openbsd_statfs **mntbufp, int flags) { - static struct statfs *mntbuf; + static struct openbsd_statfs *mntbuf; static int mntsize; static size_t bufsize; @@ -46,9 +46,9 @@ getmntinfo(struct statfs **mntbufp, int flags) return (0); if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) return (0); - while (bufsize <= mntsize * sizeof(struct statfs)) { + while (bufsize <= mntsize * sizeof(struct openbsd_statfs)) { free(mntbuf); - bufsize = (mntsize + 1) * sizeof(struct statfs); + bufsize = (mntsize + 1) * sizeof(struct openbsd_statfs); if ((mntbuf = malloc(bufsize)) == 0) { bufsize = 0; return (0); diff --git a/lib/libopenbsd/sys/getfsstat.c b/lib/libopenbsd/sys/getfsstat.c @@ -7,9 +7,6 @@ #include <mntent.h> #include <string.h> -/* sys/mount.h defines statfs as openbsd_statfs, here i need the original one */ -#undef statfs - int getfsstat(struct openbsd_statfs *buf, size_t bufsize, int flags) { diff --git a/lib/libopenbsd/sys/statfs.c b/lib/libopenbsd/sys/statfs.c @@ -2,10 +2,8 @@ #include <sys/stat.h> #include <string.h> -/* sys/mount defines statfs as openbsd_statfs, here i need the original one */ -#undef statfs - -int openbsd_statfs(const char *path, struct openbsd_statfs *buf) +int +openbsd_statfs(const char *path, struct openbsd_statfs *buf) { struct statfs sfb; struct stat sb;