[Pkg-uml-commit] r292 - in trunk/src/user-mode-linux/debian: . patches

malattia at alioth.debian.org malattia at alioth.debian.org
Sun Aug 19 04:17:16 UTC 2007


Author: malattia
Date: 2007-08-19 04:17:16 +0000 (Sun, 19 Aug 2007)
New Revision: 292

Added:
   trunk/src/user-mode-linux/debian/patches/04_restructure-do_aio.patch
Modified:
   trunk/src/user-mode-linux/debian/changelog
   trunk/src/user-mode-linux/debian/patches/00list
Log:
Add upstream patch to restructure do_aio


Modified: trunk/src/user-mode-linux/debian/changelog
===================================================================
--- trunk/src/user-mode-linux/debian/changelog	2007-08-19 02:46:49 UTC (rev 291)
+++ trunk/src/user-mode-linux/debian/changelog	2007-08-19 04:17:16 UTC (rev 292)
@@ -5,6 +5,8 @@
     * remove inactive people from uploaders
     * remove debugging options from .config
     * remove umldefconfig as it's easy to get from the kernel sources
+  [Upstream patch]:
+    * Restructure do_aio (Closes: #438568)
 
  -- Mattia Dongili <malattia at debian.org>  Sun, 19 Aug 2007 11:04:10 +0900
 

Modified: trunk/src/user-mode-linux/debian/patches/00list
===================================================================
--- trunk/src/user-mode-linux/debian/patches/00list	2007-08-19 02:46:49 UTC (rev 291)
+++ trunk/src/user-mode-linux/debian/patches/00list	2007-08-19 04:17:16 UTC (rev 292)
@@ -1,2 +1,3 @@
 02_x-terminal-emulator.dpatch
 03_uml_switch.diff
+04_restructure-do_aio.patch

Added: trunk/src/user-mode-linux/debian/patches/04_restructure-do_aio.patch
===================================================================
--- trunk/src/user-mode-linux/debian/patches/04_restructure-do_aio.patch	                        (rev 0)
+++ trunk/src/user-mode-linux/debian/patches/04_restructure-do_aio.patch	2007-08-19 04:17:16 UTC (rev 292)
@@ -0,0 +1,104 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 04_restructure-do_aio.patch - Jeff Dike <jdike at linux.intel.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Restructure do_aio thanks to commments from Ulrich and Al.
+## DP: 
+## DP: Uli started this by seeing that UML's initialization of a struct iocb
+## DP: initialized fields that it shouldn't.
+## DP: 
+## DP: Al followed up by adding the following cleanups:
+## DP: 	eliminating a variable by just using an anonymous structure in
+## DP: its place.
+## DP: 	hoisting a duplicated line out of the switch.
+## DP: 	simplifying the error checking at the end.
+## DP: 
+## DP: I added a severity to the printk.
+## DP: 
+## DP: Signed-off-by: Jeff Dike <jdike at linux.intel.com>
+## DP: --
+## DP:  arch/um/os-Linux/aio.c |   47 +++++++++++++++++------------------------------
+## DP:  1 file changed, 17 insertions(+), 30 deletions(-)
+
+ at DPATCH@
+
+# Author: Jeff Dike <jdike at linux.intel.com>
+# Status: none
+
+Index: linux-2.6.17/arch/um/os-Linux/aio.c
+===================================================================
+--- linux-2.6.17.orig/arch/um/os-Linux/aio.c	2007-07-23 14:58:18.000000000 -0400
++++ linux-2.6.17/arch/um/os-Linux/aio.c	2007-07-23 14:59:13.000000000 -0400
+@@ -14,6 +14,7 @@
+ #include "init.h"
+ #include "user.h"
+ #include "mode.h"
++#include "kern_constants.h"
+ 
+ struct aio_thread_req {
+ 	enum aio_type type;
+@@ -65,47 +66,33 @@ static long io_getevents(aio_context_t c
+ static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf,
+ 		  int len, unsigned long long offset, struct aio_context *aio)
+ {
+-	struct iocb iocb, *iocbp = &iocb;
++	struct iocb *iocbp = & ((struct iocb) {
++				    .aio_data       = (unsigned long) aio,
++				    .aio_fildes     = fd,
++				    .aio_buf        = (unsigned long) buf,
++				    .aio_nbytes     = len,
++				    .aio_offset     = offset
++			     });
+ 	char c;
+-	int err;
+-
+-	iocb = ((struct iocb) { .aio_data 	= (unsigned long) aio,
+-				.aio_reqprio	= 0,
+-				.aio_fildes	= fd,
+-				.aio_buf	= (unsigned long) buf,
+-				.aio_nbytes	= len,
+-				.aio_offset	= offset,
+-				.aio_reserved1	= 0,
+-				.aio_reserved2	= 0,
+-				.aio_reserved3	= 0 });
+ 
+-	switch(type){
++	switch (type) {
+ 	case AIO_READ:
+-		iocb.aio_lio_opcode = IOCB_CMD_PREAD;
+-		err = io_submit(ctx, 1, &iocbp);
++		iocbp->aio_lio_opcode = IOCB_CMD_PREAD;
+ 		break;
+ 	case AIO_WRITE:
+-		iocb.aio_lio_opcode = IOCB_CMD_PWRITE;
+-		err = io_submit(ctx, 1, &iocbp);
++		iocbp->aio_lio_opcode = IOCB_CMD_PWRITE;
+ 		break;
+ 	case AIO_MMAP:
+-		iocb.aio_lio_opcode = IOCB_CMD_PREAD;
+-		iocb.aio_buf = (unsigned long) &c;
+-		iocb.aio_nbytes = sizeof(c);
+-		err = io_submit(ctx, 1, &iocbp);
++		iocbp->aio_lio_opcode = IOCB_CMD_PREAD;
++		iocbp->aio_buf = (unsigned long) &c;
++		iocbp->aio_nbytes = sizeof(c);
+ 		break;
+ 	default:
+-		printk("Bogus op in do_aio - %d\n", type);
+-		err = -EINVAL;
+-		break;
++		printk(UM_KERN_ERR "Bogus op in do_aio - %d\n", type);
++		return -EINVAL;
+ 	}
+ 
+-	if(err > 0)
+-		err = 0;
+-	else
+-		err = -errno;
+-
+-	return err;
++	return (io_submit(ctx, 1, &iocbp) > 0) ? 0 : -errno;
+ }
+ 
+ /* Initialized in an initcall and unchanged thereafter */
+




More information about the Pkg-uml-commit mailing list