1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
$NetBSD: patch-ae,v 1.10 2008/05/25 14:34:13 tonio Exp $
--- mpeg3io.c.orig 2005-05-01 07:57:56.000000000 +0200
+++ mpeg3io.c 2008-02-19 19:25:09.000000000 +0100
@@ -1,11 +1,32 @@
#include "mpeg3private.h"
#include "mpeg3protos.h"
-#include <mntent.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
+
+#if defined(__NetBSD__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
+# include <sys/param.h>
+# include <sys/mount.h>
+
+# if defined(__APPLE__) && defined(__MACH__)
+#include <sys/cdefs.h>
+# endif
+# if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900 /* 2.99.9 */) || (defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN_64_BIT_INO_T) /* MacOSX < 10.5 */)
+# define fopen64 fopen
+# define fseeko64 fseek
+# define stat64 stat
+# endif
+# if defined(__NetBSD__) && __NetBSD_Version__ >= 299000900 /* 2.99.9 */
+# define statfs statvfs
+# endif
+
+# include <sys/types.h>
+# include <sys/stat.h>
+#else
+# include <mntent.h>
+# include <sys/stat.h>
+#endif
mpeg3_fs_t* mpeg3_new_fs(char *path)
{
@@ -215,16 +231,26 @@
int mpeg3io_device(char *path, char *device)
{
+#if defined(__NetBSD__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
+ struct statfs file_st;
+
+ if (statfs(path, &file_st) < 0)
+#else
+
struct stat64 file_st, device_st;
struct mntent *mnt;
FILE *fp;
if(stat64(path, &file_st) < 0)
+#endif
{
perror("mpeg3io_device");
return 1;
}
+#if defined(__NetBSD__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
+ strncpy(device, file_st.f_mntfromname, MPEG3_STRLEN);
+#else
fp = setmntent(MOUNTED, "r");
while(fp && (mnt = getmntent(fp)))
{
@@ -236,6 +262,7 @@
}
}
endmntent(fp);
+#endif
return 0;
}
|