Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
8759fa6c
Commit
8759fa6c
authored
May 07, 2015
by
Mike Hibler
Browse files
Make sure we are using header lastsect field correctly.
It is (and always has been) the last sector + 1.
parent
18d053da
Changes
6
Hide whitespace changes
Inline
Side-by-side
clientside/os/imagezip/imagedelta.c
View file @
8759fa6c
...
@@ -688,7 +688,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
...
@@ -688,7 +688,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
/* XXX should always be zero */
/* XXX should always be zero */
if
(
cstate
->
chunkno
==
0
)
if
(
cstate
->
chunkno
==
0
)
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
lastsect
=
delta
.
ndz
->
maphi
;
cstate
->
header
->
lastsect
=
delta
.
ndz
->
maphi
+
1
;
/* include any relocations */
/* include any relocations */
if
(
delta
.
ndz
->
relocentries
>
0
)
{
if
(
delta
.
ndz
->
relocentries
>
0
)
{
...
...
clientside/os/imagezip/imagehdr.h
View file @
8759fa6c
...
@@ -83,7 +83,7 @@ struct blockhdr_V2 {
...
@@ -83,7 +83,7 @@ struct blockhdr_V2 {
int32_t
regioncount
;
/* number of regions */
int32_t
regioncount
;
/* number of regions */
/* V2 follows */
/* V2 follows */
uint32_t
firstsect
;
/* first sector described by block */
uint32_t
firstsect
;
/* first sector described by block */
uint32_t
lastsect
;
/*
la
st sector
described by
block */
uint32_t
lastsect
;
/*
fir
st sector
past
block */
int32_t
reloccount
;
/* number of reloc entries */
int32_t
reloccount
;
/* number of reloc entries */
};
};
...
@@ -120,7 +120,7 @@ struct blockhdr_V4 {
...
@@ -120,7 +120,7 @@ struct blockhdr_V4 {
int32_t
regioncount
;
/* number of regions */
int32_t
regioncount
;
/* number of regions */
/* V2 follows */
/* V2 follows */
uint32_t
firstsect
;
/* first sector described by block */
uint32_t
firstsect
;
/* first sector described by block */
uint32_t
lastsect
;
/*
la
st sector
described by
block */
uint32_t
lastsect
;
/*
fir
st sector
past
block */
int32_t
reloccount
;
/* number of reloc entries */
int32_t
reloccount
;
/* number of reloc entries */
/* V4 follows */
/* V4 follows */
uint16_t
enc_cipher
;
/* cipher was used to encrypt */
uint16_t
enc_cipher
;
/* cipher was used to encrypt */
...
...
clientside/os/imagezip/imagerezip.c
View file @
8759fa6c
...
@@ -645,7 +645,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
...
@@ -645,7 +645,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
/* XXX should always be zero */
/* XXX should always be zero */
if
(
cstate
->
chunkno
==
0
)
if
(
cstate
->
chunkno
==
0
)
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
lastsect
=
new
.
ndz
->
maphi
;
cstate
->
header
->
lastsect
=
new
.
ndz
->
maphi
+
1
;
/* include any relocations */
/* include any relocations */
if
(
new
.
ndz
->
relocentries
>
0
)
{
if
(
new
.
ndz
->
relocentries
>
0
)
{
...
...
clientside/os/imagezip/imageundelta.c
View file @
8759fa6c
...
@@ -915,7 +915,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
...
@@ -915,7 +915,7 @@ chunkify(struct ndz_rangemap *mmap, struct ndz_range *range, void *arg)
/* XXX should always be zero */
/* XXX should always be zero */
if
(
cstate
->
chunkno
==
0
)
if
(
cstate
->
chunkno
==
0
)
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
firstsect
=
0
;
cstate
->
header
->
lastsect
=
new
.
ndz
->
maphi
;
cstate
->
header
->
lastsect
=
new
.
ndz
->
maphi
+
1
;
/* include any relocations */
/* include any relocations */
if
(
new
.
ndz
->
relocentries
>
0
)
{
if
(
new
.
ndz
->
relocentries
>
0
)
{
...
...
clientside/os/imagezip/libndz/ndzfile.c
View file @
8759fa6c
...
@@ -267,10 +267,10 @@ ndz_readranges(struct ndz_file *ndz)
...
@@ -267,10 +267,10 @@ ndz_readranges(struct ndz_file *ndz)
if
(
hdr
->
magic
!=
COMPRESSED_V1
)
{
if
(
hdr
->
magic
!=
COMPRESSED_V1
)
{
if
(
chunkno
==
0
)
if
(
chunkno
==
0
)
first
=
hdr
->
firstsect
;
first
=
hdr
->
firstsect
;
last
=
hdr
->
lastsect
;
last
=
hdr
->
lastsect
-
1
;
#ifdef USE_CHUNKMAP
#ifdef USE_CHUNKMAP
clo
=
hdr
->
firstsect
;
clo
=
hdr
->
firstsect
;
chi
=
hdr
->
lastsect
;
chi
=
hdr
->
lastsect
-
1
;
#endif
#endif
}
}
...
...
clientside/os/imagezip/libndz/reloc.c
View file @
8759fa6c
...
@@ -121,7 +121,7 @@ ndz_reloc_put(struct ndz_file *ndz, blockhdr_t *hdr, void *buf)
...
@@ -121,7 +121,7 @@ ndz_reloc_put(struct ndz_file *ndz, blockhdr_t *hdr, void *buf)
return
-
1
;
return
-
1
;
if
(
ndz
->
relocentries
==
0
||
if
(
ndz
->
relocentries
==
0
||
hdr
->
firstsect
>
ndz
->
relochi
||
hdr
->
lastsect
<
ndz
->
reloclo
)
hdr
->
firstsect
>
ndz
->
relochi
||
hdr
->
lastsect
<
=
ndz
->
reloclo
)
return
0
;
return
0
;
chunkreloc
=
buf
;
chunkreloc
=
buf
;
...
@@ -129,10 +129,10 @@ ndz_reloc_put(struct ndz_file *ndz, blockhdr_t *hdr, void *buf)
...
@@ -129,10 +129,10 @@ ndz_reloc_put(struct ndz_file *ndz, blockhdr_t *hdr, void *buf)
for
(
i
=
0
;
i
<
ndz
->
relocentries
;
i
++
)
{
for
(
i
=
0
;
i
<
ndz
->
relocentries
;
i
++
)
{
assert
(
relocdata
->
sectoff
+
relocdata
->
size
<=
ndz
->
sectsize
);
assert
(
relocdata
->
sectoff
+
relocdata
->
size
<=
ndz
->
sectsize
);
if
(
relocdata
->
sector
>=
hdr
->
firstsect
&&
if
(
relocdata
->
sector
>=
hdr
->
firstsect
&&
relocdata
->
sector
<
=
hdr
->
lastsect
)
{
relocdata
->
sector
<
hdr
->
lastsect
)
{
#ifdef RELOC_DEBUG
#ifdef RELOC_DEBUG
fprintf
(
stderr
,
"found reloc for %u in chunk range [%u-%u]
\n
"
,
fprintf
(
stderr
,
"found reloc for %u in chunk range [%u-%u]
\n
"
,
relocdata
->
sector
,
hdr
->
firstsect
,
hdr
->
lastsect
);
relocdata
->
sector
,
hdr
->
firstsect
,
hdr
->
lastsect
-
1
);
#endif
#endif
*
chunkreloc
++
=
*
relocdata
;
*
chunkreloc
++
=
*
relocdata
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment