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

[PATCH] uml: tidying COW code

Improve (especially for coherence) some prototypes, and return code of
init_cow_file in error case - for a short write return -EINVAL, otherwise
return the error we got!
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 f462e8f9
...@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg); ...@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg);
extern int read_cow_header(int (*reader)(__u64, char *, int, void *), extern int read_cow_header(int (*reader)(__u64, char *, int, void *),
void *arg, __u32 *version_out, void *arg, __u32 *version_out,
char **backing_file_out, time_t *mtime_out, char **backing_file_out, time_t *mtime_out,
unsigned long long *size_out, int *sectorsize_out, __u64 *size_out, int *sectorsize_out,
__u32 *align_out, int *bitmap_offset_out); __u32 *align_out, int *bitmap_offset_out);
extern int write_cow_header(char *cow_file, int fd, char *backing_file, extern int write_cow_header(char *cow_file, int fd, char *backing_file,
......
...@@ -23,12 +23,12 @@ static inline char *cow_strdup(char *str) ...@@ -23,12 +23,12 @@ static inline char *cow_strdup(char *str)
return(uml_strdup(str)); return(uml_strdup(str));
} }
static inline int cow_seek_file(int fd, unsigned long long offset) static inline int cow_seek_file(int fd, __u64 offset)
{ {
return(os_seek_file(fd, offset)); return(os_seek_file(fd, offset));
} }
static inline int cow_file_size(char *file, unsigned long long *size_out) static inline int cow_file_size(char *file, __u64 *size_out)
{ {
return(os_file_size(file, size_out)); return(os_file_size(file, size_out));
} }
......
...@@ -362,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize, ...@@ -362,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
if(err != sizeof(zero)){ if(err != sizeof(zero)){
cow_printf("Write of bitmap to new COW file '%s' failed, " cow_printf("Write of bitmap to new COW file '%s' failed, "
"err = %d\n", cow_file, -err); "err = %d\n", cow_file, -err);
err = -EINVAL; if (err >= 0)
err = -EINVAL;
goto out; goto out;
} }
......
...@@ -1135,7 +1135,7 @@ static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow) ...@@ -1135,7 +1135,7 @@ static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow)
static int backing_file_mismatch(char *file, __u64 size, time_t mtime) static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
{ {
unsigned long modtime; unsigned long modtime;
long long actual; unsigned long long actual;
int err; int err;
err = os_file_modtime(file, &modtime); err = os_file_modtime(file, &modtime);
......
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