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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
|
diff --git a/devnode/Makefile b/devnode/Makefile
index d9a9c23..9529fa7 100644
--- a/devnode/Makefile
+++ b/devnode/Makefile
@@ -24,6 +24,7 @@ HURDLIBS = ports trivfs fshelp shouldbeinlibc
target = devnode
MIGSTUBS = deviceServer.o notifyServer.o
MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
+device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
include ../Makeconf
diff --git a/devnode/devnode.c b/devnode/devnode.c
index 789bf51..f9f0359 100644
--- a/devnode/devnode.c
+++ b/devnode/devnode.c
@@ -138,27 +138,6 @@ do_mach_notify_dead_name (struct port_info *pi,
}
/* Implementation of device interface */
-kern_return_t
-ds_xxx_device_set_status (device_t device, dev_flavor_t flavor,
- dev_status_t status, size_t statu_cnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_get_status (device_t device, dev_flavor_t flavor,
- dev_status_t status, size_t *statuscnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_set_filter (device_t device, mach_port_t rec,
- int pri, filter_array_t filt, size_t len)
-{
- return D_INVALID_OPERATION;
-}
-
kern_return_t
ds_device_open (mach_port_t master_port, mach_port_t reply_port,
mach_msg_type_name_t reply_portPoly,
diff --git a/devnode/mig-mutate.h b/devnode/mig-mutate.h
index f692236..0656014 100644
--- a/devnode/mig-mutate.h
+++ b/devnode/mig-mutate.h
@@ -19,6 +19,8 @@
#define NOTIFY_INTRAN \
port_info_t begin_using_port_info_port (mach_port_t)
+#define NOTIFY_INTRAN_PAYLOAD \
+ port_info_t begin_using_port_info_payload
#define NOTIFY_DESTRUCTOR \
end_using_port_info (port_info_t)
#define NOTIFY_IMPORTS \
diff --git a/eth-filter/filter.c b/eth-filter/filter.c
index 482b080..13dd03b 100644
--- a/eth-filter/filter.c
+++ b/eth-filter/filter.c
@@ -294,27 +294,6 @@ do_mach_notify_dead_name (struct port_info *pi,
}
/* Implementation of device interface */
-kern_return_t
-ds_xxx_device_set_status (struct proxy_user *device, dev_flavor_t flavor,
- dev_status_t status, size_t statu_cnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_get_status (struct proxy_user *device, dev_flavor_t flavor,
- dev_status_t status, size_t *statuscnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_set_filter (struct proxy_user *device, mach_port_t rec,
- int pri, filter_array_t filt, size_t len)
-{
- return D_INVALID_OPERATION;
-}
-
kern_return_t
ds_device_open (mach_port_t master_port, mach_port_t reply_port,
mach_msg_type_name_t reply_portPoly,
diff --git a/eth-filter/mig-decls.h b/eth-filter/mig-decls.h
index 0bb29a6..a3f700c 100644
--- a/eth-filter/mig-decls.h
+++ b/eth-filter/mig-decls.h
@@ -35,6 +35,12 @@ begin_using_device_port (mach_port_t port)
return ports_lookup_port (port_bucket, port, user_portclass);
}
+static inline struct proxy_user * __attribute__ ((unused))
+begin_using_device_payload (unsigned long payload)
+{
+ return ports_lookup_payload (port_bucket, payload, user_portclass);
+}
+
static inline void __attribute__ ((unused))
end_using_device (struct proxy_user *p)
{
diff --git a/eth-filter/mig-mutate.h b/eth-filter/mig-mutate.h
index 388ce09..5c6cde9 100644
--- a/eth-filter/mig-mutate.h
+++ b/eth-filter/mig-mutate.h
@@ -19,6 +19,8 @@
#define NOTIFY_INTRAN \
port_info_t begin_using_port_info_port (mach_port_t)
+#define NOTIFY_INTRAN_PAYLOAD \
+ port_info_t begin_using_port_info_payload
#define NOTIFY_DESTRUCTOR \
end_using_port_info (port_info_t)
#define NOTIFY_IMPORTS \
@@ -26,6 +28,8 @@
#define DEVICE_INTRAN \
proxy_user_t begin_using_device_port (mach_port_t)
+#define DEVICE_INTRAN_PAYLOAD \
+ proxy_user_t begin_using_device_payload
#define DEVICE_DESTRUCTOR \
end_using_device (proxy_user_t)
#define DEVICE_IMPORTS \
diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile
index fbee1ca..bfd065a 100644
--- a/eth-multiplexer/Makefile
+++ b/eth-multiplexer/Makefile
@@ -23,6 +23,7 @@ target = eth-multiplexer
SRCS = ethernet.c vdev.c multiplexer.c dev_stat.c netfs_impl.c notify_impl.c device_impl.c demuxer.c
MIGSTUBS = deviceServer.o notifyServer.o
MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
+device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h
HURDLIBS=ports fshelp shouldbeinlibc netfs bpf
diff --git a/eth-multiplexer/device.h b/eth-multiplexer/device.h
deleted file mode 100644
index db0798d..0000000
--- a/eth-multiplexer/device.h
+++ /dev/null
@@ -1,336 +0,0 @@
-#ifndef _device_user_
-#define _device_user_
-
-/* Module device */
-
-#include <mach/kern_return.h>
-#include <mach/port.h>
-#include <mach/message.h>
-
-#include <mach/std_types.h>
-#include <mach/mach_types.h>
-#include <device/device_types.h>
-#include <device/net_status.h>
-
-/* Routine device_open */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_open
-#if defined(LINTLIBRARY)
- (master_port, mode, name, device)
- mach_port_t master_port;
- dev_mode_t mode;
- dev_name_t name;
- mach_port_t *device;
-{ return device_open(master_port, mode, name, device); }
-#else
-(
- mach_port_t master_port,
- dev_mode_t mode,
- dev_name_t name,
- mach_port_t *device
-);
-#endif
-
-/* Routine device_close */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_close
-#if defined(LINTLIBRARY)
- (device)
- mach_port_t device;
-{ return device_close(device); }
-#else
-(
- mach_port_t device
-);
-#endif
-
-/* Routine device_write */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_write
-#if defined(LINTLIBRARY)
- (device, mode, recnum, data, dataCnt, bytes_written)
- mach_port_t device;
- dev_mode_t mode;
- recnum_t recnum;
- io_buf_ptr_t data;
- mach_msg_type_number_t dataCnt;
- int *bytes_written;
-{ return device_write(device, mode, recnum, data, dataCnt, bytes_written); }
-#else
-(
- mach_port_t device,
- dev_mode_t mode,
- recnum_t recnum,
- io_buf_ptr_t data,
- mach_msg_type_number_t dataCnt,
- int *bytes_written
-);
-#endif
-
-/* Routine device_write_inband */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_write_inband
-#if defined(LINTLIBRARY)
- (device, mode, recnum, data, dataCnt, bytes_written)
- mach_port_t device;
- dev_mode_t mode;
- recnum_t recnum;
- io_buf_ptr_inband_t data;
- mach_msg_type_number_t dataCnt;
- int *bytes_written;
-{ return device_write_inband(device, mode, recnum, data, dataCnt, bytes_written); }
-#else
-(
- mach_port_t device,
- dev_mode_t mode,
- recnum_t recnum,
- io_buf_ptr_inband_t data,
- mach_msg_type_number_t dataCnt,
- int *bytes_written
-);
-#endif
-
-/* Routine device_read */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_read
-#if defined(LINTLIBRARY)
- (device, mode, recnum, bytes_wanted, data, dataCnt)
- mach_port_t device;
- dev_mode_t mode;
- recnum_t recnum;
- int bytes_wanted;
- io_buf_ptr_t *data;
- mach_msg_type_number_t *dataCnt;
-{ return device_read(device, mode, recnum, bytes_wanted, data, dataCnt); }
-#else
-(
- mach_port_t device,
- dev_mode_t mode,
- recnum_t recnum,
- int bytes_wanted,
- io_buf_ptr_t *data,
- mach_msg_type_number_t *dataCnt
-);
-#endif
-
-/* Routine device_read_inband */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_read_inband
-#if defined(LINTLIBRARY)
- (device, mode, recnum, bytes_wanted, data, dataCnt)
- mach_port_t device;
- dev_mode_t mode;
- recnum_t recnum;
- int bytes_wanted;
- io_buf_ptr_inband_t data;
- mach_msg_type_number_t *dataCnt;
-{ return device_read_inband(device, mode, recnum, bytes_wanted, data, dataCnt); }
-#else
-(
- mach_port_t device,
- dev_mode_t mode,
- recnum_t recnum,
- int bytes_wanted,
- io_buf_ptr_inband_t data,
- mach_msg_type_number_t *dataCnt
-);
-#endif
-
-/* Routine xxx_device_set_status */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t xxx_device_set_status
-#if defined(LINTLIBRARY)
- (device, flavor, status, statusCnt)
- mach_port_t device;
- dev_flavor_t flavor;
- dev_status_t status;
- mach_msg_type_number_t statusCnt;
-{ return xxx_device_set_status(device, flavor, status, statusCnt); }
-#else
-(
- mach_port_t device,
- dev_flavor_t flavor,
- dev_status_t status,
- mach_msg_type_number_t statusCnt
-);
-#endif
-
-/* Routine xxx_device_get_status */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t xxx_device_get_status
-#if defined(LINTLIBRARY)
- (device, flavor, status, statusCnt)
- mach_port_t device;
- dev_flavor_t flavor;
- dev_status_t status;
- mach_msg_type_number_t *statusCnt;
-{ return xxx_device_get_status(device, flavor, status, statusCnt); }
-#else
-(
- mach_port_t device,
- dev_flavor_t flavor,
- dev_status_t status,
- mach_msg_type_number_t *statusCnt
-);
-#endif
-
-/* Routine xxx_device_set_filter */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t xxx_device_set_filter
-#if defined(LINTLIBRARY)
- (device, receive_port, receive_portPoly, priority, filter, filterCnt)
- mach_port_t device;
- mach_port_t receive_port;
- mach_msg_type_name_t receive_portPoly;
- int priority;
- filter_array_t filter;
- mach_msg_type_number_t filterCnt;
-{ return xxx_device_set_filter(device, receive_port, receive_portPoly, priority, filter, filterCnt); }
-#else
-(
- mach_port_t device,
- mach_port_t receive_port,
- mach_msg_type_name_t receive_portPoly,
- int priority,
- filter_array_t filter,
- mach_msg_type_number_t filterCnt
-);
-#endif
-
-/* Routine device_map */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_map
-#if defined(LINTLIBRARY)
- (device, prot, offset, size, pager, unmap)
- mach_port_t device;
- vm_prot_t prot;
- vm_offset_t offset;
- vm_size_t size;
- mach_port_t *pager;
- int unmap;
-{ return device_map(device, prot, offset, size, pager, unmap); }
-#else
-(
- mach_port_t device,
- vm_prot_t prot,
- vm_offset_t offset,
- vm_size_t size,
- mach_port_t *pager,
- int unmap
-);
-#endif
-
-/* Routine device_set_status */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_set_status
-#if defined(LINTLIBRARY)
- (device, flavor, status, statusCnt)
- mach_port_t device;
- dev_flavor_t flavor;
- dev_status_t status;
- mach_msg_type_number_t statusCnt;
-{ return device_set_status(device, flavor, status, statusCnt); }
-#else
-(
- mach_port_t device,
- dev_flavor_t flavor,
- dev_status_t status,
- mach_msg_type_number_t statusCnt
-);
-#endif
-
-/* Routine device_get_status */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_get_status
-#if defined(LINTLIBRARY)
- (device, flavor, status, statusCnt)
- mach_port_t device;
- dev_flavor_t flavor;
- dev_status_t status;
- mach_msg_type_number_t *statusCnt;
-{ return device_get_status(device, flavor, status, statusCnt); }
-#else
-(
- mach_port_t device,
- dev_flavor_t flavor,
- dev_status_t status,
- mach_msg_type_number_t *statusCnt
-);
-#endif
-
-/* Routine device_set_filter */
-#ifdef mig_external
-mig_external
-#else
-extern
-#endif
-kern_return_t device_set_filter
-#if defined(LINTLIBRARY)
- (device, receive_port, receive_portPoly, priority, filter, filterCnt)
- mach_port_t device;
- mach_port_t receive_port;
- mach_msg_type_name_t receive_portPoly;
- int priority;
- filter_array_t filter;
- mach_msg_type_number_t filterCnt;
-{ return device_set_filter(device, receive_port, receive_portPoly, priority, filter, filterCnt); }
-#else
-(
- mach_port_t device,
- mach_port_t receive_port,
- mach_msg_type_name_t receive_portPoly,
- int priority,
- filter_array_t filter,
- mach_msg_type_number_t filterCnt
-);
-#endif
-
-#endif /* not defined(_device_user_) */
diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c
index 35a4da4..7d82b8d 100644
--- a/eth-multiplexer/device_impl.c
+++ b/eth-multiplexer/device_impl.c
@@ -39,32 +39,6 @@ extern struct port_class *other_portclass;
extern struct port_info *notify_pi;
/* Implementation of device interface */
-kern_return_t
-ds_xxx_device_set_status (struct vether_device *vdev, dev_flavor_t flavor,
- dev_status_t status, size_t statu_cnt)
-{
- if (vdev == NULL)
- return D_NO_SUCH_DEVICE;
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_get_status (struct vether_device *vdev, dev_flavor_t flavor,
- dev_status_t status, size_t *statuscnt)
-{
- if (vdev == NULL)
- return D_NO_SUCH_DEVICE;
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_set_filter (struct vether_device *vdev, mach_port_t rec,
- int pri, filter_array_t filt, size_t len)
-{
- if (vdev == NULL)
- return D_NO_SUCH_DEVICE;
- return D_INVALID_OPERATION;
-}
/*
* This function is currently running in the multithread environment,
diff --git a/eth-multiplexer/mig-decls.h b/eth-multiplexer/mig-decls.h
index a68e2ec..6ad9ebf 100644
--- a/eth-multiplexer/mig-decls.h
+++ b/eth-multiplexer/mig-decls.h
@@ -35,6 +35,12 @@ begin_using_device_port (mach_port_t port)
return ports_lookup_port (port_bucket, port, vdev_portclass);
}
+static inline struct vether_device * __attribute__ ((unused))
+begin_using_device_payload (unsigned long payload)
+{
+ return ports_lookup_payload (port_bucket, payload, vdev_portclass);
+}
+
static inline void __attribute__ ((unused))
end_using_device (struct vether_device *p)
{
diff --git a/eth-multiplexer/mig-mutate.h b/eth-multiplexer/mig-mutate.h
index 2403c29..55eca31 100644
--- a/eth-multiplexer/mig-mutate.h
+++ b/eth-multiplexer/mig-mutate.h
@@ -19,6 +19,8 @@
#define NOTIFY_INTRAN \
port_info_t begin_using_port_info_port (mach_port_t)
+#define NOTIFY_INTRAN_PAYLOAD \
+ port_info_t begin_using_port_info_payload
#define NOTIFY_DESTRUCTOR \
end_using_port_info (port_info_t)
#define NOTIFY_IMPORTS \
@@ -26,6 +28,8 @@
#define DEVICE_INTRAN \
vether_device_t begin_using_device_port (mach_port_t)
+#define DEVICE_INTRAN_PAYLOAD \
+ vether_device_t begin_using_device_payload
#define DEVICE_DESTRUCTOR \
end_using_device (vether_device_t)
#define DEVICE_IMPORTS \
diff --git a/libmachdev/Makefile b/libmachdev/Makefile
index a47bf32..734824e 100644
--- a/libmachdev/Makefile
+++ b/libmachdev/Makefile
@@ -29,6 +29,7 @@ HURDLIBS = ports trivfs ddekit bpf
OTHERLIBS = -lpthread
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
+device-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name"
include ../Makeconf
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 6bd5a12..5287bf4 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -98,41 +98,6 @@ mach_convert_device_to_port (mach_device_t device)
}
/* Implementation of device interface */
-kern_return_t
-ds_xxx_device_set_status (struct mach_device *device, dev_flavor_t flavor,
- dev_status_t status, size_t statu_cnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_get_status (struct mach_device *device, dev_flavor_t flavor,
- dev_status_t status, size_t *statuscnt)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_xxx_device_set_filter (struct mach_device *device, mach_port_t rec,
- int pri, filter_array_t filt, size_t len)
-{
- return D_INVALID_OPERATION;
-}
-
-io_return_t
-ds_device_intr_register (mach_port_t master_port, int irq,
- int flags, int id, mach_port_t receive_port)
-{
- return D_INVALID_OPERATION;
-}
-
-kern_return_t
-ds_device_intr_enable (mach_port_t master_port,
- int line, char status)
-{
- return D_INVALID_OPERATION;
-}
-
io_return_t
ds_device_open (mach_port_t open_port, mach_port_t reply_port,
mach_msg_type_name_t reply_port_type, dev_mode_t mode,
diff --git a/libmachdev/mig-decls.h b/libmachdev/mig-decls.h
index b3dc43d..8302029 100644
--- a/libmachdev/mig-decls.h
+++ b/libmachdev/mig-decls.h
@@ -34,6 +34,12 @@ begin_using_device_port (mach_port_t port)
return ports_lookup_port (device_bucket, port, dev_class);
}
+static inline struct mach_device * __attribute__ ((unused))
+begin_using_device_payload (unsigned long payload)
+{
+ return ports_lookup_payload (device_bucket, payload, dev_class);
+}
+
static inline void __attribute__ ((unused))
end_using_device (struct mach_device *p)
{
diff --git a/libmachdev/mig-mutate.h b/libmachdev/mig-mutate.h
index 56c6965..902ff16 100644
--- a/libmachdev/mig-mutate.h
+++ b/libmachdev/mig-mutate.h
@@ -19,6 +19,8 @@
#define NOTIFY_INTRAN \
port_info_t begin_using_port_info_port (mach_port_t)
+#define NOTIFY_INTRAN_PAYLOAD \
+ port_info_t begin_using_port_info_payload
#define NOTIFY_DESTRUCTOR \
end_using_port_info (port_info_t)
#define NOTIFY_IMPORTS \
@@ -26,6 +28,8 @@
#define DEVICE_INTRAN \
mach_device_t begin_using_device_port (mach_port_t)
+#define DEVICE_INTRAN_PAYLOAD \
+ mach_device_t begin_using_device_payload
#define DEVICE_DESTRUCTOR \
end_using_device (mach_device_t)
#define DEVICE_IMPORTS \
|