bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 3/3] Add the code for adding the mountee to the merged filesystem


From: Sergiu Ivanov
Subject: [PATCH 3/3] Add the code for adding the mountee to the merged filesystems
Date: Thu, 11 Jun 2009 21:25:10 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From 717a9e59817125f7c59109dfef09d8c266a2a013 Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Thu, 11 Jun 2009 18:49:10 +0300
Subject: [PATCH] Add the code for adding the mountee to the merged filesystems.

* node.c (node_init_root): Update the ULFS initialization code
by making it aware of the convention that `\0' refers to the
port to the mountee.

* ulfs.c (ulfs_check): Likewise.
(ulfs_register): Make the function not to check if `\0' is a
valid directory.

* unionmount.c (unionmount_setup): Add the code for registering
the port to the mountee in the list of the filesystems to be
merged.
---
 node.c       |   10 ++++++++--
 ulfs.c       |   10 ++++++++--
 unionmount.c |    6 ++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/node.c b/node.c
index cf9a8b4..039df61 100644
--- a/node.c
+++ b/node.c
@@ -33,6 +33,7 @@
 #include "node.h"
 #include "ulfs.h"
 #include "lib.h"
+#include "unionmount.h"
 
 /* Declarations for functions only used in this file.  */
 
@@ -535,8 +536,13 @@ node_init_root (node_t *node)
          break;
 
       if (ulfs->path)
-       node_ulfs->port = file_name_lookup (ulfs->path,
-                                           O_READ | O_DIRECTORY, 0);
+       {
+       if (!ulfs->path[0])
+         node_ulfs->port = mountee_port;
+       else
+         node_ulfs->port = file_name_lookup (ulfs->path,
+                                             O_READ | O_DIRECTORY, 0);
+       }
       else
        node_ulfs->port = underlying_node;
          
diff --git a/ulfs.c b/ulfs.c
index 3c565a5..e400cb4 100644
--- a/ulfs.c
+++ b/ulfs.c
@@ -31,6 +31,7 @@
 
 #include "lib.h"
 #include "ulfs.h"
+#include "unionmount.h"
 
 /* The start of the ulfs chain.  */
 ulfs_t *ulfs_chain_start;
@@ -219,7 +220,7 @@ ulfs_register (char *path, int flags, int priority)
   ulfs_t *ulfs;
   error_t err;
 
-  if (path)
+  if (path && path[0])
     {
       err = check_dir (path);
       if (err)
@@ -261,7 +262,12 @@ ulfs_check ()
     {
       
       if (u->path)
-       p = file_name_lookup (u->path, O_READ | O_DIRECTORY, 0);
+       {
+         if (!u->path[0])
+           p = mountee_port;
+         else
+           p = file_name_lookup (u->path, O_READ | O_DIRECTORY, 0);
+       }
       else
        p = underlying_node;
          
diff --git a/unionmount.c b/unionmount.c
index 0e3317d..eb47c09 100644
--- a/unionmount.c
+++ b/unionmount.c
@@ -189,6 +189,12 @@ unionmount_setup (struct protid * diruser)
   unionmount_start_mountee (diruser, unionmount_proxy, mountee_argz,
                            mountee_argz_len, O_READ, &mountee_port);
 
+  /*A path equal to `\0' will mean that the current ULFS entry is the
+    mountee port. */
+  ulfs_register ("\0", 0, 0);
+  ulfs_check ();
+  node_init_root (netfs_root_node);
+
   mountee_started = 1;
 
   return err;
-- 
1.5.2.4





reply via email to

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