diff options
author | Tony Lindgren <tony@atomide.com> | 2011-11-07 21:27:23 +0100 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-11-07 21:27:23 +0100 |
commit | d30cc16c8e48368e0518f4975a78711e53e14a0f (patch) | |
tree | 26b57f7ab5a963cc3d6c57dff6951bd930875583 /arch/um/drivers/ubd_kern.c | |
parent | ARM: OMAP2: Fix H4 matrix keyboard warning (diff) | |
parent | ARM: OMAP: Fix export.h or module.h includes (diff) | |
download | linux-d30cc16c8e48368e0518f4975a78711e53e14a0f.tar.xz linux-d30cc16c8e48368e0518f4975a78711e53e14a0f.zip |
Merge branch 'fixes-modulesplit' into fixes
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 620f5b70957d..944453a3ec99 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -46,7 +46,6 @@ #include "asm/tlbflush.h" #include "mem_user.h" #include "kern_util.h" -#include "kern.h" #include "mconsole_kern.h" #include "init.h" #include "irq_user.h" @@ -54,7 +53,6 @@ #include "ubd_user.h" #include "os.h" #include "mem.h" -#include "mem_kern.h" #include "cow.h" enum ubd_req { UBD_READ, UBD_WRITE }; @@ -513,8 +511,37 @@ __uml_exitcall(kill_io_thread); static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out) { char *file; + int fd; + int err; + + __u32 version; + __u32 align; + char *backing_file; + time_t mtime; + unsigned long long size; + int sector_size; + int bitmap_offset; + + if (ubd_dev->file && ubd_dev->cow.file) { + file = ubd_dev->cow.file; + + goto out; + } - file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file; + fd = os_open_file(ubd_dev->file, global_openflags, 0); + if (fd < 0) + return fd; + + err = read_cow_header(file_reader, &fd, &version, &backing_file, \ + &mtime, &size, §or_size, &align, &bitmap_offset); + os_close_file(fd); + + if(err == -EINVAL) + file = ubd_dev->file; + else + file = backing_file; + +out: return os_file_size(file, size_out); } |