Commit 5af50f60 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: allow ubd devices to provide partial end blocks

If the file backing a ubd device is not an even blocklength, then the last
partial block is now readable, and it is padded with zeros.
Signed-off-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 c1839d3f
...@@ -682,6 +682,8 @@ static int ubd_new_disk(int major, u64 size, int unit, ...@@ -682,6 +682,8 @@ static int ubd_new_disk(int major, u64 size, int unit,
return 0; return 0;
} }
#define ROUND_BLOCK(n) ((n + ((1 << 9) - 1)) & (-1 << 9))
static int ubd_add(int n) static int ubd_add(int n)
{ {
struct ubd *dev = &ubd_dev[n]; struct ubd *dev = &ubd_dev[n];
...@@ -697,6 +699,8 @@ static int ubd_add(int n) ...@@ -697,6 +699,8 @@ static int ubd_add(int n)
if(err < 0) if(err < 0)
return(err); return(err);
dev->size = ROUND_BLOCK(dev->size);
err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
if(err) if(err)
return(err); return(err);
......
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