diff options
author | Luiz Otavio O Souza <loos@FreeBSD.org> | 2014-02-03 17:21:36 +0000 |
---|---|---|
committer | Luiz Otavio O Souza <loos@FreeBSD.org> | 2014-02-03 17:21:36 +0000 |
commit | c2d90f35d5cbee8432228a12cd9aba4be5d92888 (patch) | |
tree | 31f30071bf5f93b041941908e55c1e99e76f2be4 /sys/geom | |
parent | 603a40e413bd199d063c57c9c62ee20243f90df2 (diff) | |
download | src-c2d90f35d5cbee8432228a12cd9aba4be5d92888.tar.gz src-c2d90f35d5cbee8432228a12cd9aba4be5d92888.zip |
Remove some unnecessary code. The offsets read from the first block are
overwritten a few lines bellow.
Reviewed by: ray
Approved by: adrian (mentor)
Notes
Notes:
svn path=/head/; revision=261439
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/uncompress/g_uncompress.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sys/geom/uncompress/g_uncompress.c b/sys/geom/uncompress/g_uncompress.c index b7d73a02c990..ab980bcb97ce 100644 --- a/sys/geom/uncompress/g_uncompress.c +++ b/sys/geom/uncompress/g_uncompress.c @@ -451,7 +451,7 @@ g_uncompress_taste(struct g_class *mp, struct g_provider *pp, int flags) struct g_provider *pp2; struct g_consumer *cp; struct g_geom *gp; - uint32_t i, total_offsets, offsets_read, type; + uint32_t i, total_offsets, type; uint8_t *buf; int error; @@ -546,21 +546,15 @@ g_uncompress_taste(struct g_class *mp, struct g_provider *pp, int flags) gp->name, sc->nblocks); goto err; } - sc->offsets = malloc( - total_offsets * sizeof(uint64_t), M_GEOM_UNCOMPRESS, M_WAITOK); - offsets_read = MIN(total_offsets, - (pp->sectorsize - sizeof(*header)) / sizeof(uint64_t)); - for (i = 0; i < offsets_read; i++) - sc->offsets[i] = be64toh(((uint64_t *) (header + 1))[i]); - DPRINTF(("%s: %u offsets in the first sector\n", - gp->name, offsets_read)); - free(buf, M_GEOM); + i = roundup((sizeof(struct cloop_header) + total_offsets * sizeof(uint64_t)),pp->sectorsize); buf = g_read_data(cp, 0, i, NULL); if (buf == NULL) goto err; + sc->offsets = malloc(total_offsets * sizeof(uint64_t), + M_GEOM_UNCOMPRESS, M_WAITOK); for (i = 0; i <= total_offsets; i++) { sc->offsets[i] = be64toh(((uint64_t *) (buf+sizeof(struct cloop_header)))[i]); |