diff options
author | jdike <jdike> | 2003-08-07 18:56:43 +0000 |
---|---|---|
committer | jdike <jdike> | 2003-08-07 18:56:43 +0000 |
commit | 09ef23fe908d22571c9869a003d947f16eb60511 (patch) | |
tree | bf6669a16d3fae2a65cc2d092a22dad027a165e2 | |
parent | d0bc9d94a73943f7703cf5be0dcc9798d8aef24f (diff) | |
download | uml-history-09ef23fe908d22571c9869a003d947f16eb60511.tar.gz |
Added a 'd' option, which makes a device that looks like a COW file to be
treated as normal data.
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index ecd3040..0e65792 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -132,6 +132,7 @@ struct ubd { struct openflags boot_openflags; struct openflags openflags; devfs_handle_t devfs; + int no_cow; struct cow cow; }; @@ -151,6 +152,7 @@ struct ubd { .boot_openflags = OPEN_FLAGS, \ .openflags = OPEN_FLAGS, \ .devfs = NULL, \ + .no_cow = 0, \ .cow = DEFAULT_COW, \ } @@ -322,14 +324,19 @@ static int ubd_setup_common(char *str, int *index_out) if(index_out) *index_out = n; - if (*str == 'r'){ + if(*str == 'r'){ flags.w = 0; str++; } - if (*str == 's'){ + if(*str == 's'){ flags.s = 1; str++; } + if(*str == 'd'){ + dev->no_cow = 1; + str++; + } + if(*str++ != '='){ printk(KERN_ERR "ubd_setup : Expected '='\n"); goto out2; @@ -338,8 +345,13 @@ static int ubd_setup_common(char *str, int *index_out) err = 0; backing_file = strchr(str, ','); if(backing_file){ - *backing_file = '\0'; - backing_file++; + if(dev->no_cow) + printk(KERN_ERR "Can't specify both 'd' and a " + "cow file\n"); + else { + *backing_file = '\0'; + backing_file++; + } } dev->file = str; dev->cow.file = backing_file; @@ -692,12 +704,14 @@ static void ubd_close(struct ubd *dev) static int ubd_open_dev(struct ubd *dev) { struct openflags flags; + char **back_ptr; int err, create_cow, *create_ptr; dev->openflags = dev->boot_openflags; create_cow = 0; create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL; - dev->fd = open_ubd_file(dev->file, &dev->openflags, &dev->cow.file, + back_ptr = dev->no_cow ? NULL : &dev->cow.file; + dev->fd = open_ubd_file(dev->file, &dev->openflags, back_ptr, &dev->cow.bitmap_offset, &dev->cow.bitmap_len, &dev->cow.data_offset, create_ptr); @@ -718,7 +732,10 @@ static int ubd_open_dev(struct ubd *dev) if(dev->cow.file != NULL){ err = -ENOMEM; dev->cow.bitmap = (void *) vmalloc(dev->cow.bitmap_len); - if(dev->cow.bitmap == NULL) goto error; + if(dev->cow.bitmap == NULL){ + printk(KERN_ERR "Failed to vmalloc COW bitmap\n"); + goto error; + } flush_tlb_kernel_vm(); err = read_cow_bitmap(dev->fd, dev->cow.bitmap, |