direct-io.hg
changeset 538:85abfe09ce32
bitkeeper revision 1.298 (3f0abd1eIZ0uRBzOhjxHKMhL6Hmm2w)
Whitespace fixes.
Whitespace fixes.
author | sos22@labyrinth.cl.cam.ac.uk |
---|---|
date | Tue Jul 08 12:46:22 2003 +0000 (2003-07-08) |
parents | 00a8c9490645 |
children | 3db5e8065e2d |
files | BitKeeper/etc/ignore xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c xenolinux-2.4.21-sparse/fs/partitions/xeno.c |
line diff
1.1 --- a/BitKeeper/etc/ignore Tue Jul 08 12:00:16 2003 +0000 1.2 +++ b/BitKeeper/etc/ignore Tue Jul 08 12:46:22 2003 +0000 1.3 @@ -428,3 +428,6 @@ xenolinux-2.4.16-sparse/arch/xeno/driver 1.4 xenolinux-2.4.16-sparse/scripts/kconfig.tk 1.5 xenolinux-2.4.21-sparse/include/linux/blk.h~ 1.6 tools/control/.checkstyle 1.7 +xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c~ 1.8 +xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c.bak 1.9 +xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c~
2.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c Tue Jul 08 12:00:16 2003 +0000 2.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c Tue Jul 08 12:46:22 2003 +0000 2.3 @@ -15,105 +15,106 @@ extern unsigned short xldev_to_physdev(k 2.4 2.5 static dev_t physdev_to_xldev(unsigned short physdev) 2.6 { 2.7 - switch (physdev & XENDEV_TYPE_MASK) { 2.8 - case XENDEV_IDE: 2.9 - switch (physdev & XENDEV_IDX_MASK) { 2.10 - case 0 ... (XLIDE_DEVS_PER_MAJOR-1): 2.11 - return MKDEV(XLIDE_MAJOR_0, 2.12 - (physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT); 2.13 - case XLIDE_DEVS_PER_MAJOR ... (XLIDE_DEVS_PER_MAJOR * 2 - 1): 2.14 - return MKDEV(XLIDE_MAJOR_1, 2.15 - (physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT); 2.16 + switch (physdev & XENDEV_TYPE_MASK) { 2.17 + case XENDEV_IDE: 2.18 + switch (physdev & XENDEV_IDX_MASK) { 2.19 + case 0...(XLIDE_DEVS_PER_MAJOR - 1): 2.20 + return MKDEV(XLIDE_MAJOR_0, 2.21 + (physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT); 2.22 + case XLIDE_DEVS_PER_MAJOR...(XLIDE_DEVS_PER_MAJOR * 2 - 1): 2.23 + return MKDEV(XLIDE_MAJOR_1, 2.24 + (physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT); 2.25 + } 2.26 + break; 2.27 + case XENDEV_SCSI: 2.28 + return MKDEV(XLSCSI_MAJOR, 2.29 + (physdev & XENDEV_IDX_MASK) << XLSCSI_PARTN_SHIFT); 2.30 + case XENDEV_VIRTUAL: 2.31 + return MKDEV(XLVIRT_MAJOR, 2.32 + (physdev & XENDEV_IDX_MASK) << XLVIRT_PARTN_SHIFT); 2.33 } 2.34 - break; 2.35 - case XENDEV_SCSI: 2.36 - return MKDEV(XLSCSI_MAJOR, 2.37 - (physdev & XENDEV_IDX_MASK) << XLSCSI_PARTN_SHIFT); 2.38 - case XENDEV_VIRTUAL: 2.39 - return MKDEV(XLVIRT_MAJOR, 2.40 - (physdev & XENDEV_IDX_MASK) << XLVIRT_PARTN_SHIFT); 2.41 - } 2.42 - printk(KERN_ALERT "Unrecognised xl device: %x\n", physdev); 2.43 - BUG(); 2.44 - return -1; 2.45 + printk(KERN_ALERT "Unrecognised xl device: %x\n", physdev); 2.46 + BUG(); 2.47 + return -1; 2.48 } 2.49 2.50 -static ssize_t proc_read_phd(struct file * file, char * buff, size_t size, 2.51 +static ssize_t proc_read_phd(struct file *file, char *buff, size_t size, 2.52 loff_t * off) 2.53 { 2.54 - physdisk_probebuf_t *buf; 2.55 - int res; 2.56 - struct proc_dir_entry *pde; 2.57 - int x; 2.58 + physdisk_probebuf_t *buf; 2.59 + int res; 2.60 + struct proc_dir_entry *pde; 2.61 + int x; 2.62 2.63 - if (size != sizeof(physdisk_probebuf_t)) 2.64 - return -EINVAL; 2.65 + if (size != sizeof(physdisk_probebuf_t)) 2.66 + return -EINVAL; 2.67 2.68 - buf = kmalloc(sizeof(physdisk_probebuf_t), GFP_KERNEL); 2.69 - if (!buf) 2.70 - return -ENOMEM; 2.71 + buf = kmalloc(sizeof(physdisk_probebuf_t), GFP_KERNEL); 2.72 + if (!buf) 2.73 + return -ENOMEM; 2.74 2.75 - pde = file->f_dentry->d_inode->u.generic_ip; 2.76 - buf->domain = (int)pde->data; 2.77 + pde = file->f_dentry->d_inode->u.generic_ip; 2.78 + buf->domain = (int) pde->data; 2.79 2.80 - /* The offset reported by lseek and friends doesn't have to be in 2.81 - bytes, and it's marginally easier to say that it's in records, so 2.82 - that's what we do. */ 2.83 - buf->start_ind = *off; 2.84 - res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (void *)buf, 2.85 - sizeof(physdisk_probebuf_t)); 2.86 - *off += buf->n_aces; 2.87 + /* The offset reported by lseek and friends doesn't have to be in 2.88 + bytes, and it's marginally easier to say that it's in records, so 2.89 + that's what we do. */ 2.90 + buf->start_ind = *off; 2.91 + res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (void *) buf, 2.92 + sizeof(physdisk_probebuf_t)); 2.93 + *off += buf->n_aces; 2.94 2.95 - if (res) 2.96 - res = -EINVAL; 2.97 - else { 2.98 - for (x = 0; x < buf->n_aces; x++) 2.99 - buf->entries[x].device = physdev_to_xldev(buf->entries[x].device); 2.100 - res = sizeof(physdisk_probebuf_t); 2.101 - if (copy_to_user(buff, buf, sizeof(physdisk_probebuf_t))) { 2.102 - res = -EFAULT; 2.103 + if (res) 2.104 + res = -EINVAL; 2.105 + else { 2.106 + for (x = 0; x < buf->n_aces; x++) 2.107 + buf->entries[x].device = 2.108 + physdev_to_xldev(buf->entries[x].device); 2.109 + res = sizeof(physdisk_probebuf_t); 2.110 + if (copy_to_user(buff, buf, sizeof(physdisk_probebuf_t))) { 2.111 + res = -EFAULT; 2.112 + } 2.113 } 2.114 - } 2.115 - kfree(buf); 2.116 - return res; 2.117 + kfree(buf); 2.118 + return res; 2.119 } 2.120 2.121 static int proc_write_phd(struct file *file, const char *buffer, 2.122 - size_t count, loff_t *ignore) 2.123 + size_t count, loff_t * ignore) 2.124 { 2.125 - char *local; 2.126 - int res; 2.127 - xp_disk_t *xpd; 2.128 - struct proc_dir_entry *pde; 2.129 + char *local; 2.130 + int res; 2.131 + xp_disk_t *xpd; 2.132 + struct proc_dir_entry *pde; 2.133 2.134 - if (count != sizeof(xp_disk_t)) 2.135 - return -EINVAL; 2.136 + if (count != sizeof(xp_disk_t)) 2.137 + return -EINVAL; 2.138 2.139 - local = kmalloc(count + 1, GFP_KERNEL); 2.140 - if (!local) 2.141 - return -ENOMEM; 2.142 - if (copy_from_user(local, buffer, count)) { 2.143 - res = -EFAULT; 2.144 - goto out; 2.145 - } 2.146 + local = kmalloc(count + 1, GFP_KERNEL); 2.147 + if (!local) 2.148 + return -ENOMEM; 2.149 + if (copy_from_user(local, buffer, count)) { 2.150 + res = -EFAULT; 2.151 + goto out; 2.152 + } 2.153 2.154 - xpd = (xp_disk_t *)local; 2.155 + xpd = (xp_disk_t *) local; 2.156 2.157 - pde = file->f_dentry->d_inode->u.generic_ip; 2.158 - xpd->domain = (int)pde->data; 2.159 - xpd->device = xldev_to_physdev(xpd->device); 2.160 + pde = file->f_dentry->d_inode->u.generic_ip; 2.161 + xpd->domain = (int) pde->data; 2.162 + xpd->device = xldev_to_physdev(xpd->device); 2.163 2.164 - res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_GRANT, local, count); 2.165 - if (res == 0) 2.166 - res = count; 2.167 - else 2.168 - res = -EINVAL; 2.169 - out: 2.170 - kfree(local); 2.171 - return res; 2.172 + res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_GRANT, local, count); 2.173 + if (res == 0) 2.174 + res = count; 2.175 + else 2.176 + res = -EINVAL; 2.177 + out: 2.178 + kfree(local); 2.179 + return res; 2.180 } 2.181 2.182 struct file_operations dom0_phd_fops = { 2.183 - read : proc_read_phd, 2.184 - write : proc_write_phd 2.185 + read:proc_read_phd, 2.186 + write:proc_write_phd 2.187 };
3.1 --- a/xenolinux-2.4.21-sparse/fs/partitions/xeno.c Tue Jul 08 12:00:16 2003 +0000 3.2 +++ b/xenolinux-2.4.21-sparse/fs/partitions/xeno.c Tue Jul 08 12:46:22 2003 +0000 3.3 @@ -20,59 +20,58 @@ int xeno_partition(struct gendisk *hd, 3.4 unsigned long first_sec, 3.5 int first_part_minor) 3.6 { 3.7 - physdisk_probebuf_t *buf; 3.8 - int i; 3.9 - int minor; 3.10 - int count; 3.11 - 3.12 - buf = kmalloc(sizeof(*buf), GFP_KERNEL); 3.13 - if (!buf) 3.14 - return -ENOMEM; 3.15 - buf->domain = start_info.dom_id; 3.16 - buf->start_ind = 0; 3.17 - buf->n_aces = PHYSDISK_MAX_ACES_PER_REQUEST; 3.18 + physdisk_probebuf_t *buf; 3.19 + int i; 3.20 + int minor; 3.21 + int count; 3.22 + 3.23 + buf = kmalloc(sizeof(*buf), GFP_KERNEL); 3.24 + if (!buf) 3.25 + return -ENOMEM; 3.26 + buf->domain = start_info.dom_id; 3.27 + buf->start_ind = 0; 3.28 + buf->n_aces = PHYSDISK_MAX_ACES_PER_REQUEST; 3.29 3.30 - xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (char *)buf, 3.31 - sizeof(*buf)); 3.32 - if (buf->n_aces == 0) { 3.33 - kfree(buf); 3.34 - return 0; 3.35 - } 3.36 + xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (char *)buf, 3.37 + sizeof(*buf)); 3.38 + if (buf->n_aces == 0) { 3.39 + kfree(buf); 3.40 + return 0; 3.41 + } 3.42 3.43 - if (buf->n_aces == PHYSDISK_MAX_ACES_PER_REQUEST) { 3.44 - kfree(buf); 3.45 - return 0; 3.46 - } 3.47 + if (buf->n_aces == PHYSDISK_MAX_ACES_PER_REQUEST) { 3.48 + kfree(buf); 3.49 + return 0; 3.50 + } 3.51 3.52 - count = 0; 3.53 + count = 0; 3.54 3.55 - for (i = 0; i < buf->n_aces; i++) { 3.56 - if (buf->entries[i].partition == 0) { 3.57 - continue; 3.58 - } 3.59 - /* Make sure the partition is actually supposed to be on this 3.60 - disk. This assumes that Xen and XenoLinux block device 3.61 - numbers match up. */ 3.62 - if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev)) { 3.63 - continue; 3.64 - } 3.65 - /* This is a bit of a hack - the partition numbers are specified 3.66 - by the hypervisor, and if we want them to match up, this is 3.67 - what we need to do. */ 3.68 - count ++; 3.69 - minor = buf->entries[i].partition + first_part_minor - 1; 3.70 - add_gd_partition(hd, 3.71 - minor, 3.72 - buf->entries[i].start_sect, 3.73 - buf->entries[i].n_sectors); 3.74 - } 3.75 - kfree(buf); 3.76 + for (i = 0; i < buf->n_aces; i++) { 3.77 + if (buf->entries[i].partition == 0) { 3.78 + continue; 3.79 + } 3.80 + /* Make sure the partition is actually supposed to be on this 3.81 + disk. */ 3.82 + if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev)) { 3.83 + continue; 3.84 + } 3.85 + /* This is a bit of a hack - the partition numbers are 3.86 + specified by the hypervisor, and if we want them to match 3.87 + up, this is what we need to do. */ 3.88 + count ++; 3.89 + minor = buf->entries[i].partition + first_part_minor - 1; 3.90 + add_gd_partition(hd, 3.91 + minor, 3.92 + buf->entries[i].start_sect, 3.93 + buf->entries[i].n_sectors); 3.94 + } 3.95 + kfree(buf); 3.96 3.97 - /* If we didn't find any suitable Xeno partitions, try the other 3.98 - types. */ 3.99 - if (!count) 3.100 - return 0; 3.101 + /* If we didn't find any suitable Xeno partitions, try the other 3.102 + types. */ 3.103 + if (!count) 3.104 + return 0; 3.105 3.106 - printk("\n"); 3.107 - return 1; 3.108 + printk("\n"); 3.109 + return 1; 3.110 }