aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-08 20:55:13 +0100
committerDuncaen <mail@duncano.de>2017-03-08 20:56:59 +0100
commitb6f8ee3b4e99516ae57d107bbc32fd75651947f6 (patch)
treed98d50720c8a997011be7fcaf8811dd5a5e48168
parentfc18b0f5efc84277669406c123d224694a89b367 (diff)
downloadlobase-b6f8ee3b4e99516ae57d107bbc32fd75651947f6.tar.gz
lib/libopenbsd: dont wrap statfs(2) by default
-rw-r--r--include/sys/mount.h34
-rw-r--r--lib/libopenbsd/gen/getmntinfo.c8
-rw-r--r--lib/libopenbsd/sys/getfsstat.c3
-rw-r--r--lib/libopenbsd/sys/statfs.c6
4 files changed, 24 insertions, 27 deletions
diff --git a/include/sys/mount.h b/include/sys/mount.h
index 647cc5d..a21b5eb 100644
--- 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
index 4ba27ce..0620574 100644
--- 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
index d1e5312..639f531 100644
--- 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
index 9d43963..85dffcf 100644
--- 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;