The patch titled uml ubd driver: do not store error codes as ->fd has been added to the -mm tree. Its filename is uml-ubd-driver-do-not-store-error-codes-as-fd.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: uml ubd driver: do not store error codes as ->fd From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx> To simplify error handling, make sure fd is saved into ubd_dev->fd only when we are sure it is an fd and not an error code. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx> Cc: Jeff Dike <jdike@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/um/drivers/ubd_kern.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff -puN arch/um/drivers/ubd_kern.c~uml-ubd-driver-do-not-store-error-codes-as-fd arch/um/drivers/ubd_kern.c --- a/arch/um/drivers/ubd_kern.c~uml-ubd-driver-do-not-store-error-codes-as-fd +++ a/arch/um/drivers/ubd_kern.c @@ -578,33 +578,36 @@ static int ubd_open_dev(struct ubd *ubd_ struct openflags flags; char **back_ptr; int err, create_cow, *create_ptr; + int fd; ubd_dev->openflags = ubd_dev->boot_openflags; create_cow = 0; create_ptr = (ubd_dev->cow.file != NULL) ? &create_cow : NULL; back_ptr = ubd_dev->no_cow ? NULL : &ubd_dev->cow.file; - ubd_dev->fd = open_ubd_file(ubd_dev->file, &ubd_dev->openflags, ubd_dev->shared, + + fd = open_ubd_file(ubd_dev->file, &ubd_dev->openflags, ubd_dev->shared, back_ptr, &ubd_dev->cow.bitmap_offset, &ubd_dev->cow.bitmap_len, &ubd_dev->cow.data_offset, create_ptr); - if((ubd_dev->fd == -ENOENT) && create_cow){ - ubd_dev->fd = create_cow_file(ubd_dev->file, ubd_dev->cow.file, + if((fd == -ENOENT) && create_cow){ + fd = create_cow_file(ubd_dev->file, ubd_dev->cow.file, ubd_dev->openflags, 1 << 9, PAGE_SIZE, &ubd_dev->cow.bitmap_offset, &ubd_dev->cow.bitmap_len, &ubd_dev->cow.data_offset); - if(ubd_dev->fd >= 0){ + if(fd >= 0){ printk(KERN_INFO "Creating \"%s\" as COW file for " "\"%s\"\n", ubd_dev->file, ubd_dev->cow.file); } } - if(ubd_dev->fd < 0){ + if(fd < 0){ printk("Failed to open '%s', errno = %d\n", ubd_dev->file, - -ubd_dev->fd); - return(ubd_dev->fd); + -fd); + return fd; } + ubd_dev->fd = fd; if(ubd_dev->cow.file != NULL){ err = -ENOMEM; _ Patches currently in -mm which might be from blaisorblade@xxxxxxxx are fix-remove-the-use-of-_syscallx-macros-in-uml.patch uml-fix-compilation-options-for-user_objs.patch uml-ubd-driver-allow-using-up-to-16-ubd-devices.patch uml-ubd-driver-document-some-struct-fields.patch uml-ubd-driver-var-renames.patch uml-ubd-driver-give-better-names-to-some-functions.patch uml-ubd-driver-change-ubd_lock-to-be-a-mutex.patch uml-ubd-driver-ubd_io_lock-usage-fixup.patch uml-ubd-driver-reformat-ubd_config.patch uml-ubd-driver-convert-do_ubd-to-a-boolean-variable.patch uml-ubd-driver-use-bitfields-where-possible.patch uml-ubd-driver-do-not-store-error-codes-as-fd.patch uml-ubd-driver-various-little-changes.patch uml-fix-prototypes.patch uml-make-execvp-safe-for-our-usage.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html