summaryrefslogtreecommitdiff
path: root/libmachdev/ds_routines.c
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2010-05-31 17:21:47 +0200
committerZheng Da <zhengda1936@gmail.com>2010-05-31 17:21:47 +0200
commit2fe1437bd35016309e9ac4cfe57fb3daca3ba0a0 (patch)
treed3d82562d28483574caab94c6a35ae3ad3e92fc2 /libmachdev/ds_routines.c
parent8be479740f0d7cdf8e78bf5c62ba934afdd9dca1 (diff)
make glue code of networking more independant.
This change is required for block device drivers. When block device drivers are linked to the glue code, the linker should be able to perform garbage collection and exclude the code of networking from the driver programs.
Diffstat (limited to 'libmachdev/ds_routines.c')
-rw-r--r--libmachdev/ds_routines.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 1961a2f3..f6a8e76c 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -73,13 +73,12 @@ static struct port_class *dev_class;
extern struct device_emulation_ops linux_net_emulation_ops;
-#define NUM_EMULATION (sizeof (emulation_list) / sizeof (emulation_list[0]))
+#define NUM_EMULATION num_emul
+#define MAX_NUM_EMULATION 32
/* List of emulations. */
-static struct device_emulation_ops *emulation_list[] =
-{
- &linux_net_emulation_ops,
-};
+static struct device_emulation_ops *emulation_list[MAX_NUM_EMULATION];
+static int num_emul;
boolean_t is_master_device (mach_port_t port);
@@ -447,6 +446,11 @@ demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
return ret;
}
+void reg_dev_emul (struct device_emulation_ops *ops)
+{
+ emulation_list[num_emul++] = ops;
+}
+
void ds_server()
{
/* Launch. */