Package: dvdisaster / 0.79.5-10

31-improve-hurd-and-kfreebsd-support.patch Patch series | download
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
From: Carlos Maddela <e7appew@gmail.com>
Date: Sun, 6 Aug 2017 10:37:18 +1000
Subject: Add better support for HURD and kFreeBSD systems.

Description: Add better support for HURD and kFreeBSD systems.
 Hurd still compiles without SCSI layer, however.
Author: Carlos Maddela <e7appew@gmail.com>
Last-Update: 2017-08-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---
 cacheprobe.c                 | 16 +++++++++-------
 closure.c                    |  6 ++++--
 scripts/bash-based-configure | 18 ++++++++++++++++++
 scsi-freebsd.c               |  4 ++--
 scsi-layer.c                 | 10 ++++++----
 scsi-layer.h                 | 17 +++++++++--------
 scsi-unknown.c               |  4 ++--
 show-html.c                  | 15 ++++++++++-----
 8 files changed, 60 insertions(+), 30 deletions(-)

diff --git a/cacheprobe.c b/cacheprobe.c
index 60c55f9..f30f5d3 100644
--- a/cacheprobe.c
+++ b/cacheprobe.c
@@ -22,7 +22,8 @@
 
 #include "dvdisaster.h"
 
-#ifdef SYS_LINUX
+#if defined(SYS_LINUX)
+
 int ProbeCacheLineSize()
 {  int cl_size = 0;
 
@@ -36,9 +37,9 @@ int ProbeCacheLineSize()
 
    return cl_size;
 }
-#endif
 
-#ifdef SYS_FREEBSD
+#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
+
 #include <sys/param.h>
 
 int ProbeCacheLineSize()
@@ -52,9 +53,9 @@ int ProbeCacheLineSize()
 
    return cl_size;
 }
-#endif
 
-#ifdef SYS_NETBSD
+#elif defined(SYS_NETBSD)
+
 #include <sys/param.h>
 
 int ProbeCacheLineSize()
@@ -68,13 +69,14 @@ int ProbeCacheLineSize()
 
    return cl_size;
 }
-#endif
 
-#ifdef SYS_UNKNOWN
+#else /* SYS_UNKNOWN and others. */
+
 int ProbeCacheLineSize()
 {
   return 64;
 }
+
 #endif
 
 
diff --git a/closure.c b/closure.c
index f408f7a..f4b1893 100644
--- a/closure.c
+++ b/closure.c
@@ -50,7 +50,8 @@ static void get_base_dirs()
    /*** Otherwise try the installation directory. 
 	On Unices this is a hardcoded directory. */
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD) || defined(SYS_UNKNOWN)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD) || defined(SYS_UNKNOWN)
    if(DirStat(BINDIR))
      Closure->binDir = g_strdup(BINDIR);
 
@@ -425,7 +426,8 @@ void InitClosure()
 
    /* Generate a more comprehensive version string */
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
   #ifdef HAVE_64BIT
     #define BITNESS_STRING " 64bit"
   #else
diff --git a/scripts/bash-based-configure b/scripts/bash-based-configure
index d62f5d7..9abcf96 100644
--- a/scripts/bash-based-configure
+++ b/scripts/bash-based-configure
@@ -136,6 +136,15 @@ case "$cfg_uname" in
 	}
 	;;
 
+  GNU/kFreeBSD*) cfg_system=kfreebsd
+	CFG_SYS_OPTIONS="-DSYS_KFREEBSD"
+	CFG_SYS_NAME="-DSYS_NAME=\\\"GNU/kFreeBSD\\\""
+	CFG_EXE_SUFFIX=""
+	function add_linker_flags()
+	{  lflags_return="-L$1 -Wl,-rpath,$1 $2"
+	}
+	;;
+
   NetBSD*) cfg_system=netbsd
         CFG_SYS_OPTIONS="-DSYS_NETBSD"
 	CFG_SYS_NAME="-DSYS_NAME=\\\"NetBSD\\\""
@@ -146,6 +155,15 @@ case "$cfg_uname" in
 	}
 	;;
 
+  GNU*) cfg_system=hurd
+	CFG_SYS_OPTIONS="-DSYS_HURD"
+	CFG_SYS_NAME="-DSYS_NAME=\\\"GNU/Hurd\\\""
+	CFG_EXE_SUFFIX=""
+	function add_linker_flags()
+	{  lflags_return="-L$1 -Wl,-rpath,$1 $2"
+	}
+	;;
+
   *) cfg_system=unknown-system
         CFG_SYS_OPTIONS="-DSYS_UNKNOWN"
 	CFG_SYS_NAME="-DSYS_NAME=\\\"Unknown\\\""
diff --git a/scsi-freebsd.c b/scsi-freebsd.c
index 78d0be4..793f206 100644
--- a/scsi-freebsd.c
+++ b/scsi-freebsd.c
@@ -25,7 +25,7 @@
 #include "scsi-layer.h"
 #include "udf.h"
 
