summaryrefslogtreecommitdiff
path: root/nsmux.c
diff options
context:
space:
mode:
authorSergiu Ivanov <unlimitedscolobb@gmail.com>2008-10-01 21:39:54 +0300
committerSergiu Ivanov <unlimitedscolobb@gmail.com>2008-10-01 21:39:54 +0300
commite7b2aaa4548c0fa5fb5d6c8586fee63748d16dab (patch)
treea9b40c9c1a51eb12a7a1a4b151f2bc3ad5954021 /nsmux.c
parent7200dac108c4a8981b7f7f5f90757409c3e6d5bf (diff)
Copied the implementation of netfs_S_file_get_translator_cntl from libdiskfs.
By default, libnetfs does not implement this callback, which, BTW, makes impossible to trace the translator stack consisting of libnetfs translators. nsmux not only needs an implementation of this routine, but also requires customizations in order for filters to trace translator stacks on real nodes.
Diffstat (limited to 'nsmux.c')
-rw-r--r--nsmux.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/nsmux.c b/nsmux.c
index a39955997..d3764d3b7 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -1837,7 +1837,52 @@ netfs_node_norefs
node_destroy(np);
}/*netfs_node_norefs*/
/*----------------------------------------------------------------------------*/
-
+/*Implements file_get_translator_cntl as described in <hurd/fs.defs>
+ (according to diskfs_S_file_get_translator_cntl)*/
+kern_return_t
+netfs_S_file_get_translator_cntl
+ (
+ struct protid * user,
+ mach_port_t * cntl,
+ mach_msg_type_name_t * cntltype
+ )
+ {
+ /*If the information about the user is missing*/
+ if(!user)
+ return EOPNOTSUPP;
+
+ error_t err = 0;
+
+ /*Obtain the node for which we are called*/
+ node_t * np = user->po->np;
+
+ /*Lock the node*/
+ mutex_lock(&np->lock);
+
+ /*Check if the user is the owner of this node*/
+ err = fshelp_isowner(&np->nn_stat, user->user);
+
+ /*If no errors have happened*/
+ if(!err)
+ /*try to fetch the control port*/
+ err = fshelp_fetch_control(&np->transbox, cntl);
+
+ /*If no errors have occurred, but no port has been returned*/
+ if(!err && (cntl == MACH_PORT_NULL))
+ /*set the error accordingly*/
+ err = ENXIO;
+
+ /*If no errors have occurred so far*/
+ if(!err)
+ /*set the control port type*/
+ *cntltype = MACH_MSG_TYPE_MOVE_SEND;
+
+ /*Unlock the node*/
+ mutex_unlock(&np->lock);
+
+ /*Return the result of operations*/
+ return err;
+ }/*netfs_S_file_get_translator_cntl*/
/*----------------------------------------------------------------------------*/
/*Entry point*/
int