bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 3/3] Add the mountee to the list of merged filesystems.


From: Sergiu Ivanov
Subject: [PATCH 3/3] Add the mountee to the list of merged filesystems.
Date: Sun, 5 Jul 2009 16:02:01 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From aebb706b49e547d551a049acaecc1bde58bda3e0 Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <address@hidden>
Date: Sun, 5 Jul 2009 15:26:58 +0300
Subject: [PATCH] Add the mountee to the list of merged filesystems.

* mount.c (start_mountee): Add the mountee's filesystem to the
list of merged filesystems.
* node.c (node_init_root): Take into consideration the fact that
an empty string refers to the mountee port.
* ulfs.c (ulfs_check): Likewise.
(ulfs_register): Don't check whether "" is a valid directory.
---
 mount.c |    8 ++++++++
 node.c  |   15 ++++++++++++---
 ulfs.c  |   15 ++++++++++++---
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/mount.c b/mount.c
index f05fe7c..9dd0d9a 100644
--- a/mount.c
+++ b/mount.c
@@ -201,6 +201,14 @@ setup_unionmount (void)
   err = start_mountee (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);
+
+  /* Initialize the list of merged filesystems.  */
+  ulfs_check ();
+  node_init_root (netfs_root_node);
+
   mountee_started = 1;
 
   return err;
diff --git a/node.c b/node.c
index cf9a8b4..d9f26ba 100644
--- a/node.c
+++ b/node.c
@@ -1,7 +1,10 @@
 /* Hurd unionfs
-   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+
    Written by Moritz Schulte <address@hidden>.
 
+   Adapted for unionmount by Sergiu Ivanov <address@hidden>.
+
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
@@ -33,6 +36,7 @@
 #include "node.h"
 #include "ulfs.h"
 #include "lib.h"
+#include "mount.h"
 
 /* Declarations for functions only used in this file.  */
 
@@ -535,8 +539,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..6acb304 100644
--- a/ulfs.c
+++ b/ulfs.c
@@ -1,7 +1,10 @@
 /* Hurd unionfs
-   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+
    Written by Moritz Schulte <address@hidden>.
 
+   Adapted for unionmount by Sergiu Ivanov <address@hidden>.
+
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
@@ -31,6 +34,7 @@
 
 #include "lib.h"
 #include "ulfs.h"
+#include "mount.h"
 
 /* The start of the ulfs chain.  */
 ulfs_t *ulfs_chain_start;
@@ -219,7 +223,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 +265,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;
          
-- 
1.5.2.4




reply via email to

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