-#ifdef SYS_FREEBSD
+#if defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
 
 /* SCSI wrappers for FreeBSD are still work in progress. */
 
@@ -241,4 +241,4 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
    return -1;
 }
 
-#endif /* SYS_FREEBSD */
+#endif /* defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) */
diff --git a/scsi-layer.c b/scsi-layer.c
index 515cc93..609cb73 100644
--- a/scsi-layer.c
+++ b/scsi-layer.c
@@ -2005,12 +2005,13 @@ static gint64 query_size(Image *image)
  */
 
 gint64 CurrentMediumSize(int get_blank_size)
-{  Image *image;
+{
+#if defined(SYS_UNKNOWN) || defined(SYS_HURD)
+   return 0;
+#else
+   Image *image;
    gint64 size;
 
-#ifdef SYS_UNKNOWN
-   return 0;
-#endif
 
    image = OpenImageFromDevice(Closure->device);
    if(!image) return 0;
@@ -2051,6 +2052,7 @@ gint64 CurrentMediumSize(int get_blank_size)
    CloseImage(image);
 
    return size;
+#endif
 }
 
 /***
diff --git a/scsi-layer.h b/scsi-layer.h
index cc7d9fc..0706a22 100644
--- a/scsi-layer.h
+++ b/scsi-layer.h
@@ -28,7 +28,7 @@
 #include <linux/cdrom.h>
 #endif
 
-#ifdef SYS_FREEBSD
+#if defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
 #include <camlib.h>
 #endif
 
@@ -49,19 +49,21 @@
  * Linux already has one 
  */
 
-#ifdef SYS_LINUX
+#if defined(SYS_LINUX)
+
 #define MAX_CDB_SIZE CDROM_PACKET_SIZE
 
 /* Now globally defined for all OSes here */
 //typedef struct request_sense Sense;
-#endif
 
-#ifdef SYS_FREEBSD
+#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
+
 #define MAX_CDB_SIZE SCSI_MAX_CDBLEN
-#endif
 
-#if defined(SYS_UNKNOWN) || defined(SYS_NETBSD)
+#else /* SYS_UNKNOWN and others. */
+
 #define MAX_CDB_SIZE 16   /* longest possible SCSI command */
+
 #endif
 
 /* 
@@ -101,8 +103,7 @@ typedef struct _DeviceHandle
     */
 #if defined(SYS_LINUX) || defined(SYS_NETBSD)
    int fd;                    /* device file descriptor */
-#endif
-#ifdef SYS_FREEBSD
+#elif defined(SYS_FREEBSD) || defined(SYS_KFREEBSD)
    struct cam_device *camdev; /* camlib device handle */
    union ccb *ccb;
 #endif
diff --git a/scsi-unknown.c b/scsi-unknown.c
index e9183f6..ef54552 100644
--- a/scsi-unknown.c
+++ b/scsi-unknown.c
@@ -25,7 +25,7 @@
 #include "scsi-layer.h"
 #include "udf.h"
 
-#ifdef SYS_UNKNOWN
+#if defined(SYS_UNKNOWN) || defined(SYS_HURD)
 
 /* Dummy routines so that we can compile on unknown architectures
    for which we don't have SCSI support yet. */
@@ -51,4 +51,4 @@ int SendPacket(DeviceHandle *dh, unsigned char *cmd, int cdb_size, unsigned char
    return -1;
 }
 
-#endif /* SYS_UNKNOWN */
+#endif /* defined(SYS_UNKNOWN) || defined(SYS_HURD) */
diff --git a/show-html.c b/show-html.c
index 608e8ec..20715f4 100644
--- a/show-html.c
+++ b/show-html.c
@@ -21,7 +21,8 @@
 
 #include "dvdisaster.h"
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
 #include <sys/wait.h>
 #endif
 
@@ -34,7 +35,8 @@
  *** Ask user to specify his browser
  ***/
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
 
 #define SEARCH_BUTTON 1
 
@@ -173,7 +175,8 @@ static void msg_destroy_cb(GtkWidget *widget, gpointer data)
    bi->msg = NULL; 
 }
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) ||  defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
 
 /* 
  * The following list of browsers and html wrappers
@@ -273,7 +276,8 @@ static gboolean browser_timeout_func(gpointer data)
  * Invoke the browser
  */
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
 static void try_browser(browser_info *bi)
 {  pid_t pid;
 
@@ -393,7 +397,8 @@ void ShowHTML(char *target)
    g_timeout_add(1000, browser_timeout_func, (gpointer)bi);
 #endif
 
-#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_NETBSD)
+#if defined(SYS_LINUX) || defined(SYS_FREEBSD) || defined(SYS_KFREEBSD) || \
+    defined(SYS_NETBSD) || defined(SYS_HURD)
    /* Try the first browser */
 
    browser_index = 0;