aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/cow_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/cow_user.c')
-rw-r--r--arch/um/drivers/cow_user.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index fbe2217db5dd..61951b721268 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
176 err = -ENOMEM; 176 err = -ENOMEM;
177 header = cow_malloc(sizeof(*header)); 177 header = cow_malloc(sizeof(*header));
178 if(header == NULL){ 178 if(header == NULL){
179 cow_printf("Failed to allocate COW V3 header\n"); 179 cow_printf("write_cow_header - failed to allocate COW V3 header\n");
180 goto out; 180 goto out;
181 } 181 }
182 header->magic = htonl(COW_MAGIC); 182 header->magic = htonl(COW_MAGIC);
@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
196 196
197 err = os_file_modtime(header->backing_file, &modtime); 197 err = os_file_modtime(header->backing_file, &modtime);
198 if(err < 0){ 198 if(err < 0){
199 cow_printf("Backing file '%s' mtime request failed, " 199 cow_printf("write_cow_header - backing file '%s' mtime "
200 "err = %d\n", header->backing_file, -err); 200 "request failed, err = %d\n", header->backing_file,
201 -err);
201 goto out_free; 202 goto out_free;
202 } 203 }
203 204
204 err = cow_file_size(header->backing_file, size); 205 err = cow_file_size(header->backing_file, size);
205 if(err < 0){ 206 if(err < 0){
206 cow_printf("Couldn't get size of backing file '%s', " 207 cow_printf("write_cow_header - couldn't get size of "
207 "err = %d\n", header->backing_file, -err); 208 "backing file '%s', err = %d\n",
209 header->backing_file, -err);
208 goto out_free; 210 goto out_free;
209 } 211 }
210 212
@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
214 header->alignment = htonl(alignment); 216 header->alignment = htonl(alignment);
215 header->cow_format = COW_BITMAP; 217 header->cow_format = COW_BITMAP;
216 218
217 err = os_write_file(fd, header, sizeof(*header)); 219 err = cow_write_file(fd, header, sizeof(*header));
218 if(err != sizeof(*header)){ 220 if(err != sizeof(*header)){
219 cow_printf("Write of header to new COW file '%s' failed, " 221 cow_printf("write_cow_header - write of header to "
220 "err = %d\n", cow_file, -err); 222 "new COW file '%s' failed, err = %d\n", cow_file,
223 -err);
221 goto out_free; 224 goto out_free;
222 } 225 }
223 err = 0; 226 err = 0;
@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
299 } 302 }
300 else if(version == 3){ 303 else if(version == 3){
301 if(n < sizeof(header->v3)){ 304 if(n < sizeof(header->v3)){
302 cow_printf("read_cow_header - failed to read V2 " 305 cow_printf("read_cow_header - failed to read V3 "
303 "header\n"); 306 "header\n");
304 goto out; 307 goto out;
305 } 308 }
@@ -359,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
359 if(err != sizeof(zero)){ 362 if(err != sizeof(zero)){
360 cow_printf("Write of bitmap to new COW file '%s' failed, " 363 cow_printf("Write of bitmap to new COW file '%s' failed, "
361 "err = %d\n", cow_file, -err); 364 "err = %d\n", cow_file, -err);
362 err = -EINVAL; 365 if (err >= 0)
366 err = -EINVAL;
363 goto out; 367 goto out;
364 } 368 }
365 369