[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 10/23: trans/magic: convert to trivfs dynamic classes and buckets
From: |
Samuel Thibault |
Subject: |
[hurd] 10/23: trans/magic: convert to trivfs dynamic classes and buckets |
Date: |
Tue, 13 Oct 2015 00:09:55 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 580eeae985138272dc0f8c24d1e7f470e31fbcc3
Author: Justus Winter <address@hidden>
Date: Sun Sep 27 23:35:26 2015 +0200
trans/magic: 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 severe bug. As no classes are given to
`trivfs_startup', they are created and inserted into the dynamic
vector of classes. The server function `trivfs_S_fsys_forward',
however, used the first item of the previously used static array,
which is NULL. This circumvented the typecheck.
* trans/magic.c: Convert to dynamic classes and buckets.
---
trans/magic.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/trans/magic.c b/trans/magic.c
index 5808483..a033db9 100644
--- a/trans/magic.c
+++ b/trans/magic.c
@@ -74,6 +74,9 @@ static struct trivfs_control *all_fsys;
/* Trivfs hooks */
+/* Our port class. */
+struct port_class *trivfs_protid_class;
+
int trivfs_fstype = FSTYPE_DEV;
int trivfs_fsid = 0;
@@ -480,8 +483,12 @@ main (int argc, char **argv)
if (m->directory)
trivfs_peropen_destroy_hook = &magic_peropen_destroy;
+ err = trivfs_add_protid_port_class (&trivfs_protid_class);
+ if (err)
+ error (1, 0, "error creating protid port class");
+
/* Reply to our parent */
- err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
+ err = trivfs_startup (bootstrap, 0, 0, 0, trivfs_protid_class, 0, &fsys);
mach_port_deallocate (mach_task_self (), bootstrap);
if (err)
error (3, err, "Contacting parent");
@@ -521,8 +528,7 @@ trivfs_S_fsys_forward (mach_port_t server,
char *argz, size_t argz_len)
{
struct trivfs_protid *cred
- = ports_lookup_port (all_fsys->pi.bucket, server,
- trivfs_protid_portclasses[0]);
+ = ports_lookup_port (all_fsys->pi.bucket, server, trivfs_protid_class);
if (!cred)
return EOPNOTSUPP;
ports_port_deref (cred);
@@ -547,8 +553,8 @@ trivfs_S_fsys_forward (mach_port_t server,
/* Now we are ready to start up the filesystem. Contact the parent. */
struct trivfs_control *fsys;
err = trivfs_startup (requestor, 0,
- trivfs_cntl_portclasses[0], all_fsys->pi.bucket,
- trivfs_protid_portclasses[0], all_fsys->pi.bucket,
+ NULL, all_fsys->pi.bucket,
+ NULL, all_fsys->pi.bucket,
&fsys);
if (err)
{
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (3f883d3 -> b989189), Samuel Thibault, 2015/10/12
- [hurd] 18/23: Update NEWS file, Samuel Thibault, 2015/10/12
- [hurd] 15/23: libtrivfs: deprecate old api, Samuel Thibault, 2015/10/12
- [hurd] 19/23: Add missing null checks in libshouldbeinlibc, Samuel Thibault, 2015/10/12
- [hurd] 21/23: Make netfs_S_io_reauthenticate handle allocation errors, Samuel Thibault, 2015/10/12
- [hurd] 20/23: Drop duplicate port deallocation, Samuel Thibault, 2015/10/12
- [hurd] 14/23: libtrivfs: optimize the object lookup code, Samuel Thibault, 2015/10/12
- [hurd] 23/23: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/10/12
- [hurd] 10/23: trans/magic: convert to trivfs dynamic classes and buckets,
Samuel Thibault <=
- [hurd] 04/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/12
- [hurd] 11/23: trans/new-fifo: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 07/23: pflocal: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 09/23: trans/ifsock: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 12/23: trans/passwd: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 13/23: trans/proxy-defpager: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 17/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/15
- [hurd] 22/23: Make dir_lookup create files with user permissions enabled, Samuel Thibault, 2015/10/15
- [hurd] 16/23: Minor documentation changes, Samuel Thibault, 2015/10/15
- [hurd] 03/23: libdiskfs: improve error handling, Samuel Thibault, 2015/10/15