[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] Give the mountee the port to the real underlying node in
From: |
Sergiu Ivanov |
Subject: |
Re: [PATCH 4/4] Give the mountee the port to the real underlying node in transparent mode. |
Date: |
Tue, 18 Aug 2009 14:36:57 +0300 |
User-agent: |
Mutt/1.5.16 (2007-06-09) |
>From 48b2e49b18023ffc7b137350dfc61505417b048b 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): Don't use any nodes in starting the mountee
in transparent mode.
---
Hello,
Since we no longer bother to clone the root node after orphaning, this
patch has been modified to reflect the direct usage of the real root
node.
Regards,
scolobb
---
mount.c | 25 ++++++++++++++++++++-----
mount.h | 4 ++--
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/mount.c b/mount.c
index e66604e..29cacc8 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;
@@ -51,8 +52,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)
@@ -97,6 +98,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;
@@ -177,14 +188,18 @@ setup_unionmount (void)
{
error_t err = 0;
- /* Set the mountee on the root node.
+ /* Set up the mountee.
Note that the O_READ flag does not actually limit access to the
mountee's filesystem considerably. Whenever a client looks up a
node which is not a directory, unionfs will give off a port to
the node itself, withouth proxying it. Proxying happens only for
directory nodes. */
- err = start_mountee (netfs_root_node, mountee_argz, mountee_argz_len,
- O_READ, &mountee_root);
+ if (!transparent_mount)
+ err = start_mountee (netfs_root_node, mountee_argz, mountee_argz_len,
+ O_READ, &mountee_root);
+ else
+ err = start_mountee (NULL, mountee_argz, mountee_argz_len,
+ O_READ, &mountee_root);
if (err)
return err;
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