bitkeeper revision 1.428.1.1 (3f68906b-34YjpC-AXCuEf_gcTXGxQ)

xeno_proc.h, xeno_proc.c, info.c:
  new file
Many files:
  Export extended blkdev info in /proc/xeno/blkdev_info. xenctl now looks here to turn partitions into blkdev extents.
.del-genhd.c~204b64b4cad491e2:
  Delete: xenolinux-2.4.22-sparse/drivers/block/genhd.c
This commit is contained in:
kaf24@scramble.cl.cam.ac.uk committed 2003-09-17 16:48:43 +00:00
1 parent 80737f5e4e
commit b2a2944622
16 files changed
+187 -298

No files matched your search

+3 -1
View File
@@ -524,6 +524,7 @@
3e6377f8Me8IqtvEhb70XFgOvqQH7A xenolinux-2.4.22-sparse/arch/xeno/drivers/balloon/balloon.c
3e6377fbMjXWAQd0XN0FWv4fDEo6fg xenolinux-2.4.22-sparse/arch/xeno/drivers/balloon/dom_mem_ops.h
3e5a4e65iHEuC5sjFhj42XALYbLVRw xenolinux-2.4.22-sparse/arch/xeno/drivers/block/Makefile
3f689056Vxx_8K8DQTRysOxx_ikmLg xenolinux-2.4.22-sparse/arch/xeno/drivers/block/info.c
3e5a4e65pP5spJErBW69pJxSSdK9RA xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.c
3e67f822FOPwqHiaRKbrskgWgoNL5g xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_block.h
3e677190SjkzJIvFifRVeYpIZOCtYA xenolinux-2.4.22-sparse/arch/xeno/drivers/block/xl_ide.c
@@ -552,13 +553,13 @@
3e5a4e66aHCbQ_F5QZ8VeyikLmuRZQ xenolinux-2.4.22-sparse/arch/xeno/kernel/traps.c
3e5a4e66-9_NczrVMbuQkoSLyXckIw xenolinux-2.4.22-sparse/arch/xeno/lib/Makefile
3e5a4e6637ZDk0BvFEC-aFQs599-ng xenolinux-2.4.22-sparse/arch/xeno/lib/delay.c
3f68905cF5i8-NYpIhGjKmh0y8Gu5g xenolinux-2.4.22-sparse/arch/xeno/lib/xeno_proc.c
3e5a4e66croVgpcJyJuF2ycQw0HuJw xenolinux-2.4.22-sparse/arch/xeno/mm/Makefile
3e5a4e66l8Q5Tv-6B3lQIRmaVbFPzg xenolinux-2.4.22-sparse/arch/xeno/mm/fault.c
3e5a4e668SE9rixq4ahho9rNhLUUFQ xenolinux-2.4.22-sparse/arch/xeno/mm/hypervisor.c
3e5a4e661gLzzff25pJooKIIWe7IWg xenolinux-2.4.22-sparse/arch/xeno/mm/init.c
3f0bed43UUdQichXAiVNrjV-y2Kzcg xenolinux-2.4.22-sparse/arch/xeno/mm/ioremap.c
3e5a4e66qRlSTcjafidMB6ulECADvg xenolinux-2.4.22-sparse/arch/xeno/vmlinux.lds
3ea53c6em6uzVHSiGqrbbAVofyRY_g xenolinux-2.4.22-sparse/drivers/block/genhd.c
3e5a4e66mrtlmV75L1tjKDg8RaM5gA xenolinux-2.4.22-sparse/drivers/block/ll_rw_blk.c
3f108aeaLcGDgQdFAANLTUEid0a05w xenolinux-2.4.22-sparse/drivers/char/mem.c
3e5a4e66rw65CxyolW9PKz4GG42RcA xenolinux-2.4.22-sparse/drivers/char/tty_io.c
@@ -589,6 +590,7 @@
3e5a4e68Nfdh6QcOKUTGCaYkf2LmYA xenolinux-2.4.22-sparse/include/asm-xeno/smp.h
3e5a4e68mTr0zcp9SXDbnd-XLrrfxw xenolinux-2.4.22-sparse/include/asm-xeno/system.h
3f1056a9L_kqHcFheV00KbKBzv9j5w xenolinux-2.4.22-sparse/include/asm-xeno/vga.h
3f689063nhrIRsMMZjZxMFk7iEINqQ xenolinux-2.4.22-sparse/include/asm-xeno/xeno_proc.h
3f056927gMHl7mWB89rb73JahbhQIA xenolinux-2.4.22-sparse/include/linux/blk.h
3e5a4e68WLX3B8owTvktP3HHOtznPQ xenolinux-2.4.22-sparse/include/linux/major.h
3e5a4e686V0nioX2ZpFf056sgvdiQw xenolinux-2.4.22-sparse/include/linux/sunrpc/debug.h
@@ -20,7 +20,7 @@ import java.util.Vector;
public class PartitionManager {
/** The proc header string, used to check that this is a suitable proc file. */
private static final String PROC_TEMPLATE =
"major minor #blocks start_sect nr_sects name";
"major minor start_sector num_sectors name";
/** The single PartitionManager reference. */
public static final PartitionManager IT =
@@ -59,12 +59,12 @@ public class PartitionManager {
while (str != null) {
Partition partition =
new Partition(
Integer.parseInt(str.substring(0, 5).trim()),
Integer.parseInt(str.substring(5, 10).trim()),
Integer.parseInt(str.substring(10, 21).trim()),
Integer.parseInt(str.substring(21, 32).trim()),
Integer.parseInt(str.substring(32, 43).trim()),
str.substring(43).trim(),
Integer.parseInt(str.substring( 0, 5).trim()),
Integer.parseInt(str.substring( 6, 11).trim()),
Integer.parseInt(str.substring(25, 37).trim())/2,
Integer.parseInt(str.substring(12, 24).trim()),
Integer.parseInt(str.substring(25, 37).trim()),
str.substring(38).trim(),
false);
partition_map.add(partition);
@@ -21,7 +21,7 @@ public final class Settings {
System.getProperty("XI_HELPER", "xi_helper");
/** File to parse to get partition info. */
public static final String PARTITIONS_FILE =
System.getProperty("PARTITIONS_FILE", "/proc/partitions");
System.getProperty("PARTITIONS_FILE", "/proc/xeno/blkdev_info");
/** File to load virtual disk state from. */
public static final String STATE_INPUT_FILE =
System.getProperty("STATE_INPUT_FILE", "/var/lib/xen/vdstate.xml");
@@ -11,7 +11,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <asm/xeno_proc.h>
#include <linux/mm.h>
#include <linux/mman.h>
@@ -38,9 +38,6 @@ typedef struct user_balloon_op {
/* Dead entry written into ballon-owned entries in the PMT. */
#define DEAD 0xdeadbeef
#define BALLOON_ENTRY "balloon"
extern struct proc_dir_entry *xeno_base;
static struct proc_dir_entry *balloon_pde;
unsigned long credit;
@@ -260,7 +257,7 @@ static int __init init_module(void)
credit = 0;
balloon_pde = create_proc_entry(BALLOON_ENTRY, 0600, xeno_base);
balloon_pde = create_xeno_proc_entry("balloon", 0600);
if ( balloon_pde == NULL )
{
printk(KERN_ALERT "Unable to create balloon driver proc entry!");
@@ -274,6 +271,11 @@ static int __init init_module(void)
static void __exit cleanup_module(void)
{
if ( balloon_pde != NULL )
{
remove_xeno_proc_entry("balloon");
balloon_pde = NULL;
}
}
module_init(init_module);
@@ -1,3 +1,3 @@
O_TARGET := blk.o
obj-y := xl_block.o xl_ide.o xl_scsi.o xl_segment.o xl_segment_proc.o
obj-y := xl_block.o xl_ide.o xl_scsi.o xl_segment.o xl_segment_proc.o info.o
include $(TOPDIR)/Rules.make
@@ -0,0 +1,111 @@
#include "xl_block.h"
#include <linux/blk.h>
#include <linux/cdrom.h>
#include <linux/genhd.h>
#include <linux/seq_file.h>
#include <asm/xeno_proc.h>
static struct proc_dir_entry *info_pde;
static void *info_start(struct seq_file *s, loff_t *ppos)
{
struct gendisk *gp;
loff_t pos = *ppos;
int major;
if ( pos == 0 )
seq_puts(s, "major minor start_sector num_sectors name\n\n");
for ( major = 0; major < MAX_BLKDEV; major++ )
{
if ( (gp = get_gendisk(MKDEV(major, 0))) != 0 )
if ( !pos-- )
return gp;
}
return NULL;
}
static void *info_next(struct seq_file *s, void *v, loff_t *ppos)
{
++*ppos;
return info_start(s, ppos);
}
static void info_stop(struct seq_file *s, void *v)
{
}
static int info_show(struct seq_file *s, void *v)
{
struct gendisk *gp = v;
char buf[64];
int n, disk;
for ( n = 0; n < (gp->nr_real << gp->minor_shift); n++ )
{
disk = n >> gp->minor_shift;
if ( gp->part[n].nr_sects != 0 )
{
seq_printf(s, "%5d %5d %12ld %12ld %s\n",
gp->major, n,
gp->part[n].start_sect,
gp->part[n].nr_sects,
disk_name(gp, n, buf));
}
else if ( ((disk << gp->minor_shift) == n) &&
((((xl_disk_t *)gp->real_devices)[disk].capacity) != 0) )
{
seq_printf(s, "%5d %5d %12d %12ld %s\n",
gp->major, n, 0,
((xl_disk_t *)gp->real_devices)[disk].capacity,
disk_name(gp, n, buf));
}
}
return 0;
}
static struct seq_operations info_op = {
.start = info_start,
.next = info_next,
.stop = info_stop,
.show = info_show,
};
static int info_open(struct inode *inode, struct file *file)
{
return seq_open(file, &info_op);
}
static struct file_operations proc_info_operations =
{
open: info_open,
read: seq_read,
llseek: seq_lseek,
release: seq_release,
};
int __init info_init(void)
{
info_pde = create_xeno_proc_entry("blkdev_info", 0444);
if ( info_pde == NULL )
panic ("Couldn't create /proc/xeno/blkdev_info");
info_pde->data = NULL;
info_pde->proc_fops = &proc_info_operations;
info_pde->owner = THIS_MODULE;
return 0;
}
static void __exit info_exit(void)
{
if ( info_pde == NULL ) return;
remove_xeno_proc_entry("blkdev_info");
info_pde = NULL;
}
module_init(info_init);
module_exit(info_exit);
@@ -5,7 +5,7 @@
*/
#include "xl_block.h"
#include <linux/proc_fs.h>
#include <asm/xeno_proc.h>
#include <linux/delay.h>
#include <linux/seq_file.h>
#include <asm/hypervisor-ifs/segment.h>
@@ -133,6 +133,9 @@ static int proc_write_vhd(struct file *file, const char *buffer,
xv_disk_t xvd;
int res;
if( !(start_info.flags & SIF_PRIVILEGED) )
return -EPERM;
if (!local)
return -ENOMEM;
@@ -310,7 +313,7 @@ int __init xlseg_proc_init(void)
if ( !(start_info.flags & SIF_PRIVILEGED) )
return 0;
vhd = create_proc_entry("xeno/vhd", 0600, NULL);
vhd = create_xeno_proc_entry("vhd", 0600);
if ( vhd == NULL )
panic ("xlseg_init: unable to create vhd proc entry\n");
@@ -318,13 +321,14 @@ int __init xlseg_proc_init(void)
vhd->proc_fops = &proc_vhd_operations;
vhd->owner = THIS_MODULE;
printk(KERN_ALERT "XenoLinux Virtual Disk Device Monitor installed\n");
return 0;
}
static void __exit xlseg_proc_cleanup(void)
{
printk(KERN_ALERT "XenoLinux Virtual Disk Device Monitor uninstalled\n");
if ( vhd == NULL ) return;
remove_xeno_proc_entry("vhd");
vhd = NULL;
}
#ifdef MODULE
@@ -13,7 +13,6 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/swap.h>
@@ -30,10 +29,10 @@
#include <asm/tlb.h>
#include <asm/proc_cmd.h>
#include <asm/hypervisor-ifs/dom0_ops.h>
#include <asm/xeno_proc.h>
#include "../block/xl_block.h"
struct proc_dir_entry *xeno_base;
static struct proc_dir_entry *privcmd_intf;
@@ -133,11 +132,8 @@ static int __init init_module(void)
if ( !(start_info.flags & SIF_PRIVILEGED) )
return 0;
/* xeno proc root setup */
xeno_base = proc_mkdir("xeno", &proc_root);
/* xeno control interface */
privcmd_intf = create_proc_entry("privcmd", 0400, xeno_base);
privcmd_intf = create_xeno_proc_entry("privcmd", 0400);
if ( privcmd_intf != NULL )
{
privcmd_intf->owner = THIS_MODULE;
@@ -152,7 +148,7 @@ static int __init init_module(void)
static void __exit cleanup_module(void)
{
if ( privcmd_intf == NULL ) return;
remove_proc_entry("xeno", &proc_root);
remove_xeno_proc_entry("privcmd");
privcmd_intf = NULL;
}
@@ -12,16 +12,13 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <asm/xeno_proc.h>
#include <asm/hypervisor-ifs/network.h>
static struct proc_dir_entry *proc_vfr;
static unsigned char readbuf[1024];
extern struct proc_dir_entry *xeno_base;
/* Helpers, implemented at the bottom. */
u32 getipaddr(const char *buff, unsigned int len);
u16 antous(const char *buff, int len);
@@ -225,8 +222,11 @@ static int vfr_write_proc(struct file *file, const char *buffer,
static int __init init_module(void)
{
if ( !(start_info.flags & SIF_PRIVILEGED) )
return 0;
*readbuf = '\0';
proc_vfr = create_proc_entry ("vfr", 0600, xeno_base);
proc_vfr = create_xeno_proc_entry("vfr", 0600);
if ( proc_vfr != NULL )
{
proc_vfr->owner = THIS_MODULE;
@@ -241,7 +241,7 @@ static int __init init_module(void)
static void __exit cleanup_module(void)
{
if ( proc_vfr == NULL ) return;
remove_proc_entry("vfr", xeno_base);
remove_xeno_proc_entry("vfr");
proc_vfr = NULL;
}
@@ -152,3 +152,8 @@ EXPORT_SYMBOL(atomic_dec_and_lock);
#ifdef CONFIG_MULTIQUAD
EXPORT_SYMBOL(xquad_portio);
#endif
#include <asm/xeno_proc.h>
EXPORT_SYMBOL(create_xeno_proc_entry);
EXPORT_SYMBOL(remove_xeno_proc_entry);
@@ -6,7 +6,7 @@ L_TARGET = lib.a
obj-y = checksum.o old-checksum.o delay.o \
usercopy.o getuser.o \
memcpy.o strstr.o
memcpy.o strstr.o xeno_proc.o
obj-$(CONFIG_X86_USE_3DNOW) += mmx.o
obj-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
@@ -0,0 +1,18 @@
#include <linux/config.h>
#include <linux/proc_fs.h>
static struct proc_dir_entry *xeno_base;
struct proc_dir_entry *create_xeno_proc_entry(const char *name, mode_t mode)
{
if ( xeno_base == NULL )
if ( (xeno_base = proc_mkdir("xeno", &proc_root)) == NULL )
panic("Couldn't create /proc/xeno");
return create_proc_entry(name, mode, xeno_base);
}
void remove_xeno_proc_entry(const char *name)
{
remove_proc_entry(name, xeno_base);
}
@@ -1,258 +0,0 @@
/*
* Code extracted from
* linux/kernel/hd.c
*
* Copyright (C) 1991-1998 Linus Torvalds
*
* devfs support - jj, rgooch, 980122
*
* Moved partition checking code to fs/partitions* - Russell King
* (linux@arm.uk.linux.org)
*/
/*
* TODO: rip out the remaining init crap from this file --hch
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/genhd.h>
#include <linux/kernel.h>
#include <linux/blk.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/seq_file.h>
/*
* Global kernel list of partitioning information.
*
* XXX: you should _never_ access this directly.
* the only reason this is exported is source compatiblity.
*/
/*static*/ struct gendisk *gendisk_head;
static struct gendisk *gendisk_array[MAX_BLKDEV];
static rwlock_t gendisk_lock = RW_LOCK_UNLOCKED;
EXPORT_SYMBOL(gendisk_head);
/**
* add_gendisk - add partitioning information to kernel list
* @gp: per-device partitioning information
*
* This function registers the partitioning information in @gp
* with the kernel.
*/
void
add_gendisk(struct gendisk *gp)
{
struct gendisk *sgp;
write_lock(&gendisk_lock);
/*
* In 2.5 this will go away. Fix the drivers who rely on
* old behaviour.
*/
for (sgp = gendisk_head; sgp; sgp = sgp->next)
{
if (sgp == gp)
{
// printk(KERN_ERR "add_gendisk: device major %d is buggy and added a live gendisk!\n",
// sgp->major)
goto out;
}
}
gendisk_array[gp->major] = gp;
gp->next = gendisk_head;
gendisk_head = gp;
out:
write_unlock(&gendisk_lock);
}
EXPORT_SYMBOL(add_gendisk);
/**
* del_gendisk - remove partitioning information from kernel list
* @gp: per-device partitioning information
*
* This function unregisters the partitioning information in @gp
* with the kernel.
*/
void
del_gendisk(struct gendisk *gp)
{
struct gendisk **gpp;
write_lock(&gendisk_lock);
gendisk_array[gp->major] = NULL;
for (gpp = &gendisk_head; *gpp; gpp = &((*gpp)->next))
if (*gpp == gp)
break;
if (*gpp)
*gpp = (*gpp)->next;
write_unlock(&gendisk_lock);
}
EXPORT_SYMBOL(del_gendisk);
/**
* get_gendisk - get partitioning information for a given device
* @dev: device to get partitioning information for
*
* This function gets the structure containing partitioning
* information for the given device @dev.
*/
struct gendisk *
get_gendisk(kdev_t dev)
{
struct gendisk *gp = NULL;
int maj = MAJOR(dev);
read_lock(&gendisk_lock);
if ((gp = gendisk_array[maj]))
goto out;
/* This is needed for early 2.4 source compatiblity. --hch */
for (gp = gendisk_head; gp; gp = gp->next)
if (gp->major == maj)
break;
out:
read_unlock(&gendisk_lock);
return gp;
}
EXPORT_SYMBOL(get_gendisk);
/**
* walk_gendisk - issue a command for every registered gendisk
* @walk: user-specified callback
* @data: opaque data for the callback
*
* This function walks through the gendisk chain and calls back
* into @walk for every element.
*/
int
walk_gendisk(int (*walk)(struct gendisk *, void *), void *data)
{
struct gendisk *gp;
int error = 0;
read_lock(&gendisk_lock);
for (gp = gendisk_head; gp; gp = gp->next)
if ((error = walk(gp, data)))
break;
read_unlock(&gendisk_lock);
return error;
}
#ifdef CONFIG_PROC_FS
/* iterator */
static void *part_start(struct seq_file *s, loff_t *ppos)
{
struct gendisk *gp;
loff_t pos = *ppos;
read_lock(&gendisk_lock);
for (gp = gendisk_head; gp; gp = gp->next)
if (!pos--)
return gp;
return NULL;
}
static void *part_next(struct seq_file *s, void *v, loff_t *pos)
{
++*pos;
return ((struct gendisk *)v)->next;
}
static void part_stop(struct seq_file *s, void *v)
{
read_unlock(&gendisk_lock);
}
static int part_show(struct seq_file *s, void *v)
{
struct gendisk *gp = v;
char buf[64];
int n;
if (gp == gendisk_head) {
seq_puts(s, "major minor #blocks start_sect nr_sects name"
#ifdef CONFIG_BLK_STATS
" rio rmerge rsect ruse wio wmerge "
"wsect wuse running use aveq"
#endif
"\n\n");
}
/* show the full disk and all non-0 size partitions of it */
for (n = 0; n < (gp->nr_real << gp->minor_shift); n++) {
if (gp->part[n].nr_sects) {
#ifdef CONFIG_BLK_STATS
struct hd_struct *hd = &gp->part[n];
disk_round_stats(hd);
seq_printf(s, "%4d %4d %10d %10ld %s "
"%d %d %d %d %d %d %d %d %d %d %d\n",
gp->major, n, gp->sizes[n],
gp->part[n].start_sect,
gp->part[n].nr_sects,
disk_name(gp, n, buf),
hd->rd_ios, hd->rd_merges,
#define MSEC(x) ((x) * 1000 / HZ)
hd->rd_sectors, MSEC(hd->rd_ticks),
hd->wr_ios, hd->wr_merges,
hd->wr_sectors, MSEC(hd->wr_ticks),
hd->ios_in_flight, MSEC(hd->io_ticks),
MSEC(hd->aveq));
#else
seq_printf(s, "%4d %4d %10d %10ld %10ld %s\n",
gp->major, n, gp->sizes[n],
gp->part[n].start_sect,
gp->part[n].nr_sects,
disk_name(gp, n, buf));
#endif /* CONFIG_BLK_STATS */
}
}
return 0;
}
struct seq_operations partitions_op = {
.start = part_start,
.next = part_next,
.stop = part_stop,
.show = part_show,
};
#endif
extern int blk_dev_init(void);
extern int net_dev_init(void);
extern void console_map_init(void);
extern int atmdev_init(void);
int __init device_init(void)
{
blk_dev_init();
sti();
#ifdef CONFIG_NET
net_dev_init();
#endif
#ifdef CONFIG_ATM
(void) atmdev_init();
#endif
#ifdef CONFIG_VT
console_map_init();
#endif
return 0;
}
__initcall(device_init);
@@ -859,8 +859,6 @@ static inline void add_request(request_queue_t * q, struct request * req,
if (!q->plugged && q->head_active && insert_here == &q->queue_head) {
spin_unlock_irq(&io_request_lock);
printk("list_empty(&q->queue_head) is %d\n",
list_empty(&q->queue_head));
BUG();
}
@@ -842,9 +842,8 @@ static int init_dev(kdev_t device, struct tty_struct **ret_tty)
int idx;
driver = get_tty_driver(device);
if (!driver) {
return -ENODEV;
}
if (!driver)
return -ENODEV;
idx = MINOR(device) - driver->minor_start;
@@ -2219,7 +2218,7 @@ int tty_unregister_driver(struct tty_driver *driver)
*/
void __init console_init(void)
{
/* Setup the default TTY line discipline. */
/* Setup the default TTY line discipline. */
memset(ldiscs, 0, sizeof(ldiscs));
(void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);
@@ -2250,7 +2249,6 @@ void __init console_init(void)
#ifdef CONFIG_VT
con_init();
#endif
#ifdef CONFIG_AU1X00_SERIAL_CONSOLE
au1x00_serial_console_init();
#endif
@@ -0,0 +1,13 @@
#ifndef __ASM_XENO_PROC_H__
#define __ASM_XENO_PROC_H__
#include <linux/config.h>
#include <linux/proc_fs.h>
extern struct proc_dir_entry *create_xeno_proc_entry(
const char *name, mode_t mode);
extern void remove_xeno_proc_entry(
const char *name);
#endif /* __ASM_XENO_PROC_H__ */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.