summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergiu Ivanov <unlimitedscolobb@gmail.com>2008-10-03 11:03:44 +0300
committerSergiu Ivanov <unlimitedscolobb@gmail.com>2008-10-03 11:03:44 +0300
commitb973a117cae3021b87d408af573bb1dbe153c132 (patch)
tree832b7ba1e8dd7c29a40d45560c85f3492186a517
parent41e54572aac563537d961b3f284c100411c59532 (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.
-rw-r--r--nsmux.c47
-rw-r--r--nsmux.h10
2 files changed, 56 insertions, 1 deletions
diff --git a/nsmux.c b/nsmux.c
index 0269f09c7..4c8c50940 100644
--- a/nsmux.c
+++ b/nsmux.c
@@ -1708,7 +1708,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
diff --git a/nsmux.h b/nsmux.h
index a38874d68..48b6a5b7b 100644
--- a/nsmux.h
+++ b/nsmux.h
@@ -377,4 +377,14 @@ netfs_node_norefs
struct node * np
);
/*----------------------------------------------------------------------------*/
+/*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
+ );
+/*----------------------------------------------------------------------------*/
#endif /*__NSMUX_H__*/