summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianluca Guida <glguida@gmail.com>2005-05-30 12:53:20 +0000
committerGianluca Guida <glguida@gmail.com>2005-05-30 12:53:20 +0000
commit5030481050eeccb65643d849d6fb06d005f47c93 (patch)
treed77f7eae45bbc6029ab46287fa7fc35ef261654d
parent60e5cc0a61638f9ffd9be22f3fbecc66ae174e03 (diff)
New README and bugfixes.
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog17
-rw-r--r--README81
-rw-r--r--lib.c26
-rw-r--r--options.c4
-rw-r--r--stow.c13
-rw-r--r--ulfs.c3
7 files changed, 120 insertions, 25 deletions
diff --git a/AUTHORS b/AUTHORS
index 23e2cc8..1cc9538 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,2 @@
* Moritz Schulte <moritz@duesseldorf.ccc.de>
+* Gianluca Guida <glguida@gmail.com>
diff --git a/ChangeLog b/ChangeLog
index b3f4ca3..cf464e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-05-30 Gianluca Guida <glguida@gmail.com>
+
+ * AUTHORS: Added myself in the list.
+ * README: Added sections "Introduction" and "Stowing Feature".
+ * options.c (argp_program_bug_address): Changed address.
+
+ * lib.c (for_each_subdir): When call to stat() fails continue free
+ "name" and continue the loop, instead of returning error. Return 0
+ at the end of the loop.
+ (for_each_subdir_priv): Likewise.
+
+ * stow.c (_stow_registermatchingdirs): Don't return error when
+ patternlist_match return false. Free filepath before returning
+ error when ulfs_register fails.
+
+ * ulfs.c (ulfs_register): Removed bogus fprintf.
+
2005-05-29 Gianluca Guida <glguida@gmail.com>
* Makefile: Added support for building mig stubs for stow feature.
diff --git a/README b/README
index 16d73d5..1849f4d 100644
--- a/README
+++ b/README
@@ -1,5 +1,78 @@
-This is an `unionfs' translator for the Hurd. It is simple, but it is
-definitely not a joke.
+This is the unionfs translator for the GNU Hurd.
+
+The unionfs translator was originally written by Moritz Schulte
+<moritz@duesseldorf.ccc.de> and currently mantained by Gianluca Guida
+<glguida@gmail.com>.
+
+
+
+Introduction.
+
+An unionfs is a filesystems that joins many filesystems into one, meaning
+that you can see into an "unionfs" all files contained in the filesystems
+that are part of the union.
+
+When two or more directories with the same path are found in different
+filesystems, their content is joined.
+When two or more files with the same path are found in different filesystems,
+unionfs has to solve this conflict. See below (Internals section) for
+information on what this implementation does in such case.
+
+Example:
+To join "foo/" "bar/" and "baz/" in the directory "quux/", just do:
+
+ settrans -capfg quux/ /hurd/unionfs foo/ bar/ baz/
+
+If you want to join even quux/ contents in the union itself, add -u as a
+translator argument.
+You can add filesystems at run-time with the fsysopts command.
+
+
+
+Stowing feature.
+
+This unionfs implements stowing feature, i.e. the translator will watch a
+directory, called 'stow', that contains the directories to unite.
+When a directory is added or removed in the stow, it will be added to or
+removed from the unionfs.
+
+Example:
+To use "/stow" as the stow for the directory "foo/", do:
+
+ settrans -capfg foo/ /hurd/unionfs --stow=/stow
+
+All directories contained in /stow/ will then be joined together in foo/;
+you can delete or add directory at run-time and you will see unionfs adding
+or removing files in foo/ automatically.
+
+Another interesting feature of stow support of unionfs is the pattern matching
+option.
+For example, by using:
+
+ settrans -capfg foo/ /hurd/unionfs -m bar --stow=/stow
+
+You will get joined in foo/ all sub-sub-directories of /stow matching "bar",
+i.e. /stow/*/bar/; pattern matching will be done too in run-time added stow
+subdirectories.
+Furthermore, you can specify more complex matching pattern to the option,
+like -m bar\* (to get all stow's sub-sub-directories beginning with "bar")
+or specify multiple -m options.
+
+Example:
+This command
+
+ settrans -capfg /myfaketree/bin -m bin -m sbin --stow=/stow
+
+will join in /myfaketree/bin all files that are in /stow/*/bin and
+/stow/*/sbin. It is equivalent to:
+
+ settrans -capfg /myfaketree/bin -m [s]bin --stow=/stow
+
+
+
+Internals.
+
+This `unionfs' translator is simple, but it is definitely not a joke.
It works by keeping in memory a dynamically updated tree of nodes, each
node representing a directory in the unionfs. A node contains an array
@@ -15,7 +88,5 @@ At the moment, underlying filesystem ordering is set by option ordering.
See CAVEAT for other unexpected behaviour that could happen.
-The unionfs translator was originally written by Moritz Schulte
-<moritz@duesseldorf.ccc.de> and currently mantained by Gianluca Guida
-<glguida@gmail.com>.
+Please send all bug reports to Gianluca Guida <glguida@gmail.com>.
diff --git a/lib.c b/lib.c
index 2f5de70..0423c1b 100644
--- a/lib.c
+++ b/lib.c
@@ -185,18 +185,22 @@ for_each_subdir (char *path, error_t (*func) (char *, char *))
err = stat (name, &filestat);
- if (err)
- return err;
-
free (name);
+ if (err)
+ {
+ fprintf (stderr, "unionfs: couldn't stat %s%s\n",
+ path, (*dirent)->d_name);
+ continue;
+ }
+
if (!S_ISDIR(filestat.st_mode))
continue;
- err = func ((*dirent)->d_name, path);
+ func ((*dirent)->d_name, path);
}
- return err;
+ return 0;
}
error_t
@@ -228,18 +232,22 @@ for_each_subdir_priv (char *path, error_t (*func) (char *, char *, void *),
err = stat (name, &filestat);
- if (err)
- return err;
-
free (name);
+ if (err)
+ {
+ fprintf (stderr, "unionfs: couldn't stat %s%s\n",
+ path, (*dirent)->d_name);
+ continue;
+ }
+
if (!S_ISDIR(filestat.st_mode))
continue;
func ((*dirent)->d_name, path, priv);
}
- return err;
+ return 0;
}
error_t
diff --git a/options.c b/options.c
index 2354788..4ca3fca 100644
--- a/options.c
+++ b/options.c
@@ -67,7 +67,7 @@ const struct argp_option argp_startup_options[] =
{ 0 }
};
-/* Argp parser function for the common oprtions. */
+/* Argp parser function for the common options. */
error_t
argp_parse_common_options (int key, char *arg, struct argp_state *state)
{
@@ -199,7 +199,7 @@ const struct argp_child argp_children_startup[] =
const char *argp_program_version = STANDARD_HURD_VERSION (unionfs);
const char *argp_program_bug_address =
-"Moritz Schulte <moritz@duesseldorf.ccc.de>";
+"Gianluca Guida <glguida@gmail.com>";
#define ARGS_DOC "FILESYSTEMS ..."
#define DOC "Hurd unionfs server"
diff --git a/stow.c b/stow.c
index 11c257d..827af63 100644
--- a/stow.c
+++ b/stow.c
@@ -40,23 +40,24 @@ struct stow_privdata
static error_t
_stow_registermatchingdirs (char *arg, char *dirpath, void *priv)
{
- error_t err=0;
+ error_t err = 0;
char *filepath;
struct stow_privdata *privdata = (struct stow_privdata *) priv ;
err = patternlist_match (privdata->patternlist, arg);
if (err)
- return err;
+ return 0; /* It doesn't match. This is not an error. */
filepath = make_filepath (dirpath, arg);
err = ulfs_register (filepath, privdata->flags);
+
+ free (filepath);
+
if (err)
return err;
- free (filepath);
-
return 0;
}
@@ -135,10 +136,10 @@ _stow_notify_init(char *dir_name, void *priv)
stow_notify_port->priv = priv;
dir_port = file_name_lookup (dir_name, 0, 0);
+
if (!port_valid (dir_port))
- {
return ENOENT; /* ? */
- }
+
notify_port = ports_get_right (stow_notify_port);
diff --git a/ulfs.c b/ulfs.c
index 1dad904..5a8896a 100644
--- a/ulfs.c
+++ b/ulfs.c
@@ -186,10 +186,7 @@ ulfs_register (char *path, int flags)
{
err = check_dir (path);
if (err)
- {
- fprintf(stderr, "%s is not a directory\n", path);
return err;
- }
}
mutex_lock (&ulfs_lock);