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
682c31e8
Commit
682c31e8
authored
Nov 17, 2005
by
Mike Hibler
Browse files
Allow explicit setting of signature file name
parent
2fb5301a
Changes
1
Hide whitespace changes
Inline
Side-by-side
os/imagezip/imagehash.c
View file @
682c31e8
...
...
@@ -83,6 +83,7 @@ static long hashblksize = HASHBLK_SIZE;
static
unsigned
long
long
ndatabytes
;
static
unsigned
long
nchunks
,
nregions
,
nhregions
;
static
char
*
fileid
=
NULL
;
static
char
*
sigfile
=
NULL
;
static
char
chunkbuf
[
SUBBLOCKSIZE
];
...
...
@@ -121,7 +122,7 @@ main(int argc, char **argv)
extern
char
build_info
[];
struct
hashinfo
*
hashinfo
=
0
;
while
((
ch
=
getopt
(
argc
,
argv
,
"cb:dvhnrD:NVRF:"
))
!=
-
1
)
while
((
ch
=
getopt
(
argc
,
argv
,
"cb:dvhn
o:
rD:NVRF:"
))
!=
-
1
)
switch
(
ch
)
{
case
'b'
:
hashblksize
=
atol
(
optarg
);
...
...
@@ -138,6 +139,9 @@ main(int argc, char **argv)
case
'c'
:
create
++
;
break
;
case
'o'
:
sigfile
=
strdup
(
optarg
);
break
;
case
'D'
:
if
(
strcmp
(
optarg
,
"md5"
)
==
0
)
hashtype
=
HASH_TYPE_MD5
;
...
...
@@ -238,7 +242,7 @@ usage(void)
"imagehash [-d] <image-filename> <device>
\n
"
" check the signature file for the specified image
\n
"
" against the specified disk device
\n
"
"imagehash -c [-dr] [-b blksize] <image-filename>
\n
"
"imagehash -c [-dr] [-b blksize]
[-o sigfile]
<image-filename>
\n
"
" create a signature file for the specified image
\n
"
"imagehash -R [-dr] [-b blksize] <image-filename>
\n
"
" output an ASCII report to stdout rather than creating a signature file
\n
"
...
...
@@ -247,6 +251,7 @@ usage(void)
"
\n
"
"-b blksize size of hash blocks (512 <= size <= 32M)
\n
"
"-d print additional detail to STDOUT
\n
"
"-o sigfile name to use for sig file, else <image>.sig
\n
"
"-r input file is a regular file, not an image
\n
"
);
exit
(
1
);
}
...
...
@@ -259,6 +264,9 @@ signame(char *name)
{
char
*
hfile
;
if
(
sigfile
!=
NULL
)
return
sigfile
;
hfile
=
malloc
(
strlen
(
name
)
+
5
);
if
(
hfile
==
NULL
)
{
fprintf
(
stderr
,
"%s: out of memory
\n
"
,
name
);
...
...
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