summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergiu Ivanov <unlimitedscolobb@gmail.com>2009-03-06 21:21:47 +0200
committerSergiu Ivanov <unlimitedscolobb@gmail.com>2009-03-06 21:21:47 +0200
commit48efa86dfe3e546190f997e70c307a231026d207 (patch)
treeb095f30d7ddec15469235ae9b5ef65b3ea7038b0
parent3cea8614816e68db569bbea21134c64273e037b5 (diff)
Added node types
Now inside each netnode (and, hence, inside each node) there is a field showing the type of the node. This is required because, at least in response to requests by the filter, proxy nodes and shadow nodes will have different jobs to do and the server-side implementation of filesystem RPCs in nsmux would need to know what actions they are expected to carry out.
-rw-r--r--node.c8
-rw-r--r--node.h8
-rw-r--r--nsmux.c4
3 files changed, 20 insertions, 0 deletions
diff --git a/node.c b/node.c
index 1c47d735c..ecf9ba6d8 100644
--- a/node.c
+++ b/node.c
@@ -83,6 +83,8 @@ error_t node_create (lnode_t * lnode, node_t ** node)
return err;
}
+ node_new->nn->type = NODE_TYPE_NORMAL;
+
/*link the lnode to the new node */
lnode->node = node_new;
@@ -142,6 +144,8 @@ error_t node_create_proxy (lnode_t * lnode, node_t ** node)
return err;
}
+ node_new->nn->type = NODE_TYPE_PROXY;
+
/*add this new node to the list of proxies of `lnode` */
lnode_add_proxy (lnode, node_new);
@@ -195,6 +199,10 @@ error_t node_create_from_port (mach_port_t port, node_t ** node)
return err;
}
+ /*The caller may want to change this to NODE_TYPE_SHADOW if it's
+ the case. */
+ node_new->nn->type = NODE_TYPE_PROXY;
+
/*this node is ``orphan'' -- it is not associated to any lnode
and has some service functions only */
node_new->nn->lnode = NULL;
diff --git a/node.h b/node.h
index 7cb154386..cf76948af 100644
--- a/node.h
+++ b/node.h
@@ -44,6 +44,11 @@
#define FLAG_NODE_INVALIDATE 0x00000002 /*this node must be updated */
#define FLAG_NODE_ULFS_UPTODATE 0x00000004 /*this node has just been updated */
/*---------------------------------------------------------------------------*/
+/*Types of nodes */
+#define NODE_TYPE_NORMAL 0
+#define NODE_TYPE_PROXY 1
+#define NODE_TYPE_SHADOW 2
+/*---------------------------------------------------------------------------*/
/*The type of offset corresponding to the current platform*/
#ifdef __USE_FILE_OFFSET64
# define OFFSET_T __off64_t
@@ -75,6 +80,9 @@ struct netnode
/*the flags associated with this node */
int flags;
+ /*the type of the current node */
+ int type;
+
/*a port to the underlying filesystem */
file_t port;
diff --git a/nsmux.c b/nsmux.c
index d2da05086..3f222d2ee 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -908,6 +908,7 @@ error_t
/*`np` is a proxy node of the lower translator. We
have to create a shadow node explicitly. */
+
error = node_get_send_port (diruser, np, flags, &file);
if (error)
goto out;
@@ -928,6 +929,9 @@ error_t
if (!error && !excl)
{
+ /*We've just created a shadow node. */
+ np->nn->type = NODE_TYPE_SHADOW;
+
/*If there is at least one more separator in the
filename, we will have to do a retry */
nextsep = magic_find_sep(sep);