"Please give a more concrete justification for this change. It seems to me that if there is a hook defined and it reports an error, that is a real error and a generic fallback to a hookless mechanism is not appropriate. If fallback is useful it should be explicit, e.g. a particular error code." -- Roland Reported 15 Aug 2001, by Neal H Walfield <neal@cs.uml.edu> ---------------------------------------------------------- If store_remap sees that there is a class specific function to remap the underlying store, it will use this. If, however, this fails, for any reason, store_remap just gives up. This is wrong; the class specific remap functions may fail for any number of reasons, however, store_remap may be able to do the remap itself. libstore/ChangeLog 2001-08-12 Neal H Walfield <neal@cs.uml.edu> * remap.c: Include <errno.h>, <alloca.h> and <sys/types.h>. (store_remap): If the class specific remap function fails, try to remap the store ourselves. (remap_open): Fix formatting error. Index: remap.c =================================================================== RCS file: /cvs/hurd/libstore/remap.c,v retrieving revision 1.10 diff -u -p -r1.10 remap.c --- remap.c 2001/03/07 15:01:37 1.10 +++ remap.c 2001/08/15 08:51:07 @@ -21,6 +21,9 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> +#include <errno.h> +#include <alloca.h> +#include <sys/types.h> #include <hurd/fs.h> #include "store.h" @@ -135,7 +138,8 @@ remap_open (const char *name, int flags, p = endp; if (*p == ',') ++p; - } while (p < end); + } + while (p < end); err = store_typed_open (end + 1, flags, classes, &from); if (!err) @@ -309,30 +313,33 @@ store_remap (struct store *source, const struct store_run *runs, size_t num_runs, struct store **store) { + error_t err; + struct store_run *xruns = 0; + size_t num_xruns = 0; + if (source->class->remap) - /* Use the class-specific remaping function. */ - return (* source->class->remap) (source, runs, num_runs, store); - else - /* Just replace SOURCE's runs-list by an appropiately translated RUNS. */ + /* The the class-specific remaping function. */ { - struct store_run *xruns = 0; - size_t num_xruns = 0; - error_t err = - store_remap_runs (runs, num_runs, source->runs, source->num_runs, - &xruns, &num_xruns); + err = (* source->class->remap) (source, runs, num_runs, store); if (! err) - { - /* Don't use store_set_runs -- we've already allocated the - storage. */ - free (source->runs); - source->runs = xruns; - source->num_runs = num_xruns; - source->flags &= ~STORE_ENFORCED; - source->end = 0; /* Needed to make _store_derive work. */ - store_close_source (source); - _store_derive (source); - *store = source; - } - return err; + return 0; } + + /* Just replace SOURCE's runs-list by an appropiately translated RUNS. */ + err = store_remap_runs (runs, num_runs, source->runs, source->num_runs, + &xruns, &num_xruns); + if (! err) + { + /* Don't use store_set_runs -- we've already allocated the storage. */ + free (source->runs); + source->runs = xruns; + source->num_runs = num_xruns; + source->flags &= ~STORE_ENFORCED; + source->end = 0; /* Needed to make _store_derive work. */ + store_close_source (source); + _store_derive (source); + *store = source; + } + + return err; }