bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] Give the mountee the port to the real underlying node in tra


From: Sergiu Ivanov
Subject: [PATCH 4/4] Give the mountee the port to the real underlying node in transparent mode.
Date: Tue, 4 Aug 2009 00:17:26 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From 937c15e00626d813ed7cb89abb0d210710013c19 Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Mon, 3 Aug 2009 21:02:05 +0000
Subject: [PATCH 4/4] Give the mountee the port to the real underlying node in 
transparent mode.

* mount.c (start_mountee): Provide the mountee with the port to
the real underlying node if the unionmount is transparent.
(setup_unionmount): Create mountee_node only in non-transparent
mode.
---

The previous patch unconditionally provided the mountee with the real
underlying node.  This version does this only when in transparent
mode.

---
 mount.c |   32 ++++++++++++++++++++++++--------
 mount.h |    4 ++--
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/mount.c b/mount.c
index fb6663d..8213819 100644
--- a/mount.c
+++ b/mount.c
@@ -29,6 +29,7 @@
 #include "mount.h"
 #include "lib.h"
 #include "ulfs.h"
+#include "unionfs.h"
 
 /* The command line for starting the mountee.  */
 char * mountee_argz;
@@ -54,8 +55,8 @@ int shutting_down = 0;
 mach_port_t mountee_notify_port;
 
 /* Starts the mountee (given by `argz` and `argz_len`), attaches it to
-   the node `np` and opens a port `port` to the mountee with
-   `flags`.  */
+   the node `np` if the unionmount is non-transparent and opens a port
+   `port` to the mountee with `flags`.  */
 error_t
 start_mountee (node_t * np, char * argz, size_t argz_len, int flags,
               mach_port_t * port)
@@ -100,6 +101,16 @@ start_mountee (node_t * np, char * argz, size_t argz_len, 
int flags,
   {
     err = 0;
 
+    /* If the unionmount is transparent, we only have to supply the
+       real underlying node to the mountee.  */
+    if (transparent_mount)
+      {
+       *underlying = underlying_node;
+       *underlying_type  = MACH_MSG_TYPE_COPY_SEND;
+
+       return 0;
+      }
+
     /* The protid which will contain the port to the node on which the
        mountee will be sitting.  */
     struct protid * newpi;
@@ -183,12 +194,17 @@ setup_unionmount (void)
 {
   error_t err = 0;
 
-  /* The mountee will be sitting on this node.  This node is based on
-     the netnode of the root node, so most RPCs on this node can be
-     automatically carried out correctly.  */
-  mountee_node = netfs_make_node (netfs_root_node->nn);
-  if (!mountee_node)
-    return ENOMEM;
+  if (!transparent_mount)
+    {
+      /* The mountee will be sitting on this node.  This node is based on
+        the netnode of the root node, so most RPCs on this node can be
+        automatically carried out correctly.  */
+      mountee_node = netfs_make_node (netfs_root_node->nn);
+      if (!mountee_node)
+       return ENOMEM;
+    }
+  else
+    mountee_node = NULL;
 
   /* Set the mountee on the new node.
      Note that the O_READ flag does not actually limit access to the
diff --git a/mount.h b/mount.h
index 3e2b8dc..f959c38 100644
--- a/mount.h
+++ b/mount.h
@@ -46,8 +46,8 @@ extern int transparent_mount;
 extern int shutting_down;
 
 /* Starts the mountee (given by `argz` and `argz_len`), attaches it to
-   the node `np` and opens a port `port` to the mountee with
-   `flags`.  */
+   the node `np` if the unionmount is non-transparent and opens a port
+   `port` to the mountee with `flags`.  */
 error_t
 start_mountee (node_t * np, char * argz, size_t argz_len, int flags,
               mach_port_t * port);
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]