summaryrefslogtreecommitdiff
path: root/sysutils/open-vm-tools/patches/patch-az
blob: bee955b91feef45d4fa273ba4ef6d6d005f0bf64 (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
38
39
40
41
42
43
44
45
46
47
48
$NetBSD: patch-az,v 1.3 2016/10/09 03:41:56 ryoon Exp $

--- lib/include/vmblock.h.orig	2016-02-16 20:06:46.000000000 +0000
+++ lib/include/vmblock.h
@@ -83,11 +83,11 @@
 #ifndef _VMBLOCK_H_
 #define _VMBLOCK_H_
 
-#if defined(sun) || defined(__FreeBSD__)
+#if defined(sun) || defined(__FreeBSD__) || defined(__NetBSD__)
 # include <sys/ioccom.h>
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 # include <sys/param.h>
 #endif
 
@@ -164,7 +164,7 @@
                                        "/" VMBLOCK_CONTROL_DEVNAME
 # define VMBLOCK_DEVICE_MODE            O_WRONLY
 
-#elif defined(sun) || defined(__FreeBSD__)
+#elif defined(sun) || defined(__FreeBSD__) || defined(__NetBSD__)
 # define VMBLOCK_FS_NAME                "vmblock"
 # define VMBLOCK_MOUNT_POINT            "/var/run/" VMBLOCK_FS_NAME
 # define VMBLOCK_FS_ROOT                VMBLOCK_MOUNT_POINT
@@ -196,6 +196,20 @@
 #   define VMBLOCK_LIST_FILEBLOCKS       _IO('Z', 3)
 #   define VMBLOCK_PURGE_FILEBLOCKS      _IO('Z', 4)
 #  endif
+# elif defined(__NetBSD__)               /* } else if (NetBSD) { */
+   /*
+    * Similar to Solaris, construct ioctl(2) commands for block operations.
+    * Since the FreeBSD implementation does not change the user's passed-in
+    * data (pathname), we use the _IOW macro to define commands which write
+    * to the kernel.  (As opposed to _IOR or _IOWR.)  Groups 'v' and 'V'
+    * are taken by terminal drivers, so I opted for group 'Z'.
+    */
+#  define VMBLOCK_ADD_FILEBLOCK          _IOW('z', 1, char[MAXPATHLEN] )
+#  define VMBLOCK_DEL_FILEBLOCK          _IOW('z', 2, char[MAXPATHLEN] )
+#  ifdef VMX86_DEVEL
+#   define VMBLOCK_LIST_FILEBLOCKS       _IO('z', 3)
+#   define VMBLOCK_PURGE_FILEBLOCKS      _IO('z', 4)
+#  endif
 
 # endif                                 /* } */
 #else