summaryrefslogtreecommitdiff
path: root/filesystems/u9fs/patches/patch-ab
blob: d00ae011a185f6cab2d2e76a891e8f621ae7bf4d (plain)
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
$NetBSD: patch-ab,v 1.3 2014/02/09 17:23:54 wiedi Exp $

--- u9fs.c.orig	2005-06-06 19:26:52.000000000 +0000
+++ u9fs.c
@@ -28,7 +28,17 @@
 #define DEFAULTLOG "/tmp/u9fs.log"
 #endif
 
+#if __linux__
 #include <linux/kdev_t.h>
+#elif defined(__NetBSD__) || defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__sun)
+#if defined(__sun)
+# include <sys/mkdev.h>
+#endif
+#include <sys/types.h>
+#define MAJOR(m)	major(m)
+#define MINOR(m)	minor(m)
+#define MKDEV(maj,min)	makedev(maj, min)
+#endif
 
 char *logfile = DEFAULTLOG;
 char *rootpath = "/";
@@ -752,11 +762,11 @@ stat2dir(char *path, struct stat *st, Di
 			}
 			d->extension = estrdup(link);
 		} else if (d->mode&DMDEVICE) {
-			int major = MAJOR(st->st_rdev);
-			int minor = MINOR(st->st_rdev);
+			int majordev = MAJOR(st->st_rdev);
+			int minordev = MINOR(st->st_rdev);
 
 			if(S_ISCHR(st->st_mode)) {
-				sprintf(link, "c %u %u", major, minor);
+				sprintf(link, "c %u %u", majordev, minordev);
 			} else {
 				sprintf(link, "b %u %u", MAJOR(st->st_rdev), MINOR(st->st_rdev));
 			}