diff options
-rw-r--r-- | mount.c | 14 | ||||
-rw-r--r-- | mount.h | 4 | ||||
-rw-r--r-- | node.c | 15 | ||||
-rw-r--r-- | ulfs.c | 19 | ||||
-rw-r--r-- | ulfs.h | 8 |
5 files changed, 49 insertions, 11 deletions
@@ -27,6 +27,7 @@ #include "mount.h" #include "lib.h" +#include "ulfs.h" /* The command line for starting the mountee. */ char * mountee_argz; @@ -144,7 +145,9 @@ start_mountee (node_t * np, char * argz, size_t argz_len, mach_port_t * port) return err; } /* start_mountee */ -/* Sets up a proxy node and sets the translator on it. */ +/* Sets up a proxy node, sets the translator on it, and registers the + filesystem published by the translator in the list of merged + filesystems. */ error_t setup_unionmount (void) { @@ -166,6 +169,15 @@ setup_unionmount (void) if (err) return err; + /* A path equal to "" will mean that the current ULFS entry is the + mountee port. */ + ulfs_register ("", 0, 0); + + /* Reinitialize the list of merged filesystems to take into account + the newly added mountee's filesystem. */ + ulfs_check (); + node_init_root (netfs_root_node); + mountee_started = 1; return 0; @@ -42,7 +42,9 @@ extern int mountee_started; error_t start_mountee (node_t * np, char * argz, size_t argz_len, mach_port_t * port); -/* Sets up a proxy node and sets the translator on it. */ +/* Sets up a proxy node, sets the translator on it, and registers the + filesystem published by the translator in the list of merged + filesystems. */ error_t setup_unionmount (void); @@ -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 <moritz@duesseldorf.ccc.de>. + Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>. + 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_root; + else + node_ulfs->port = file_name_lookup (ulfs->path, + O_READ | O_DIRECTORY, 0); + } else node_ulfs->port = underlying_node; @@ -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 <moritz@duesseldorf.ccc.de>. + Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>. + 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; @@ -212,14 +216,16 @@ ulfs_for_each_under_priv (char *path_under, return err; } -/* Register a new underlying filesystem. */ +/* Register a new underlying filesystem. A null path refers to the + underlying filesystem; a path equal to an empty string refers to + the filesystem of the mountee. */ error_t 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 +267,12 @@ ulfs_check () { if (u->path) - p = file_name_lookup (u->path, O_READ | O_DIRECTORY, 0); + { + if (!u->path[0]) + p = mountee_root; + else + p = file_name_lookup (u->path, O_READ | O_DIRECTORY, 0); + } else p = underlying_node; @@ -22,7 +22,9 @@ #ifndef INCLUDED_ULFS_H #define INCLUDED_ULFS_H -/* The structure for each registered underlying filesystem. */ +/* The structure for each registered underlying filesystem. A null + path refers to the underlying filesystem; a path equal to an empty + string refers to the filesystem of the mountee. */ typedef struct ulfs { char *path; @@ -49,7 +51,9 @@ extern unsigned int ulfs_num; /* The lock protecting the ulfs data structures. */ extern struct mutex ulfs_lock; -/* Register a new underlying filesystem. */ +/* Register a new underlying filesystem. A null path refers to the + underlying filesystem; a path equal to an empty string refers to + the filesystem of the mountee. */ error_t ulfs_register (char *path, int flags, int priority); /* Unregister an underlying filesystem. */ |