summaryrefslogtreecommitdiff
path: root/trans
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 23:34:20 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 23:39:35 +0200
commit125f08eea403724713cea1c79913cc7d26406a07 (patch)
tree87048ea2656fbeb669fb010e6f2f5f32017574aa /trans
parent580eeae985138272dc0f8c24d1e7f470e31fbcc3 (diff)
trans/new-fifo: convert to trivfs dynamic classes and buckets
libtrivfs contains two ways of managing more than one port class and bucket. There is the old way of using a statically allocated array with explicit length, and the new way with dynamically allocated vectors. Converting all users to the new way of handling multiple classes and/or buckets, we can simplify the code in libtrivfs. In many cases, the code will be simpler and more expressive for the user. This also fixes a mild bug. The classes and buckets given to `trivfs_startup' end up in the dynamic vectors too, making the object lookup code use the more complicated code path. * trans/new-fifo.c: Convert to dynamic classes and buckets.
Diffstat (limited to 'trans')
-rw-r--r--trans/new-fifo.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/trans/new-fifo.c b/trans/new-fifo.c
index e71c95ca..0ceb8422 100644
--- a/trans/new-fifo.c
+++ b/trans/new-fifo.c
@@ -176,13 +176,6 @@ fifo_trans_parse_args (struct fifo_trans *trans, int argc, char **argv,
return argp_parse (&argp, argc, argv, print_errs ? 0 : ARGP_SILENT, 0, 0);
}
-/* ---------------------------------------------------------------- */
-
-struct port_class *trivfs_protid_portclasses[2];
-struct port_class *trivfs_cntl_portclasses[1];
-int trivfs_protid_nportclasses = 2;
-int trivfs_cntl_nportclasses = 1;
-
int
main (int argc, char **argv)
{
@@ -215,14 +208,21 @@ main (int argc, char **argv)
exit (0);
}
- port_bucket = ports_create_bucket ();
- fifo_port_class = ports_create_class (trivfs_clean_protid, 0);
- server_port_class = ports_create_class (trivfs_clean_protid, 0);
- fsys_port_class = ports_create_class (clean_fsys, 0);
+ err = trivfs_add_port_bucket (&port_bucket);
+ if (err)
+ error (1, 0, "error creating port bucket");
+
+ err = trivfs_add_control_port_class (&fsys_port_class);
+ if (err)
+ error (1, 0, "error creating control port class");
+
+ err = trivfs_add_protid_port_class (&fifo_port_class);
+ if (err)
+ error (1, 0, "error creating protid port class");
- trivfs_protid_portclasses[0] = fifo_port_class;
- trivfs_protid_portclasses[1] = server_port_class;
- trivfs_cntl_portclasses[0] = fsys_port_class;
+ err = trivfs_add_protid_port_class (&server_port_class);
+ if (err)
+ error (1, 0, "error creating protid port class");
/* Reply to our parent */
fifo_trans_start (trans, bootstrap);