1
0
Fork 0

dumpimage: replace the term "datafile" by "subimage"

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
utp
Guilherme Maciel Ferreira 2015-01-15 02:54:41 -02:00 committed by Tom Rini
parent f41f5b7c05
commit 67f946cd18
4 changed files with 19 additions and 18 deletions

View File

@ -117,7 +117,7 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
image_set_hcrc(hdr, checksum); image_set_hcrc(hdr, checksum);
} }
static int image_extract_datafile(void *ptr, struct image_tool_params *params) static int image_extract_subimage(void *ptr, struct image_tool_params *params)
{ {
const image_header_t *hdr = (const image_header_t *)ptr; const image_header_t *hdr = (const image_header_t *)ptr;
ulong file_data; ulong file_data;
@ -144,7 +144,7 @@ static int image_extract_datafile(void *ptr, struct image_tool_params *params)
} }
/* save the "data file" into the file system */ /* save the "data file" into the file system */
return imagetool_save_datafile(params->outfile, file_data, file_len); return imagetool_save_subimage(params->outfile, file_data, file_len);
} }
/* /*
@ -159,7 +159,7 @@ U_BOOT_IMAGE_TYPE(
image_verify_header, image_verify_header,
image_print_contents, image_print_contents,
image_set_header, image_set_header,
image_extract_datafile, image_extract_subimage,
image_check_image_types, image_check_image_types,
NULL, NULL,
NULL NULL

View File

@ -18,7 +18,7 @@ static struct image_tool_params params = {
}; };
/* /*
* dumpimage_extract_datafile - * dumpimage_extract_subimage -
* *
* It scans all registered image types, * It scans all registered image types,
* verifies image_header for each supported image type * verifies image_header for each supported image type
@ -28,7 +28,7 @@ static struct image_tool_params params = {
* returns negative if input image format does not match with any of * returns negative if input image format does not match with any of
* supported image types * supported image types
*/ */
static int dumpimage_extract_datafile(struct image_type_params *tparams, static int dumpimage_extract_subimage(struct image_type_params *tparams,
void *ptr, struct stat *sbuf) void *ptr, struct stat *sbuf)
{ {
int retval = -1; int retval = -1;
@ -42,11 +42,11 @@ static int dumpimage_extract_datafile(struct image_type_params *tparams,
* Extract the file from the image * Extract the file from the image
* if verify is successful * if verify is successful
*/ */
if (tparams->extract_datafile) { if (tparams->extract_subimage) {
retval = tparams->extract_datafile(ptr, &params); retval = tparams->extract_subimage(ptr, &params);
} else { } else {
fprintf(stderr, fprintf(stderr,
"%s: extract_datafile undefined for %s\n", "%s: extract_subimage undefined for %s\n",
params.cmdname, tparams->name); params.cmdname, tparams->name);
return -2; return -2;
} }
@ -170,7 +170,7 @@ int main(int argc, char **argv)
* Extract the data files from within the matched * Extract the data files from within the matched
* image type. Returns the error code if not matched * image type. Returns the error code if not matched
*/ */
retval = dumpimage_extract_datafile(tparams, ptr, retval = dumpimage_extract_subimage(tparams, ptr,
&sbuf); &sbuf);
} else { } else {
/* /*

View File

@ -66,7 +66,7 @@ int imagetool_verify_print_header(
return retval; return retval;
} }
int imagetool_save_datafile( int imagetool_save_subimage(
const char *file_name, const char *file_name,
ulong file_data, ulong file_data,
ulong file_len) ulong file_len)

View File

@ -110,14 +110,15 @@ struct image_type_params {
void (*set_header) (void *, struct stat *, int, void (*set_header) (void *, struct stat *, int,
struct image_tool_params *); struct image_tool_params *);
/* /*
* This function is used by the command to retrieve a data file from * This function is used by the command to retrieve a component
* the image (i.e. dumpimage -i <image> -p <position> <data_file>). * (sub-image) from the image (i.e. dumpimage -i <image> -p <position>
* <sub-image-name>).
* Thus the code to extract a file from an image must be put here. * Thus the code to extract a file from an image must be put here.
* *
* Returns 0 if the file was successfully retrieved from the image, * Returns 0 if the file was successfully retrieved from the image,
* or a negative value on error. * or a negative value on error.
*/ */
int (*extract_datafile) (void *, struct image_tool_params *); int (*extract_subimage)(void *, struct image_tool_params *);
/* /*
* Some image generation support for ex (default image type) supports * Some image generation support for ex (default image type) supports
* more than one type_ids, this callback function is used to check * more than one type_ids, this callback function is used to check
@ -169,18 +170,18 @@ int imagetool_verify_print_header(
struct image_tool_params *params); struct image_tool_params *params);
/** /**
* imagetool_save_datafile - store data into a file * imagetool_save_subimage - store data into a file
* @file_name: name of the destination file * @file_name: name of the destination file
* @file_data: data to be written * @file_data: data to be written
* @file_len: the amount of data to store * @file_len: the amount of data to store
* *
* imagetool_save_datafile() store file_len bytes of data pointed by file_data * imagetool_save_subimage() store file_len bytes of data pointed by file_data
* into the file name by file_name. * into the file name by file_name.
* *
* returns: * returns:
* zero in case of success or a negative value if fail. * zero in case of success or a negative value if fail.
*/ */
int imagetool_save_datafile( int imagetool_save_subimage(
const char *file_name, const char *file_name,
ulong file_data, ulong file_data,
ulong file_len); ulong file_len);
@ -202,7 +203,7 @@ void pbl_load_uboot(int fd, struct image_tool_params *mparams);
_verify_header, \ _verify_header, \
_print_header, \ _print_header, \
_set_header, \ _set_header, \
_extract_datafile, \ _extract_subimage, \
_check_image_type, \ _check_image_type, \
_fflag_handle, \ _fflag_handle, \
_vrec_header \ _vrec_header \
@ -215,7 +216,7 @@ void pbl_load_uboot(int fd, struct image_tool_params *mparams);
.verify_header = _verify_header, \ .verify_header = _verify_header, \
.print_header = _print_header, \ .print_header = _print_header, \
.set_header = _set_header, \ .set_header = _set_header, \
.extract_datafile = _extract_datafile, \ .extract_subimage = _extract_subimage, \
.check_image_type = _check_image_type, \ .check_image_type = _check_image_type, \
.fflag_handle = _fflag_handle, \ .fflag_handle = _fflag_handle, \
.vrec_header = _vrec_header \ .vrec_header = _vrec_header \