PERFORCE change 89356 for review
Kip Macy
kmacy at FreeBSD.org
Sat Jan 7 23:05:54 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=89356
Change 89356 by kmacy at kmacy:freebsd7_xen3 on 2006/01/08 07:05:41
make source conform to KNF now to avoid formatting changes confusing future diffs
Affected files ...
.. //depot/projects/xen3/src/sys/dev/xen/blkfront/blkfront.c#4 edit
.. //depot/projects/xen3/src/sys/dev/xen/console/console.c#4 edit
.. //depot/projects/xen3/src/sys/dev/xen/console/xencons_ring.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/evtchn/evtchn_dev.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/netfront/netfront.c#5 edit
.. //depot/projects/xen3/src/sys/dev/xen/xenbus/xenbus_client.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/xenbus/xenbus_comms.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/xenbus/xenbus_dev.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/xenbus/xenbus_probe.c#2 edit
.. //depot/projects/xen3/src/sys/dev/xen/xenbus/xenbus_xs.c#2 edit
.. //depot/projects/xen3/src/sys/i386-xen/i386-xen/clock.c#8 edit
.. //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#3 edit
Differences ...
==== //depot/projects/xen3/src/sys/dev/xen/blkfront/blkfront.c#4 (text+ko) ====
@@ -229,8 +229,8 @@
/* Setup supplies the backend dir, virtual device.
- We place an event channel and shared frame entries.
- We watch backend to wait if it's ok. */
+We place an event channel and shared frame entries.
+We watch backend to wait if it's ok. */
static int blkfront_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
@@ -309,7 +309,7 @@
if (err)
goto out;
-again:
+ again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt)) {
xenbus_dev_fatal(dev, err, "starting transaction");
@@ -392,7 +392,7 @@
info->irq = err;
return 0;
-fail:
+ fail:
blkif_free(info, 0);
return err;
}
@@ -564,7 +564,7 @@
#if 0
sc = LIST_FIRST(&xbsl_head);
LIST_REMOVE(sc, entry);
- /* Re-enable calldowns. */
+ /* Re-enable calldowns. */
blk_start_queue(di->rq);
#endif
/* Kick things off immediately. */
@@ -665,7 +665,7 @@
return 1;
if (gnttab_alloc_grant_references(
- BLKIF_MAX_SEGMENTS_PER_REQUEST, &gref_head) < 0) {
+ BLKIF_MAX_SEGMENTS_PER_REQUEST, &gref_head) < 0) {
gnttab_request_free_callback(
&info->callback,
blkif_restart_queue_callback,
@@ -716,18 +716,18 @@
KASSERT( ref != -ENOSPC, ("grant_reference failed") );
gnttab_grant_foreign_access_ref(
- ref,
- info->xbdev->otherend_id,
- buffer_ma >> PAGE_SHIFT,
- ring_req->operation & 1 ); /* ??? */
+ ref,
+ info->xbdev->otherend_id,
+ buffer_ma >> PAGE_SHIFT,
+ ring_req->operation & 1 ); /* ??? */
info->shadow[id].frame[ring_req->nr_segments] =
buffer_ma >> PAGE_SHIFT;
ring_req->seg[ring_req->nr_segments] =
- (struct blkif_request_segment) {
- .gref = ref,
- .first_sect = fsect,
- .last_sect = lsect };
+ (struct blkif_request_segment) {
+ .gref = ref,
+ .first_sect = fsect,
+ .last_sect = lsect };
ring_req->nr_segments++;
KASSERT((buffer_ma & (XBD_SECTOR_SIZE-1)) == 0,
@@ -1003,7 +1003,7 @@
* Local variables:
* mode: C
* c-set-style: "BSD"
- * c-basic-offset: 4
+ * c-basic-offset: 8
* tab-width: 4
* indent-tabs-mode: t
* End:
==== //depot/projects/xen3/src/sys/dev/xen/console/console.c#4 (text+ko) ====
@@ -85,8 +85,8 @@
static struct tty *xccons;
struct xc_softc {
- int xc_unit;
- struct cdev *xc_dev;
+ int xc_unit;
+ struct cdev *xc_dev;
};
@@ -130,12 +130,12 @@
return 0;
do {
if ((c = xccncheckc(dev)) == -1) {
- /* polling without sleeping in Xen doesn't work well.
- * Sleeping gives other things like clock a chance to
- * run
- */
- tsleep(&cn_mtx, PWAIT | PCATCH, "console sleep",
- XC_POLLTIME);
+ /* polling without sleeping in Xen doesn't work well.
+ * Sleeping gives other things like clock a chance to
+ * run
+ */
+ tsleep(&cn_mtx, PWAIT | PCATCH, "console sleep",
+ XC_POLLTIME);
}
} while(c == -1);
return c;
@@ -179,15 +179,15 @@
db_active ||
#endif
panicstr; /* we're not gonna recover, so force
- * flush
- */
+ * flush
+ */
if ((wp-wc) < (WBUF_SIZE-1)) {
if ((wbuf[WBUF_MASK(wp++)] = c) == '\n') {
wbuf[WBUF_MASK(wp++)] = '\r';
#ifdef notyet
if (force_flush)
- xcons_force_flush();
+ xcons_force_flush();
#endif
}
} else if (force_flush) {
@@ -250,11 +250,11 @@
if (xen_start_info->flags & SIF_INITDOMAIN) {
PANIC_IF(bind_virq_to_irqhandler(
- VIRQ_CONSOLE,
- 0,
- "console",
- xencons_priv_interrupt,
- INTR_TYPE_TTY) < 0);
+ VIRQ_CONSOLE,
+ 0,
+ "console",
+ xencons_priv_interrupt,
+ INTR_TYPE_TTY) < 0);
}
@@ -265,7 +265,7 @@
printf("xencons: shutdown event registration failed!\n");
TRACE_EXIT;
- return (0);
+ return (0);
}
/*
@@ -315,8 +315,8 @@
work_done = 1;
}
- if (work_done && xen_console_up)
- ttwakeup(xccons);
+ if (work_done && xen_console_up)
+ ttwakeup(xccons);
}
void
@@ -344,20 +344,20 @@
int
xcopen(struct cdev *dev, int flag, int mode, struct thread *td)
{
- struct xc_softc *sc;
- int unit = XCUNIT(dev);
- struct tty *tp;
- int s, error;
+ struct xc_softc *sc;
+ int unit = XCUNIT(dev);
+ struct tty *tp;
+ int s, error;
- sc = (struct xc_softc *)device_get_softc(
- devclass_get_device(xc_devclass, unit));
- if (sc == NULL)
+ sc = (struct xc_softc *)device_get_softc(
+ devclass_get_device(xc_devclass, unit));
+ if (sc == NULL)
return (ENXIO);
TRACE_ENTER;
- tp = dev->si_tty;
- s = spltty();
- if (!ISTTYOPEN(tp)) {
+ tp = dev->si_tty;
+ s = spltty();
+ if (!ISTTYOPEN(tp)) {
tp->t_state |= TS_CARR_ON;
ttychars(tp);
tp->t_iflag = TTYDEF_IFLAG;
@@ -367,62 +367,62 @@
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
xcparam(tp, &tp->t_termios);
ttsetwater(tp);
- } else if (tp->t_state & TS_XCLUDE && suser(td)) {
+ } else if (tp->t_state & TS_XCLUDE && suser(td)) {
splx(s);
return (EBUSY);
- }
- splx(s);
+ }
+ splx(s);
- xen_console_up = 1;
+ xen_console_up = 1;
- error = (*linesw[tp->t_line]->l_open)(dev, tp);
+ error = (*linesw[tp->t_line]->l_open)(dev, tp);
TRACE_EXIT;
- return error;
+ return error;
}
int
xcclose(struct cdev *dev, int flag, int mode, struct thread *td)
{
- struct tty *tp = dev->si_tty;
+ struct tty *tp = dev->si_tty;
+
+ if (tp == NULL)
+ return (0);
+ xen_console_up = 0;
- if (tp == NULL)
+ spltty();
+ (*linesw[tp->t_line]->l_close)(tp, flag);
+ tty_close(tp);
+ spl0();
return (0);
- xen_console_up = 0;
-
- spltty();
- (*linesw[tp->t_line]->l_close)(tp, flag);
- tty_close(tp);
- spl0();
- return (0);
}
int
xcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
- struct tty *tp = dev->si_tty;
- int error;
+ struct tty *tp = dev->si_tty;
+ int error;
- error = (*linesw[tp->t_line]->l_ioctl)(tp, cmd, data, flag, td);
- if (error != ENOIOCTL)
- return (error);
+ error = (*linesw[tp->t_line]->l_ioctl)(tp, cmd, data, flag, td);
+ if (error != ENOIOCTL)
+ return (error);
- error = ttioctl(tp, cmd, data, flag);
+ error = ttioctl(tp, cmd, data, flag);
- if (error != ENOIOCTL)
- return (error);
+ if (error != ENOIOCTL)
+ return (error);
- return (ENOTTY);
+ return (ENOTTY);
}
static inline int
__xencons_put_char(int ch)
{
- char _ch = (char)ch;
- if ((wp - wc) == WBUF_SIZE)
- return 0;
- wbuf[WBUF_MASK(wp++)] = _ch;
- return 1;
+ char _ch = (char)ch;
+ if ((wp - wc) == WBUF_SIZE)
+ return 0;
+ wbuf[WBUF_MASK(wp++)] = _ch;
+ return 1;
}
==== //depot/projects/xen3/src/sys/dev/xen/console/xencons_ring.c#2 (text+ko) ====
@@ -29,7 +29,7 @@
static inline struct xencons_interface *
xencons_interface(void)
{
- return (struct xencons_interface *)console_page;
+ return (struct xencons_interface *)console_page;
}
int
==== //depot/projects/xen3/src/sys/dev/xen/evtchn/evtchn_dev.c#2 (text+ko) ====
@@ -33,7 +33,7 @@
typedef struct evtchn_sotfc {
- struct selinfo ev_rsel;
+ struct selinfo ev_rsel;
} evtchn_softc_t;
@@ -72,259 +72,259 @@
void
evtchn_device_upcall(int port)
{
- mtx_lock(&upcall_lock);
+ mtx_lock(&upcall_lock);
- mask_evtchn(port);
- clear_evtchn(port);
+ mask_evtchn(port);
+ clear_evtchn(port);
- if ( ring != NULL ) {
- if ( (ring_prod - ring_cons) < EVTCHN_RING_SIZE ) {
- ring[EVTCHN_RING_MASK(ring_prod)] = (uint16_t)port;
- if ( ring_cons == ring_prod++ ) {
- wakeup(evtchn_waddr);
- }
- }
- else {
- ring_overflow = 1;
- }
- }
+ if ( ring != NULL ) {
+ if ( (ring_prod - ring_cons) < EVTCHN_RING_SIZE ) {
+ ring[EVTCHN_RING_MASK(ring_prod)] = (uint16_t)port;
+ if ( ring_cons == ring_prod++ ) {
+ wakeup(evtchn_waddr);
+ }
+ }
+ else {
+ ring_overflow = 1;
+ }
+ }
- mtx_unlock(&upcall_lock);
+ mtx_unlock(&upcall_lock);
}
static void
__evtchn_reset_buffer_ring(void)
{
- /* Initialise the ring to empty. Clear errors. */
- ring_cons = ring_prod = ring_overflow = 0;
+ /* Initialise the ring to empty. Clear errors. */
+ ring_cons = ring_prod = ring_overflow = 0;
}
static int
evtchn_read(struct cdev *dev, struct uio *uio, int ioflag)
{
- int rc;
- unsigned int count, c, p, sst = 0, bytes1 = 0, bytes2 = 0;
- count = uio->uio_resid;
+ int rc;
+ unsigned int count, c, p, sst = 0, bytes1 = 0, bytes2 = 0;
+ count = uio->uio_resid;
- count &= ~1; /* even number of bytes */
+ count &= ~1; /* even number of bytes */
- if ( count == 0 )
- {
- rc = 0;
- goto out;
- }
+ if ( count == 0 )
+ {
+ rc = 0;
+ goto out;
+ }
- if ( count > PAGE_SIZE )
- count = PAGE_SIZE;
+ if ( count > PAGE_SIZE )
+ count = PAGE_SIZE;
- for ( ; ; ) {
- if ( (c = ring_cons) != (p = ring_prod) )
- break;
+ for ( ; ; ) {
+ if ( (c = ring_cons) != (p = ring_prod) )
+ break;
- if ( ring_overflow ) {
- rc = EFBIG;
- goto out;
- }
+ if ( ring_overflow ) {
+ rc = EFBIG;
+ goto out;
+ }
- if (sst != 0) {
- rc = EINTR;
- goto out;
- }
+ if (sst != 0) {
+ rc = EINTR;
+ goto out;
+ }
- /* PCATCH == check for signals before and after sleeping
- * PWAIT == priority of waiting on resource
- */
- sst = tsleep(evtchn_waddr, PWAIT|PCATCH, "evchwt", 10);
- }
+ /* PCATCH == check for signals before and after sleeping
+ * PWAIT == priority of waiting on resource
+ */
+ sst = tsleep(evtchn_waddr, PWAIT|PCATCH, "evchwt", 10);
+ }
- /* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */
- if ( ((c ^ p) & EVTCHN_RING_SIZE) != 0 ) {
- bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) * sizeof(uint16_t);
- bytes2 = EVTCHN_RING_MASK(p) * sizeof(uint16_t);
- }
- else {
- bytes1 = (p - c) * sizeof(uint16_t);
- bytes2 = 0;
- }
+ /* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */
+ if ( ((c ^ p) & EVTCHN_RING_SIZE) != 0 ) {
+ bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) * sizeof(uint16_t);
+ bytes2 = EVTCHN_RING_MASK(p) * sizeof(uint16_t);
+ }
+ else {
+ bytes1 = (p - c) * sizeof(uint16_t);
+ bytes2 = 0;
+ }
- /* Truncate chunks according to caller's maximum byte count. */
- if ( bytes1 > count ) {
- bytes1 = count;
- bytes2 = 0;
- }
- else if ( (bytes1 + bytes2) > count ) {
- bytes2 = count - bytes1;
- }
+ /* Truncate chunks according to caller's maximum byte count. */
+ if ( bytes1 > count ) {
+ bytes1 = count;
+ bytes2 = 0;
+ }
+ else if ( (bytes1 + bytes2) > count ) {
+ bytes2 = count - bytes1;
+ }
- if ( uiomove(&ring[EVTCHN_RING_MASK(c)], bytes1, uio) ||
- ((bytes2 != 0) && uiomove(&ring[0], bytes2, uio)))
- /* keeping this around as its replacement is not equivalent
- * copyout(&ring[0], &buf[bytes1], bytes2)
- */
- {
- rc = EFAULT;
- goto out;
- }
+ if ( uiomove(&ring[EVTCHN_RING_MASK(c)], bytes1, uio) ||
+ ((bytes2 != 0) && uiomove(&ring[0], bytes2, uio)))
+ /* keeping this around as its replacement is not equivalent
+ * copyout(&ring[0], &buf[bytes1], bytes2)
+ */
+ {
+ rc = EFAULT;
+ goto out;
+ }
- ring_cons += (bytes1 + bytes2) / sizeof(uint16_t);
+ ring_cons += (bytes1 + bytes2) / sizeof(uint16_t);
- rc = bytes1 + bytes2;
+ rc = bytes1 + bytes2;
out:
- return rc;
+ return rc;
}
static int
evtchn_write(struct cdev *dev, struct uio *uio, int ioflag)
{
- int rc, i, count;
+ int rc, i, count;
- count = uio->uio_resid;
+ count = uio->uio_resid;
- uint16_t *kbuf = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK);
+ uint16_t *kbuf = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK);
- if ( kbuf == NULL )
- return ENOMEM;
+ if ( kbuf == NULL )
+ return ENOMEM;
- count &= ~1; /* even number of bytes */
+ count &= ~1; /* even number of bytes */
- if ( count == 0 ) {
- rc = 0;
- goto out;
- }
+ if ( count == 0 ) {
+ rc = 0;
+ goto out;
+ }
- if ( count > PAGE_SIZE )
- count = PAGE_SIZE;
+ if ( count > PAGE_SIZE )
+ count = PAGE_SIZE;
- if ( uiomove(kbuf, count, uio) != 0 ) {
- rc = EFAULT;
- goto out;
- }
+ if ( uiomove(kbuf, count, uio) != 0 ) {
+ rc = EFAULT;
+ goto out;
+ }
- mtx_lock_spin(&lock);
- for ( i = 0; i < (count/2); i++ )
- if ( test_bit(kbuf[i], &bound_ports[0]) )
- unmask_evtchn(kbuf[i]);
- mtx_unlock_spin(&lock);
+ mtx_lock_spin(&lock);
+ for ( i = 0; i < (count/2); i++ )
+ if ( test_bit(kbuf[i], &bound_ports[0]) )
+ unmask_evtchn(kbuf[i]);
+ mtx_unlock_spin(&lock);
- rc = count;
+ rc = count;
out:
- free(kbuf, M_DEVBUF);
- return rc;
+ free(kbuf, M_DEVBUF);
+ return rc;
}
static int
evtchn_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg,
- int mode, struct thread *td __unused)
+ int mode, struct thread *td __unused)
{
- int rc = 0;
+ int rc = 0;
- mtx_lock_spin(&lock);
+ mtx_lock_spin(&lock);
- switch ( cmd )
- {
- case EVTCHN_RESET:
- __evtchn_reset_buffer_ring();
- break;
- case EVTCHN_BIND:
- if ( !synch_test_and_set_bit((int)arg, &bound_ports[0]) )
- unmask_evtchn((int)arg);
- else
- rc = EINVAL;
- break;
- case EVTCHN_UNBIND:
- if ( synch_test_and_clear_bit((int)arg, &bound_ports[0]) )
- mask_evtchn((int)arg);
- else
- rc = EINVAL;
- break;
- default:
- rc = ENOSYS;
- break;
- }
+ switch ( cmd )
+ {
+ case EVTCHN_RESET:
+ __evtchn_reset_buffer_ring();
+ break;
+ case EVTCHN_BIND:
+ if ( !synch_test_and_set_bit((int)arg, &bound_ports[0]) )
+ unmask_evtchn((int)arg);
+ else
+ rc = EINVAL;
+ break;
+ case EVTCHN_UNBIND:
+ if ( synch_test_and_clear_bit((int)arg, &bound_ports[0]) )
+ mask_evtchn((int)arg);
+ else
+ rc = EINVAL;
+ break;
+ default:
+ rc = ENOSYS;
+ break;
+ }
- mtx_unlock_spin(&lock);
+ mtx_unlock_spin(&lock);
- return rc;
+ return rc;
}
static int
evtchn_poll(struct cdev *dev, int poll_events, struct thread *td)
{
- evtchn_softc_t *sc;
- unsigned int mask = POLLOUT | POLLWRNORM;
+ evtchn_softc_t *sc;
+ unsigned int mask = POLLOUT | POLLWRNORM;
- sc = dev->si_drv1;
+ sc = dev->si_drv1;
- if ( ring_cons != ring_prod )
- mask |= POLLIN | POLLRDNORM;
- else if ( ring_overflow )
- mask = POLLERR;
- else
- selrecord(td, &sc->ev_rsel);
+ if ( ring_cons != ring_prod )
+ mask |= POLLIN | POLLRDNORM;
+ else if ( ring_overflow )
+ mask = POLLERR;
+ else
+ selrecord(td, &sc->ev_rsel);
- return mask;
+ return mask;
}
static int
evtchn_open(struct cdev *dev, int flag, int otyp, struct thread *td)
{
- uint16_t *_ring;
+ uint16_t *_ring;
- if (flag & O_NONBLOCK)
- return EBUSY;
+ if (flag & O_NONBLOCK)
+ return EBUSY;
- if ( synch_test_and_set_bit(0, &evtchn_dev_inuse) )
- return EBUSY;
+ if ( synch_test_and_set_bit(0, &evtchn_dev_inuse) )
+ return EBUSY;
- if ( (_ring = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK)) == NULL )
- return ENOMEM;
+ if ( (_ring = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK)) == NULL )
+ return ENOMEM;
- mtx_lock_spin(&lock);
- ring = _ring;
- __evtchn_reset_buffer_ring();
- mtx_unlock_spin(&lock);
+ mtx_lock_spin(&lock);
+ ring = _ring;
+ __evtchn_reset_buffer_ring();
+ mtx_unlock_spin(&lock);
- return 0;
+ return 0;
}
static int
evtchn_close(struct cdev *dev, int flag, int otyp, struct thread *td __unused)
{
- int i;
+ int i;
- mtx_lock_spin(&lock);
- if (ring != NULL) {
- free(ring, M_DEVBUF);
- ring = NULL;
- }
- for ( i = 0; i < NR_EVENT_CHANNELS; i++ )
- if ( synch_test_and_clear_bit(i, &bound_ports[0]) )
- mask_evtchn(i);
- mtx_unlock_spin(&lock);
+ mtx_lock_spin(&lock);
+ if (ring != NULL) {
+ free(ring, M_DEVBUF);
+ ring = NULL;
+ }
+ for ( i = 0; i < NR_EVENT_CHANNELS; i++ )
+ if ( synch_test_and_clear_bit(i, &bound_ports[0]) )
+ mask_evtchn(i);
+ mtx_unlock_spin(&lock);
- evtchn_dev_inuse = 0;
+ evtchn_dev_inuse = 0;
- return 0;
+ return 0;
}
static struct cdevsw evtchn_devsw = {
- d_version: D_VERSION,
- d_open: evtchn_open,
- d_close: evtchn_close,
- d_read: evtchn_read,
- d_write: evtchn_write,
- d_ioctl: evtchn_ioctl,
- d_poll: evtchn_poll,
- d_name: "evtchn",
- d_flags: 0,
+ d_version: D_VERSION,
+ d_open: evtchn_open,
+ d_close: evtchn_close,
+ d_read: evtchn_read,
+ d_write: evtchn_write,
+ d_ioctl: evtchn_ioctl,
+ d_poll: evtchn_poll,
+ d_name: "evtchn",
+ d_flags: 0,
};
@@ -338,69 +338,53 @@
static int
evtchn_init(void *dummy __unused)
{
- /* XXX I believe we don't need these leaving them here for now until we
- * have some semblance of it working
- */
-#if 0
- devfs_handle_t symlink_handle;
- int err, pos;
- char link_dest[64];
-#endif
- mtx_init(&upcall_lock, "evtchup", NULL, MTX_DEF);
+ /* XXX I believe we don't need these leaving them here for now until we
+ * have some semblance of it working
+ */
+ mtx_init(&upcall_lock, "evtchup", NULL, MTX_DEF);
- /* (DEVFS) create '/dev/misc/evtchn'. */
- evtchn_dev = make_dev(&evtchn_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "xen/evtchn");
+ /* (DEVFS) create '/dev/misc/evtchn'. */
+ evtchn_dev = make_dev(&evtchn_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "xen/evtchn");
- mtx_init(&lock, "evch", NULL, MTX_SPIN | MTX_NOWITNESS);
+ mtx_init(&lock, "evch", NULL, MTX_SPIN | MTX_NOWITNESS);
- evtchn_dev->si_drv1 = malloc(sizeof(evtchn_softc_t), M_DEVBUF, M_WAITOK);
- bzero(evtchn_dev->si_drv1, sizeof(evtchn_softc_t));
+ evtchn_dev->si_drv1 = malloc(sizeof(evtchn_softc_t), M_DEVBUF, M_WAITOK);
+ bzero(evtchn_dev->si_drv1, sizeof(evtchn_softc_t));
- /* XXX I don't think we need any of this rubbish */
+ /* XXX I don't think we need any of this rubbish */
#if 0
- if ( err != 0 )
- {
- printk(KERN_ALERT "Could not register /dev/misc/evtchn\n");
- return err;
- }
+ if ( err != 0 )
+ {
+ printk(KERN_ALERT "Could not register /dev/misc/evtchn\n");
+ return err;
+ }
- /* (DEVFS) create directory '/dev/xen'. */
- xen_dev_dir = devfs_mk_dir(NULL, "xen", NULL);
+ /* (DEVFS) create directory '/dev/xen'. */
+ xen_dev_dir = devfs_mk_dir(NULL, "xen", NULL);
- /* (DEVFS) &link_dest[pos] == '../misc/evtchn'. */
- pos = devfs_generate_path(evtchn_miscdev.devfs_handle,
- &link_dest[3],
- sizeof(link_dest) - 3);
- if ( pos >= 0 )
- strncpy(&link_dest[pos], "../", 3);
- /* (DEVFS) symlink '/dev/xen/evtchn' -> '../misc/evtchn'. */
- (void)devfs_mk_symlink(xen_dev_dir,
- "evtchn",
- DEVFS_FL_DEFAULT,
- &link_dest[pos],
- &symlink_handle,
- NULL);
+ /* (DEVFS) &link_dest[pos] == '../misc/evtchn'. */
+ pos = devfs_generate_path(evtchn_miscdev.devfs_handle,
+ &link_dest[3],
+ sizeof(link_dest) - 3);
+ if ( pos >= 0 )
+ strncpy(&link_dest[pos], "../", 3);
+ /* (DEVFS) symlink '/dev/xen/evtchn' -> '../misc/evtchn'. */
+ (void)devfs_mk_symlink(xen_dev_dir,
+ "evtchn",
+ DEVFS_FL_DEFAULT,
+ &link_dest[pos],
+ &symlink_handle,
+ NULL);
- /* (DEVFS) automatically destroy the symlink with its destination. */
- devfs_auto_unregister(evtchn_miscdev.devfs_handle, symlink_handle);
+ /* (DEVFS) automatically destroy the symlink with its destination. */
+ devfs_auto_unregister(evtchn_miscdev.devfs_handle, symlink_handle);
#endif
- printk("Event-channel device installed.\n");
+ printk("Event-channel device installed.\n");
- return 0;
+ return 0;
}
SYSINIT(evtchn_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, evtchn_init, NULL);
-#if 0
-
-static void cleanup_module(void)
-{
- destroy_dev(evtchn_dev);
-;
-}
-
-module_init(init_module);
-module_exit(cleanup_module);
-#endif
==== //depot/projects/xen3/src/sys/dev/xen/netfront/netfront.c#5 (text+ko) ====
@@ -248,9 +248,9 @@
((_list)[0] == (_maxid+1))
#if DEBUG
static char *be_state_name[] = {
- [BEST_CLOSED] = "closed",
- [BEST_DISCONNECTED] = "disconnected",
- [BEST_CONNECTED] = "connected",
+ [BEST_CLOSED] = "closed",
+ [BEST_DISCONNECTED] = "disconnected",
+ [BEST_CONNECTED] = "connected",
};
#endif
#define IPRINTK(fmt, args...) \
@@ -637,7 +637,7 @@
/* Remove this page from pseudo phys map before passing back to Xen. */
xen_phys_machine[((unsigned long)m_new->m_ext.ext_args >> PAGE_SHIFT)]
- = INVALID_P2M_ENTRY;
+ = INVALID_P2M_ENTRY;
rx_mcl[i].op = __HYPERVISOR_update_va_mapping;
rx_mcl[i].args[0] = (unsigned long)mtod(m_new,vm_offset_t);
@@ -937,10 +937,10 @@
static void
xn_tick_locked(struct netfront_info *sc)
{
- XN_RX_LOCK_ASSERT(sc);
- callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc);
+ XN_RX_LOCK_ASSERT(sc);
+ callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc);
- /* XXX placeholder for printing debug information */
+ /* XXX placeholder for printing debug information */
}
@@ -948,12 +948,12 @@
static void
xn_tick(void *xsc)
{
- struct netfront_info *sc;
+ struct netfront_info *sc;
- sc = xsc;
- XN_RX_LOCK(sc);
- xn_tick_locked(sc);
- XN_RX_UNLOCK(sc);
+ sc = xsc;
+ XN_RX_LOCK(sc);
+ xn_tick_locked(sc);
+ XN_RX_UNLOCK(sc);
}
static void
@@ -1082,11 +1082,11 @@
static void
xn_ifinit(void *xsc)
{
- struct netfront_info *sc = xsc;
+ struct netfront_info *sc = xsc;
- XN_LOCK(sc);
- xn_ifinit_locked(sc);
- XN_UNLOCK(sc);
+ XN_LOCK(sc);
+ xn_ifinit_locked(sc);
+ XN_UNLOCK(sc);
}
@@ -1094,105 +1094,105 @@
static int
xn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
- struct netfront_info *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int mask, error = 0;
- switch(cmd) {
- case SIOCSIFMTU:
- /* XXX can we alter the MTU on a VN ?*/
+ struct netfront_info *sc = ifp->if_softc;
+ struct ifreq *ifr = (struct ifreq *) data;
+ int mask, error = 0;
+ switch(cmd) {
+ case SIOCSIFMTU:
+ /* XXX can we alter the MTU on a VN ?*/
#ifdef notyet
- if (ifr->ifr_mtu > XN_JUMBO_MTU)
- error = EINVAL;
- else
+ if (ifr->ifr_mtu > XN_JUMBO_MTU)
+ error = EINVAL;
+ else
#endif
- {
- ifp->if_mtu = ifr->ifr_mtu;
- ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
- xn_ifinit(sc);
- }
- break;
- case SIOCSIFFLAGS:
- XN_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
- /*
- * If only the state of the PROMISC flag changed,
- * then just use the 'set promisc mode' command
- * instead of reinitializing the entire NIC. Doing
- * a full re-init means reloading the firmware and
- * waiting for it to start up, which may take a
- * second or two.
- */
+ {
+ ifp->if_mtu = ifr->ifr_mtu;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+ xn_ifinit(sc);
+ }
+ break;
+ case SIOCSIFFLAGS:
+ XN_LOCK(sc);
+ if (ifp->if_flags & IFF_UP) {
+ /*
+ * If only the state of the PROMISC flag changed,
+ * then just use the 'set promisc mode' command
+ * instead of reinitializing the entire NIC. Doing
+ * a full re-init means reloading the firmware and
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list