diff options
author | Roland McGrath <roland@gnu.org> | 1999-07-11 01:42:23 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-07-11 01:42:23 +0000 |
commit | 94d78956ee2eb72ddc67f850e588695529b63fca (patch) | |
tree | fcfaffc88c3c71a4f587e7c593c7a919fe0b4309 /libstore | |
parent | c8ef260269a1508b97823fad88a5a9a2aa30b816 (diff) |
1999-07-08 Roland McGrath <roland@baalperazim.frob.com>
* remap.c (remap_open): Recognize "N+" syntax in block list as from
block N through the end of the store.
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/remap.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libstore/remap.c b/libstore/remap.c index eb883b2f..e1965ea5 100644 --- a/libstore/remap.c +++ b/libstore/remap.c @@ -115,6 +115,14 @@ remap_open (const char *name, int flags, if (endp == p) /* Syntax "+5,+7" means "0+5,0+7". */ runs[nruns].start = 0; p = endp + 1; + if (p == end || *p == ',') + { + /* Syntax "100+" means block 100 to the end of the store. + Since we don't know the size yet, we use -1 as a marker + for the code below. */ + runs[nruns++].length = (off_t) -1; + break; + } runs[nruns].length = strtoul (p, &endp, 0); if (endp == p) return EINVAL; @@ -129,10 +137,17 @@ remap_open (const char *name, int flags, ++p; } while (p < end); - err = store_typed_open (end + 1, flags, classes, &from); if (!err) { + /* Check for any runs marked as "through the end of the store" + and update them to use the actual size of the store. */ + size_t i; + for (i = 0; i < nruns; ++i) + if (runs[i].length == (off_t) -1) + runs[i].length = from->blocks - runs[i].start; + + /* Now do the remapping according to RUNS. */ err = store_remap (from, runs, nruns, store); if (err) store_free (from); |