mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.298 (3f0abd1eIZ0uRBzOhjxHKMhL6Hmm2w)
Whitespace fixes.
This commit is contained in:
1 parent
5e0754eee9
commit
0aeaa321ab
3 files changed
+131
-128
No files matched your search
@@ -428,3 +428,6 @@ xenolinux-2.4.16-sparse/arch/xeno/drivers/block/block.c.orig
|
||||
xenolinux-2.4.16-sparse/scripts/kconfig.tk
|
||||
xenolinux-2.4.21-sparse/include/linux/blk.h~
|
||||
tools/control/.checkstyle
|
||||
xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_block.c~
|
||||
xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c.bak
|
||||
xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c~
|
||||
@@ -15,105 +15,106 @@ extern unsigned short xldev_to_physdev(kdev_t xldev);
|
||||
|
||||
static dev_t physdev_to_xldev(unsigned short physdev)
|
||||
{
|
||||
switch (physdev & XENDEV_TYPE_MASK) {
|
||||
case XENDEV_IDE:
|
||||
switch (physdev & XENDEV_IDX_MASK) {
|
||||
case 0 ... (XLIDE_DEVS_PER_MAJOR-1):
|
||||
return MKDEV(XLIDE_MAJOR_0,
|
||||
(physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT);
|
||||
case XLIDE_DEVS_PER_MAJOR ... (XLIDE_DEVS_PER_MAJOR * 2 - 1):
|
||||
return MKDEV(XLIDE_MAJOR_1,
|
||||
(physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT);
|
||||
switch (physdev & XENDEV_TYPE_MASK) {
|
||||
case XENDEV_IDE:
|
||||
switch (physdev & XENDEV_IDX_MASK) {
|
||||
case 0...(XLIDE_DEVS_PER_MAJOR - 1):
|
||||
return MKDEV(XLIDE_MAJOR_0,
|
||||
(physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT);
|
||||
case XLIDE_DEVS_PER_MAJOR...(XLIDE_DEVS_PER_MAJOR * 2 - 1):
|
||||
return MKDEV(XLIDE_MAJOR_1,
|
||||
(physdev & XENDEV_IDX_MASK) << XLIDE_PARTN_SHIFT);
|
||||
}
|
||||
break;
|
||||
case XENDEV_SCSI:
|
||||
return MKDEV(XLSCSI_MAJOR,
|
||||
(physdev & XENDEV_IDX_MASK) << XLSCSI_PARTN_SHIFT);
|
||||
case XENDEV_VIRTUAL:
|
||||
return MKDEV(XLVIRT_MAJOR,
|
||||
(physdev & XENDEV_IDX_MASK) << XLVIRT_PARTN_SHIFT);
|
||||
}
|
||||
break;
|
||||
case XENDEV_SCSI:
|
||||
return MKDEV(XLSCSI_MAJOR,
|
||||
(physdev & XENDEV_IDX_MASK) << XLSCSI_PARTN_SHIFT);
|
||||
case XENDEV_VIRTUAL:
|
||||
return MKDEV(XLVIRT_MAJOR,
|
||||
(physdev & XENDEV_IDX_MASK) << XLVIRT_PARTN_SHIFT);
|
||||
}
|
||||
printk(KERN_ALERT "Unrecognised xl device: %x\n", physdev);
|
||||
BUG();
|
||||
return -1;
|
||||
printk(KERN_ALERT "Unrecognised xl device: %x\n", physdev);
|
||||
BUG();
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t proc_read_phd(struct file * file, char * buff, size_t size,
|
||||
static ssize_t proc_read_phd(struct file *file, char *buff, size_t size,
|
||||
loff_t * off)
|
||||
{
|
||||
physdisk_probebuf_t *buf;
|
||||
int res;
|
||||
struct proc_dir_entry *pde;
|
||||
int x;
|
||||
physdisk_probebuf_t *buf;
|
||||
int res;
|
||||
struct proc_dir_entry *pde;
|
||||
int x;
|
||||
|
||||
if (size != sizeof(physdisk_probebuf_t))
|
||||
return -EINVAL;
|
||||
if (size != sizeof(physdisk_probebuf_t))
|
||||
return -EINVAL;
|
||||
|
||||
buf = kmalloc(sizeof(physdisk_probebuf_t), GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
buf = kmalloc(sizeof(physdisk_probebuf_t), GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
pde = file->f_dentry->d_inode->u.generic_ip;
|
||||
buf->domain = (int)pde->data;
|
||||
pde = file->f_dentry->d_inode->u.generic_ip;
|
||||
buf->domain = (int) pde->data;
|
||||
|
||||
/* The offset reported by lseek and friends doesn't have to be in
|
||||
bytes, and it's marginally easier to say that it's in records, so
|
||||
that's what we do. */
|
||||
buf->start_ind = *off;
|
||||
res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (void *)buf,
|
||||
sizeof(physdisk_probebuf_t));
|
||||
*off += buf->n_aces;
|
||||
/* The offset reported by lseek and friends doesn't have to be in
|
||||
bytes, and it's marginally easier to say that it's in records, so
|
||||
that's what we do. */
|
||||
buf->start_ind = *off;
|
||||
res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (void *) buf,
|
||||
sizeof(physdisk_probebuf_t));
|
||||
*off += buf->n_aces;
|
||||
|
||||
if (res)
|
||||
res = -EINVAL;
|
||||
else {
|
||||
for (x = 0; x < buf->n_aces; x++)
|
||||
buf->entries[x].device = physdev_to_xldev(buf->entries[x].device);
|
||||
res = sizeof(physdisk_probebuf_t);
|
||||
if (copy_to_user(buff, buf, sizeof(physdisk_probebuf_t))) {
|
||||
res = -EFAULT;
|
||||
if (res)
|
||||
res = -EINVAL;
|
||||
else {
|
||||
for (x = 0; x < buf->n_aces; x++)
|
||||
buf->entries[x].device =
|
||||
physdev_to_xldev(buf->entries[x].device);
|
||||
res = sizeof(physdisk_probebuf_t);
|
||||
if (copy_to_user(buff, buf, sizeof(physdisk_probebuf_t))) {
|
||||
res = -EFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
kfree(buf);
|
||||
return res;
|
||||
kfree(buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int proc_write_phd(struct file *file, const char *buffer,
|
||||
size_t count, loff_t *ignore)
|
||||
size_t count, loff_t * ignore)
|
||||
{
|
||||
char *local;
|
||||
int res;
|
||||
xp_disk_t *xpd;
|
||||
struct proc_dir_entry *pde;
|
||||
char *local;
|
||||
int res;
|
||||
xp_disk_t *xpd;
|
||||
struct proc_dir_entry *pde;
|
||||
|
||||
if (count != sizeof(xp_disk_t))
|
||||
return -EINVAL;
|
||||
if (count != sizeof(xp_disk_t))
|
||||
return -EINVAL;
|
||||
|
||||
local = kmalloc(count + 1, GFP_KERNEL);
|
||||
if (!local)
|
||||
return -ENOMEM;
|
||||
if (copy_from_user(local, buffer, count)) {
|
||||
res = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
local = kmalloc(count + 1, GFP_KERNEL);
|
||||
if (!local)
|
||||
return -ENOMEM;
|
||||
if (copy_from_user(local, buffer, count)) {
|
||||
res = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
xpd = (xp_disk_t *)local;
|
||||
xpd = (xp_disk_t *) local;
|
||||
|
||||
pde = file->f_dentry->d_inode->u.generic_ip;
|
||||
xpd->domain = (int)pde->data;
|
||||
xpd->device = xldev_to_physdev(xpd->device);
|
||||
pde = file->f_dentry->d_inode->u.generic_ip;
|
||||
xpd->domain = (int) pde->data;
|
||||
xpd->device = xldev_to_physdev(xpd->device);
|
||||
|
||||
res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_GRANT, local, count);
|
||||
if (res == 0)
|
||||
res = count;
|
||||
else
|
||||
res = -EINVAL;
|
||||
out:
|
||||
kfree(local);
|
||||
return res;
|
||||
res = xenolinux_control_msg(XEN_BLOCK_PHYSDEV_GRANT, local, count);
|
||||
if (res == 0)
|
||||
res = count;
|
||||
else
|
||||
res = -EINVAL;
|
||||
out:
|
||||
kfree(local);
|
||||
return res;
|
||||
}
|
||||
|
||||
struct file_operations dom0_phd_fops = {
|
||||
read : proc_read_phd,
|
||||
write : proc_write_phd
|
||||
read:proc_read_phd,
|
||||
write:proc_write_phd
|
||||
};
|
||||
@@ -20,59 +20,58 @@ int xeno_partition(struct gendisk *hd,
|
||||
unsigned long first_sec,
|
||||
int first_part_minor)
|
||||
{
|
||||
physdisk_probebuf_t *buf;
|
||||
int i;
|
||||
int minor;
|
||||
int count;
|
||||
physdisk_probebuf_t *buf;
|
||||
int i;
|
||||
int minor;
|
||||
int count;
|
||||
|
||||
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
buf->domain = start_info.dom_id;
|
||||
buf->start_ind = 0;
|
||||
buf->n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
|
||||
|
||||
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
buf->domain = start_info.dom_id;
|
||||
buf->start_ind = 0;
|
||||
buf->n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
|
||||
|
||||
xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (char *)buf,
|
||||
sizeof(*buf));
|
||||
if (buf->n_aces == 0) {
|
||||
kfree(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (buf->n_aces == PHYSDISK_MAX_ACES_PER_REQUEST) {
|
||||
kfree(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < buf->n_aces; i++) {
|
||||
if (buf->entries[i].partition == 0) {
|
||||
continue;
|
||||
xenolinux_control_msg(XEN_BLOCK_PHYSDEV_PROBE, (char *)buf,
|
||||
sizeof(*buf));
|
||||
if (buf->n_aces == 0) {
|
||||
kfree(buf);
|
||||
return 0;
|
||||
}
|
||||
/* Make sure the partition is actually supposed to be on this
|
||||
disk. This assumes that Xen and XenoLinux block device
|
||||
numbers match up. */
|
||||
if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev)) {
|
||||
continue;
|
||||
|
||||
if (buf->n_aces == PHYSDISK_MAX_ACES_PER_REQUEST) {
|
||||
kfree(buf);
|
||||
return 0;
|
||||
}
|
||||
/* This is a bit of a hack - the partition numbers are specified
|
||||
by the hypervisor, and if we want them to match up, this is
|
||||
what we need to do. */
|
||||
count ++;
|
||||
minor = buf->entries[i].partition + first_part_minor - 1;
|
||||
add_gd_partition(hd,
|
||||
minor,
|
||||
buf->entries[i].start_sect,
|
||||
buf->entries[i].n_sectors);
|
||||
}
|
||||
kfree(buf);
|
||||
|
||||
/* If we didn't find any suitable Xeno partitions, try the other
|
||||
types. */
|
||||
if (!count)
|
||||
return 0;
|
||||
count = 0;
|
||||
|
||||
printk("\n");
|
||||
return 1;
|
||||
for (i = 0; i < buf->n_aces; i++) {
|
||||
if (buf->entries[i].partition == 0) {
|
||||
continue;
|
||||
}
|
||||
/* Make sure the partition is actually supposed to be on this
|
||||
disk. */
|
||||
if (buf->entries[i].device != xldev_to_physdev(bdev->bd_dev)) {
|
||||
continue;
|
||||
}
|
||||
/* This is a bit of a hack - the partition numbers are
|
||||
specified by the hypervisor, and if we want them to match
|
||||
up, this is what we need to do. */
|
||||
count ++;
|
||||
minor = buf->entries[i].partition + first_part_minor - 1;
|
||||
add_gd_partition(hd,
|
||||
minor,
|
||||
buf->entries[i].start_sect,
|
||||
buf->entries[i].n_sectors);
|
||||
}
|
||||
kfree(buf);
|
||||
|
||||
/* If we didn't find any suitable Xeno partitions, try the other
|
||||
types. */
|
||||
if (!count)
|
||||
return 0;
|
||||
|
||||
printk("\n");
|
||||
return 1;
|
||||
}
|
||||