ia64/xen-unstable
changeset 609:f36f032527a0
bitkeeper revision 1.339.1.2 (3f109e02qA-VmVFt9cmV0JaASgeSeg)
proc_cmd.h, dom0_core.c, xl_block.c:
Bug fixes to new proc interface.
proc_cmd.h, dom0_core.c, xl_block.c:
Bug fixes to new proc interface.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Sat Jul 12 23:47:14 2003 +0000 (2003-07-12) |
parents | 9339f3942f4e |
children | cda951fc1bef 75185d4cce5b |
files | xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c xenolinux-2.4.21-sparse/include/asm-xeno/proc_cmd.h |
line diff
1.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c Sat Jul 12 22:26:07 2003 +0000 1.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c Sat Jul 12 23:47:14 2003 +0000 1.3 @@ -507,9 +507,7 @@ static void xlblk_response_int(int irq, 1.4 case XEN_BLOCK_PROBE_BLK: 1.5 case XEN_BLOCK_PHYSDEV_GRANT: 1.6 case XEN_BLOCK_PHYSDEV_PROBE: 1.7 - if ( bret->status ) 1.8 - printk(KERN_ALERT "Bad return from blkdev control request\n"); 1.9 - xlblk_control_msg_pending = 0; 1.10 + xlblk_control_msg_pending = bret->status; 1.11 break; 1.12 1.13 default: 1.14 @@ -547,19 +545,19 @@ int xenolinux_control_msg(int operation, 1.15 if ( aligned_buf == NULL ) BUG(); 1.16 memcpy(aligned_buf, buffer, size); 1.17 1.18 - xlblk_control_msg_pending = 1; 1.19 + xlblk_control_msg_pending = 2; 1.20 spin_lock_irqsave(&io_request_lock, flags); 1.21 /* Note that size gets rounded up to a sector-sized boundary. */ 1.22 if ( hypervisor_request(0, operation, aligned_buf, 0, (size+511)/512, 0) ) 1.23 return -EAGAIN; 1.24 signal_requests_to_xen(); 1.25 spin_unlock_irqrestore(&io_request_lock, flags); 1.26 - while ( xlblk_control_msg_pending ) barrier(); 1.27 + while ( xlblk_control_msg_pending == 2 ) barrier(); 1.28 1.29 memcpy(buffer, aligned_buf, size); 1.30 free_page((unsigned long)aligned_buf); 1.31 1.32 - return 0; 1.33 + return xlblk_control_msg_pending ? -EINVAL : 0; 1.34 } 1.35 1.36
2.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c Sat Jul 12 22:26:07 2003 +0000 2.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c Sat Jul 12 23:47:14 2003 +0000 2.3 @@ -47,8 +47,10 @@ static int privcmd_ioctl(struct inode *i 2.4 case IOCTL_PRIVCMD_HYPERCALL: 2.5 { 2.6 privcmd_hypercall_t hypercall; 2.7 + 2.8 if ( copy_from_user(&hypercall, (void *)data, sizeof(hypercall)) ) 2.9 return -EFAULT; 2.10 + 2.11 __asm__ __volatile__ ( 2.12 "pushl %%ebx; pushl %%ecx; pushl %%edx; pushl %%esi; pushl %%edi; " 2.13 "movl 4(%%eax),%%ebx ;" 2.14 @@ -68,34 +70,47 @@ static int privcmd_ioctl(struct inode *i 2.15 privcmd_blkmsg_t blkmsg; 2.16 char *kbuf; 2.17 int ret; 2.18 + 2.19 if ( copy_from_user(&blkmsg, (void *)data, sizeof(blkmsg)) ) 2.20 return -EFAULT; 2.21 + 2.22 if ( blkmsg.buf_size > PAGE_SIZE ) 2.23 return -EINVAL; 2.24 + 2.25 if ( (kbuf = kmalloc(blkmsg.buf_size, GFP_KERNEL)) == NULL ) 2.26 return -ENOMEM; 2.27 + 2.28 if ( copy_from_user(kbuf, blkmsg.buf, blkmsg.buf_size) ) { 2.29 kfree(kbuf); 2.30 return -EFAULT; 2.31 } 2.32 + 2.33 ret = xenolinux_control_msg((int)blkmsg.op, kbuf, blkmsg.buf_size); 2.34 if ( ret != 0 ) { 2.35 kfree(kbuf); 2.36 return ret; 2.37 } 2.38 + 2.39 if ( copy_to_user(blkmsg.buf, kbuf, blkmsg.buf_size) ) { 2.40 kfree(kbuf); 2.41 return -EFAULT; 2.42 } 2.43 + 2.44 kfree(kbuf); 2.45 } 2.46 break; 2.47 2.48 case IOCTL_PRIVCMD_LINDEV_TO_XENDEV: 2.49 + { 2.50 ret = (int)xldev_to_physdev((kdev_t)data); 2.51 + } 2.52 + break; 2.53 2.54 case IOCTL_PRIVCMD_XENDEV_TO_LINDEV: 2.55 + { 2.56 ret = (int)physdev_to_xldev((unsigned short)data); 2.57 + } 2.58 + break; 2.59 2.60 default: 2.61 {
3.1 --- a/xenolinux-2.4.21-sparse/include/asm-xeno/proc_cmd.h Sat Jul 12 22:26:07 2003 +0000 3.2 +++ b/xenolinux-2.4.21-sparse/include/asm-xeno/proc_cmd.h Sat Jul 12 23:47:14 2003 +0000 3.3 @@ -7,11 +7,6 @@ 3.4 #ifndef __PROC_CMD_H__ 3.5 #define __PROC_CMD_H__ 3.6 3.7 -#define IOCTL_PRIVCMD_HYPERCALL 0 3.8 -#define IOCTL_PRIVCMD_BLKMSG 1 3.9 -#define IOCTL_PRIVCMD_LINDEV_TO_XENDEV 2 3.10 -#define IOCTL_PRIVCMD_XENDEV_TO_LINDEV 3 3.11 - 3.12 typedef struct privcmd_hypercall 3.13 { 3.14 unsigned long op; 3.15 @@ -25,4 +20,13 @@ typedef struct privcmd_blkmsg 3.16 int buf_size; 3.17 } privcmd_blkmsg_t; 3.18 3.19 +#define IOCTL_PRIVCMD_HYPERCALL \ 3.20 + _IOC(_IOC_NONE, 'P', 0, sizeof(privcmd_hypercall_t)) 3.21 +#define IOCTL_PRIVCMD_BLKMSG \ 3.22 + _IOC(_IOC_NONE, 'P', 1, sizeof(privcmd_blkmsg_t)) 3.23 +#define IOCTL_PRIVCMD_LINDEV_TO_XENDEV \ 3.24 + _IOC(_IOC_NONE, 'P', 2, sizeof(unsigned short)) 3.25 +#define IOCTL_PRIVCMD_XENDEV_TO_LINDEV \ 3.26 + _IOC(_IOC_NONE, 'P', 3, sizeof(unsigned short)) 3.27 + 3.28 #endif /* __PROC_CMD_H__ */