summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib.c2
-rw-r--r--node.c62
-rw-r--r--node.h31
-rw-r--r--nsmux.c65
4 files changed, 26 insertions, 134 deletions
diff --git a/lib.c b/lib.c
index e8cb3a0d9..17de80318 100644
--- a/lib.c
+++ b/lib.c
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------*/
-/*lib.h*/
+/*lib.c*/
/*---------------------------------------------------------------------------*/
/*Basic routines for filesystem manipulations*/
/*---------------------------------------------------------------------------*/
diff --git a/node.c b/node.c
index f98966a45..7df0afc17 100644
--- a/node.c
+++ b/node.c
@@ -94,9 +94,10 @@ error_t node_create (lnode_t * lnode, node_t ** node)
node_new->nn->flags = 0;
node_new->nn->ncache_next = node_new->nn->ncache_prev = NULL;
- /*initialize the list of translators */
- node_new->nn->trans = NULL;
- node_new->nn->ntrans = node_new->nn->translen = 0;
+ /*initialize the data fields dealing with positioning this node
+ in the dynamic translator stack */
+ node_new->nn->trans_cntl = MACH_PORT_NULL;
+ node_new->nn->below = NULL;
/*store the result of creation in the second parameter */
*node = node_new;
@@ -148,9 +149,10 @@ error_t node_create_proxy (lnode_t * lnode, node_t ** node)
node_new->nn->flags = 0;
node_new->nn->ncache_next = node_new->nn->ncache_prev = NULL;
- /*initialize the list of translators */
- node_new->nn->trans = NULL;
- node_new->nn->ntrans = node_new->nn->translen = 0;
+ /*initialize the data fields dealing with positioning this node
+ in the dynamic translator stack */
+ node_new->nn->trans_cntl = MACH_PORT_NULL;
+ node_new->nn->below = NULL;
/*store the result of creation in the second parameter */
*node = node_new;
@@ -172,12 +174,8 @@ void node_destroy (node_t * np)
if (np->nn->port != MACH_PORT_NULL)
PORT_DEALLOC (np->nn->port);
- /*If there are translators to kill */
- if (np->nn->lnode->dir && np->nn->trans)
- {
- /*kill all translators on the underlying nodes */
- node_kill_translators (np);
- }
+ /*TODO: If this node is a shadow node, kill the translator sitting
+ on this node. */
/*Lock the lnode corresponding to the current node */
mutex_lock (&np->nn->lnode->lock);
@@ -665,6 +663,7 @@ error_t node_set_translators (struct protid * diruser, node_t * np,
size_t ntrans, int flags, char * filename,
mach_port_t * port)
{
+#if 0
error_t err;
mach_port_t p;
@@ -760,11 +759,6 @@ error_t node_set_translators (struct protid * diruser, node_t * np,
if(!np->nn->port)
return ENOENT;
- np->nn->port_notrans = file_name_lookup_under
- (diruser->po->np->nn->port, filename, flags | O_NOTRANS, 0);
- if(!np->nn->port)
- return ENOENT;
-
/*duplicate the supplied user */
err = iohelp_dup_iouser (&user, diruser->user);
if (err)
@@ -897,40 +891,10 @@ error_t node_set_translators (struct protid * diruser, node_t * np,
/*Return the port */
*port = p;
+#endif
+
/*Everything is OK here */
return 0;
} /*node_set_translators */
/*---------------------------------------------------------------------------*/
-/*Kills all translators on the nodes belonging to the given directory*/
-void node_kill_translators (node_t * node)
-{
- /*If the node has no translators */
- if (node->nn->trans == NULL)
- /*nothing to do */
- return;
-
- error_t err = 0;
-
- /*The current element in the port list */
- port_el_t *p_el;
-
- /*While the list of control ports is not empty */
- for (p_el = node->nn->cntl_ports; p_el; p_el = node->nn->cntl_ports)
- {
- /*kill the current translator */
- err = fsys_goaway (p_el->p, 0);
-
- /*If the translator says it is busy, force it to go away */
- if (err == EBUSY)
- err = fsys_goaway (p_el->p, FSYS_GOAWAY_FORCE);
-
- /*move the beginning of the list of control ports forward */
- node->nn->cntl_ports = p_el->next;
-
- /*destroy the current cell in the list of ports */
- free (p_el);
- }
-} /*node_kill_translators */
-
-/*---------------------------------------------------------------------------*/
diff --git a/node.h b/node.h
index 0f7201083..062c4e827 100644
--- a/node.h
+++ b/node.h
@@ -78,22 +78,13 @@ struct netnode
/*a port to the underlying filesystem */
file_t port;
- /*the port to the untranslated version of the node */
- file_t port_notrans;
+ /*the control port of the translator sitting on this node, in case
+ this node is a shadow node */
+ fsys_t trans_cntl;
- /*the malloced set of translators which have to be stacked upon this node
- and upon its children; the corresponding translators will have to decide
- on their own whether to accept directories or not */
- char *trans;
-
- /*the number of translators listed in `translators` */
- size_t ntrans;
-
- /*the length of the list of translators (in bytes) */
- size_t translen;
-
- /*the list of control ports to the translators being set on this node */
- port_el_t *cntl_ports;
+ /*the reference to the shadow node that is below the current shadow
+ node in the dynamic translator stack */
+ node_t * below;
/*the neighbouring entries in the cache */
node_t *ncache_prev, *ncache_next;
@@ -161,14 +152,4 @@ error_t node_set_translators (struct protid *diruser, node_t * np,
size_t ntrans, int flags, char * filename,
mach_port_t * port);
/*---------------------------------------------------------------------------*/
-/*Kill the topmost translator for this node*/
-/*This function will normally be called from netfs_attempt_lookup,
- therefore it's better that the caller should provide the parent node
- for `node`.*/
-error_t node_kill_translator (node_t * dir, node_t * node);
-/*---------------------------------------------------------------------------*/
-/*Kills all translators on the current node or on all underlying nodes
- it the current node is a directory*/
-void node_kill_translators (node_t * node);
-/*---------------------------------------------------------------------------*/
#endif /*__NODE_H__*/
diff --git a/nsmux.c b/nsmux.c
index 459e03a1e..8017781d9 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -551,9 +551,6 @@ error_t
/*The port to the requested file */
mach_port_t p;
- /*The port to the untranslated version of the requested file */
- mach_port_t p_notrans;
-
/*The lnode corresponding to the entry we are supposed to fetch */
lnode_t *lnode;
@@ -591,8 +588,6 @@ error_t
/*If there is some port, free it */
if (p != MACH_PORT_NULL)
PORT_DEALLOC (p);
- if (p_notrans != MACH_PORT_NULL)
- PORT_DEALLOC (p_notrans);
}
/*If there is a node to return */
if (*node)
@@ -645,19 +640,13 @@ error_t
if (p == MACH_PORT_NULL)
return EBADF;
- /*obtain the untranslated version of the file, too (for filters) */
- p_notrans = file_name_lookup_under
- (dir->nn->port, name, O_NOTRANS, 0);
- if (p_notrans == MACH_PORT_NULL)
- return EBADF;
-
/*If a proxy node is not required */
if (!proxy)
/*stop here, we want only the port to the file */
return 0;
}
else
- p = p_notrans = MACH_PORT_NULL;
+ p = MACH_PORT_NULL;
}
else
{
@@ -667,18 +656,12 @@ error_t
(dir->nn->port, name, flags | O_READ | O_DIRECTORY, 0);
if (p == MACH_PORT_NULL)
return EBADF; /*not enough rights? */
-
- /*obtain the untranslated version of the file, too (for filters) */
- p_notrans = file_name_lookup_under
- (dir->nn->port, name, O_NOTRANS, 0);
- if (p_notrans == MACH_PORT_NULL)
- return EBADF;
}
else
/*If we are at the last component of the path and need to
open a directory, do not do the lookup; the translator
starting procedure will do that.*/
- p = p_notrans = MACH_PORT_NULL;
+ p =MACH_PORT_NULL;
/*we have a directory here */
isdir = 1;
@@ -726,9 +709,8 @@ error_t
return err;
}
- /*Store the ports in the node */
+ /*Store the port in the node */
(*node)->nn->port = p;
- (*node)->nn->port_notrans = p_notrans;
/*Fill in the flag about the node being a directory */
if (isdir)
@@ -866,12 +848,6 @@ error_t
++ntrans;
++translen;
- /*copy the list of translators we have just built in the new
- proxy node */
- (*node)->nn->trans = trans;
- (*node)->nn->ntrans = ntrans;
- (*node)->nn->translen = translen;
-
/*we don't own the list of translators any more */
trans = NULL;
ntrans = 0;
@@ -1047,21 +1023,8 @@ error_t
/*just return the port */
goto justport;
- /*If a proxy for setting up translators has just been created */
- if (np->nn->trans)
- {
- /*set the list of translators on this node */
- node_set_translators
- (diruser, np, np->nn->trans, np->nn->ntrans, flags,
- filename, &file);
-
- /*lock the the node and add a new reference */
- mutex_lock (&np->lock);
- netfs_nref (np);
-
- /*return `file` as the resulting port */
- goto justport;
- }
+ /*If a shadow node has just been created, set the
+ required translator on it */
}
}
@@ -1629,23 +1592,7 @@ kern_return_t
/*If the node is not the root node of nsmux */
if (np != netfs_root_node)
{
- /*the control port to the translator sitting on the real node */
- mach_port_t p;
-
- /*obtain the control port for the translator sitting on the real node;
- provide the bottommost translator, so that the filter (and this is
- most probably a request of such a translator) should be able to trace
- the real translator stack */
- err = file_get_translator_cntl (np->nn->port_notrans, &p);
- if (err)
- return err;
-
- /*set the parameters accordingly */
- *cntltype = MACH_MSG_TYPE_MOVE_SEND;
- *cntl = p;
-
- /*return the result of operations */
- return err;
+ /*TODO: The functionality here will be provided later */
}
/*Lock the node */