Commit 31bc5a33 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[PATCH] uml: correct error messages in COW driver

Improve some error messages in the COW driver, and say V3, not V2, when
talking about V3 format.  Also resync with our userspace code utility a bit
more.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b1a3aa20
...@@ -33,7 +33,7 @@ static inline int cow_file_size(char *file, unsigned long long *size_out) ...@@ -33,7 +33,7 @@ static inline int cow_file_size(char *file, unsigned long long *size_out)
return(os_file_size(file, size_out)); return(os_file_size(file, size_out));
} }
static inline int cow_write_file(int fd, char *buf, int size) static inline int cow_write_file(int fd, void *buf, int size)
{ {
return(os_write_file(fd, buf, size)); return(os_write_file(fd, buf, size));
} }
......
...@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, ...@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
err = -ENOMEM; err = -ENOMEM;
header = cow_malloc(sizeof(*header)); header = cow_malloc(sizeof(*header));
if(header == NULL){ if(header == NULL){
cow_printf("Failed to allocate COW V3 header\n"); cow_printf("write_cow_header - failed to allocate COW V3 header\n");
goto out; goto out;
} }
header->magic = htonl(COW_MAGIC); header->magic = htonl(COW_MAGIC);
...@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, ...@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
err = os_file_modtime(header->backing_file, &modtime); err = os_file_modtime(header->backing_file, &modtime);
if(err < 0){ if(err < 0){
cow_printf("Backing file '%s' mtime request failed, " cow_printf("write_cow_header - backing file '%s' mtime "
"err = %d\n", header->backing_file, -err); "request failed, err = %d\n", header->backing_file,
-err);
goto out_free; goto out_free;
} }
err = cow_file_size(header->backing_file, size); err = cow_file_size(header->backing_file, size);
if(err < 0){ if(err < 0){
cow_printf("Couldn't get size of backing file '%s', " cow_printf("write_cow_header - couldn't get size of "
"err = %d\n", header->backing_file, -err); "backing file '%s', err = %d\n",
header->backing_file, -err);
goto out_free; goto out_free;
} }
...@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, ...@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
header->alignment = htonl(alignment); header->alignment = htonl(alignment);
header->cow_format = COW_BITMAP; header->cow_format = COW_BITMAP;
err = os_write_file(fd, header, sizeof(*header)); err = cow_write_file(fd, header, sizeof(*header));
if(err != sizeof(*header)){ if(err != sizeof(*header)){
cow_printf("Write of header to new COW file '%s' failed, " cow_printf("write_cow_header - write of header to "
"err = %d\n", cow_file, -err); "new COW file '%s' failed, err = %d\n", cow_file,
-err);
goto out_free; goto out_free;
} }
err = 0; err = 0;
...@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, ...@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
} }
else if(version == 3){ else if(version == 3){
if(n < sizeof(header->v3)){ if(n < sizeof(header->v3)){
cow_printf("read_cow_header - failed to read V2 " cow_printf("read_cow_header - failed to read V3 "
"header\n"); "header\n");
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment