diff options
Diffstat (limited to 'src/usr/imgmgmt.c')
-rw-r--r-- | src/usr/imgmgmt.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c index bf4c745..f8d1491 100644 --- a/src/usr/imgmgmt.c +++ b/src/usr/imgmgmt.c @@ -173,43 +173,20 @@ void imgstat ( struct image *image ) { /** * Create image from block of memory * + * @v name Name * @v data Image data * @v len Length - * @v name Name - * @v image Image to fill in * @ret rc Return status code */ -int imgmem ( userptr_t data, size_t len, const char *name, - struct image **image ) { - int rc; - - /* Allocate image */ - *image = alloc_image ( NULL ); - if ( ! *image ) { - rc = -ENOMEM; - goto err_alloc_image; - } - - /* Set name */ - if ( ( rc = image_set_name ( *image, name ) ) != 0 ) - goto err_set_name; +int imgmem ( const char *name, userptr_t data, size_t len ) { + struct image *image; - /* Set data */ - if ( ( rc = image_set_data ( *image, data, len ) ) != 0 ) { - printf ( "Could not set image data: %s\n", strerror ( rc ) ); - goto err_set_data; - } - - /* Register image */ - if ( ( rc = register_image ( *image ) ) != 0 ) { - printf ( "Could not register image: %s\n", strerror ( rc ) ); - goto err_register_image; + /* Create image */ + image = image_memory ( name, data, len ); + if ( ! image ) { + printf ( "Could not create image\n" ); + return -ENOMEM; } - err_register_image: - err_set_data: - err_set_name: - image_put ( *image ); - err_alloc_image: - return rc; + return 0; } |