[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] remap tries hard to map
From: |
Neal H Walfield |
Subject: |
[patch] remap tries hard to map |
Date: |
Wed, 15 Aug 2001 10:56:06 +0200 |
User-agent: |
Mutt/1.3.18i |
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 can often only handle corner cases (e.g. the device
class can only map a contiguous region starting at offset zero), yet
store_remap can itself set up a pager. This patch corrects this
deficiency. Here is a change log:
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;
}
pgpEJs_AsyLKI.pgp
Description: PGP signature
- [patch] remap tries hard to map,
Neal H Walfield <=