From owner-p4-projects@FreeBSD.ORG Wed May 9 21:26:41 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7311E16A538; Wed, 9 May 2007 21:26:41 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E4F716A530 for ; Wed, 9 May 2007 21:26:40 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id DC7B113C45E for ; Wed, 9 May 2007 21:26:40 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l49LQeWL077366 for ; Wed, 9 May 2007 21:26:40 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l49LQdb1077362 for perforce@freebsd.org; Wed, 9 May 2007 21:26:39 GMT (envelope-from lulf@FreeBSD.org) Date: Wed, 9 May 2007 21:26:39 GMT Message-Id: <200705092126.l49LQdb1077362@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lulf@FreeBSD.org using -f From: Ulf Lilleengen To: Perforce Change Reviews Cc: Subject: PERFORCE change 119599 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2007 21:26:41 -0000 http://perforce.freebsd.org/chv.cgi?CH=119599 Change 119599 by lulf@lulf_vimes on 2007/05/09 21:26:27 - And again integrate from the fixup branch. Affected files ... .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/NOTES#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/kern.pre.mk#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/eli/g_eli_ctl.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_dev.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_disk.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_disk.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_io.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_slice.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_subr.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part_apm.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part_gpt.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_state.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_var.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/acpica/madt.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/conf/GENERIC#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/conf/NOTES#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/conf/PAE#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/intr_machdep.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/io_apic.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/local_apic.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/mp_machdep.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/mptable.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/mptable_pci.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/msi.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/nexus.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/apicvar.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/intr_machdep.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/vmparam.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/isa/atpic.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/pci/pci_bus.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_condvar.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_descrip.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_intr.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_mutex.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_rwlock.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_sx.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_synch.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/sys_generic.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_debug.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_sockbuf.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_socket.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_syscalls.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_usrreq.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/vfs_syscalls.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/modules/Makefile#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/disk.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/filedesc.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/interrupt.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/param.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/rwlock.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/socketvar.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/sx.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_page.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_page.h#2 integrate Differences ... ==== //depot/projects/soc2007/lulf/gvinum_main/sys/conf/NOTES#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1422 2007/04/17 00:35:10 thompsa Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1424 2007/05/09 15:55:45 scottl Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # ==== //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1198 2007/04/25 15:30:17 mav Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1204 2007/05/09 07:07:24 scottl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -600,8 +600,34 @@ dev/ed/if_ed_pci.c optional ed pci dev/eisa/eisa_if.m standard dev/eisa/eisaconf.c optional eisa -dev/em/if_em.c optional em -dev/em/if_em_hw.c optional em +dev/em/if_em.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_80003es2lan.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82540.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82541.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82542.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82543.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82571.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_82575.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_api.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_ich8lan.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_mac.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_manage.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_nvm.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" +dev/em/e1000_phy.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/em" dev/en/if_en_pci.c optional en pci dev/en/midway.c optional en dev/ep/if_ep.c optional ep @@ -659,6 +685,7 @@ dev/hme/if_hme.c optional hme dev/hme/if_hme_pci.c optional hme pci dev/hme/if_hme_sbus.c optional hme sbus +dev/hptiop/hptiop.c optional hptiop cam dev/hwpmc/hwpmc_logging.c optional hwpmc dev/hwpmc/hwpmc_mod.c optional hwpmc dev/ichsmb/ichsmb.c optional ichsmb @@ -996,8 +1023,6 @@ dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci dev/trm/trm.c optional trm -dev/twa/tw_cl_fwimg.c optional twa \ - compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_init.c optional twa \ compile-with "${NORMAL_C} -I$S/dev/twa" dev/twa/tw_cl_intr.c optional twa \ @@ -1045,6 +1070,7 @@ dev/usb/if_kue.c optional kue dev/usb/if_ural.c optional ural dev/usb/if_rue.c optional rue +dev/usb/if_rum.c optional rum dev/usb/if_udav.c optional udav dev/usb/ohci.c optional ohci dev/usb/ohci_pci.c optional ohci pci ==== //depot/projects/soc2007/lulf/gvinum_main/sys/conf/kern.pre.mk#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.81 2006/10/26 15:16:43 bde Exp $ +# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.82 2007/05/04 00:00:10 jfv Exp $ # Part of a unified Makefile for building kernels. This part contains all # of the definitions that need to be before %BEFORE_DEPEND. @@ -76,6 +76,9 @@ # .. and the same for twa INCLUDES+= -I$S/dev/twa +# .. and the same for em +INCLUDES+= -I$S/dev/em + # ... and XFS INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs ==== //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.586 2007/04/14 20:16:03 kmacy Exp $ +# $FreeBSD: src/sys/conf/options,v 1.587 2007/05/06 17:04:34 piso Exp $ # # On the handling of kernel options # @@ -764,3 +764,6 @@ # snd_emu10kx sound driver options SND_EMU10KX_MULTICHANNEL opt_emu10kx.h + +# Interrupt filtering +INTR_FILTER opt_global.h ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/eli/g_eli_ctl.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli_ctl.c,v 1.12 2007/03/05 12:41:44 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli_ctl.c,v 1.13 2007/05/06 14:56:03 pjd Exp $"); #include #include @@ -684,6 +684,11 @@ G_ELI_DEBUG(0, "Cannot store metadata on %s " "(error=%d).", pp->name, error); } + /* + * Flush write cache so we don't overwrite data N times in cache + * and only once on disk. + */ + g_io_flush(cp); } bzero(&md, sizeof(md)); bzero(sector, sizeof(sector)); ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom.h#2 (text+ko) ==== @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/geom.h,v 1.98 2006/10/31 21:11:20 pjd Exp $ + * $FreeBSD: src/sys/geom/geom.h,v 1.100 2007/05/05 16:35:22 pjd Exp $ */ #ifndef _GEOM_GEOM_H_ @@ -230,6 +230,7 @@ int g_handleattr(struct bio *bp, const char *attribute, void *val, int len); int g_handleattr_int(struct bio *bp, const char *attribute, int val); int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val); +int g_handleattr_str(struct bio *bp, const char *attribute, char *str); struct g_consumer * g_new_consumer(struct g_geom *gp); struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...); struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...); @@ -274,6 +275,7 @@ struct bio *g_alloc_bio(void); void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); int g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length); +int g_delete_data(struct g_consumer *cp, off_t offset, off_t length); void g_print_bio(struct bio *bp); /* geom_kern.c / geom_kernsim.c */ ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_dev.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_dev.c,v 1.93 2007/03/26 21:47:03 kris Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_dev.c,v 1.94 2007/05/05 17:02:19 pjd Exp $"); #include #include @@ -245,6 +245,7 @@ struct g_geom *gp; struct g_consumer *cp; struct g_kerneldump kd; + off_t offset, length; int i, error; u_int u; @@ -294,6 +295,25 @@ if (!error) dev->si_flags |= SI_DUMPDEV; break; + case DIOCGFLUSH: + error = g_io_flush(cp); + break; + case DIOCGDELETE: + offset = ((off_t *)data)[0]; + length = ((off_t *)data)[1]; + if ((offset % cp->provider->sectorsize) != 0 || + (length % cp->provider->sectorsize) != 0 || + length <= 0 || length > MAXPHYS) { + printf("%s: offset=%jd length=%jd\n", __func__, offset, + length); + error = EINVAL; + break; + } + error = g_delete_data(cp, offset, length); + break; + case DIOCGIDENT: + error = g_io_getattr("GEOM::ident", cp, &i, data); + break; default: if (cp->provider->geom->ioctl != NULL) { ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_disk.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_disk.c,v 1.101 2007/02/21 07:45:02 n_hibma Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_disk.c,v 1.104 2007/05/05 18:09:17 pjd Exp $"); #include "opt_geom.h" @@ -301,6 +301,8 @@ break; else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) break; + else if (g_handleattr_str(bp, "GEOM::ident", dp->d_ident)) + break; else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) g_disk_kerneldump(bp, dp); else @@ -396,6 +398,45 @@ g_free(dp); } +/* + * We only allow [a-zA-Z0-9-_@#%.:] characters, the rest is converted to 'x'. + */ +static void +g_disk_ident_adjust(char *ident, size_t size) +{ + char newid[DISK_IDENT_SIZE], tmp[4]; + size_t len; + char *p; + + bzero(newid, sizeof(newid)); + len = 0; + for (p = ident; *p != '\0' && len < sizeof(newid) - 1; p++) { + switch (*p) { + default: + if ((*p < 'a' || *p > 'z') && + (*p < 'A' || *p > 'Z') && + (*p < '0' || *p > '9')) { + snprintf(tmp, sizeof(tmp), "x%02hhx", *p); + strlcat(newid, tmp, sizeof(newid)); + len += 3; + break; + } + /* FALLTHROUGH */ + case '-': + case '_': + case '@': + case '#': + case '%': + case '.': + case ':': + newid[len++] = *p; + break; + } + } + bzero(ident, size); + strlcpy(ident, newid, size); +} + struct disk * disk_alloc() { @@ -408,7 +449,7 @@ void disk_create(struct disk *dp, int version) { - if (version != DISK_VERSION_00) { + if (version != DISK_VERSION_00 && version != DISK_VERSION_01) { printf("WARNING: Attempt to add disk %s%d %s", dp->d_name, dp->d_unit, " using incompatible ABI version of disk(9)\n"); @@ -425,6 +466,7 @@ dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; + g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident)); g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL); } ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_disk.h#2 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/geom_disk.h,v 1.6 2006/10/31 21:12:43 pjd Exp $ + * $FreeBSD: src/sys/geom/geom_disk.h,v 1.7 2007/05/05 17:12:15 pjd Exp $ */ #ifndef _GEOM_GEOM_DISK_H_ @@ -42,6 +42,7 @@ #include #include #include +#include struct disk; @@ -83,6 +84,7 @@ u_int d_maxsize; u_int d_stripeoffset; u_int d_stripesize; + char d_ident[DISK_IDENT_SIZE]; /* Fields private to the driver */ void *d_drv1; @@ -99,7 +101,8 @@ void disk_gone(struct disk *disk); #define DISK_VERSION_00 0x58561059 -#define DISK_VERSION DISK_VERSION_00 +#define DISK_VERSION_01 0x5856105a +#define DISK_VERSION DISK_VERSION_01 #endif /* _KERNEL */ #endif /* _GEOM_GEOM_DISK_H_ */ ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_io.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.74 2007/02/27 17:23:29 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_io.c,v 1.75 2007/05/05 16:35:22 pjd Exp $"); #include #include @@ -646,6 +646,28 @@ return (error); } +int +g_delete_data(struct g_consumer *cp, off_t offset, off_t length) +{ + struct bio *bp; + int error; + + KASSERT(length > 0 && length >= cp->provider->sectorsize && + length <= MAXPHYS, ("g_delete_data(): invalid length %jd", + (intmax_t)length)); + + bp = g_alloc_bio(); + bp->bio_cmd = BIO_DELETE; + bp->bio_done = NULL; + bp->bio_offset = offset; + bp->bio_length = length; + bp->bio_data = NULL; + g_io_request(bp, cp); + error = biowait(bp, "gdelete"); + g_destroy_bio(bp); + return (error); +} + void g_print_bio(struct bio *bp) { ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_slice.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_slice.c,v 1.61 2006/10/31 21:23:50 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_slice.c,v 1.62 2007/05/05 17:52:22 pjd Exp $"); #include #include @@ -172,6 +172,28 @@ } static void +g_slice_done(struct bio *bp) +{ + + KASSERT(bp->bio_cmd == BIO_GETATTR && + strcmp(bp->bio_attribute, "GEOM::ident") == 0, + ("bio_cmd=0x%x bio_attribute=%s", bp->bio_cmd, bp->bio_attribute)); + + if (bp->bio_error == 0 && bp->bio_data[0] != '\0') { + char idx[8]; + + /* Add index to the ident received. */ + snprintf(idx, sizeof(idx), "s%d", + bp->bio_parent->bio_to->index); + if (strlcat(bp->bio_data, idx, bp->bio_length) >= + bp->bio_length) { + bp->bio_error = EFAULT; + } + } + g_std_done(bp); +} + +static void g_slice_start(struct bio *bp) { struct bio *bp2; @@ -251,6 +273,16 @@ /* Give the real method a chance to override */ if (gsp->start != NULL && gsp->start(bp)) return; + if (!strcmp("GEOM::ident", bp->bio_attribute)) { + bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + bp2->bio_done = g_slice_done; + g_io_request(bp2, cp); + return; + } if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) { struct g_kerneldump *gkd; ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/geom_subr.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_subr.c,v 1.90 2006/09/15 16:36:45 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_subr.c,v 1.91 2007/05/05 16:33:44 pjd Exp $"); #include "opt_ddb.h" @@ -790,20 +790,35 @@ } int +g_handleattr_str(struct bio *bp, const char *attribute, char *str) +{ + + return (g_handleattr(bp, attribute, str, 0)); +} + +int g_handleattr(struct bio *bp, const char *attribute, void *val, int len) { - int error; + int error = 0; if (strcmp(bp->bio_attribute, attribute)) return (0); - if (bp->bio_length != len) { - printf("bio_length %jd len %d -> EFAULT\n", - (intmax_t)bp->bio_length, len); - error = EFAULT; - } else { - error = 0; + if (len == 0) { + bzero(bp->bio_data, bp->bio_length); + if (strlcpy(bp->bio_data, val, bp->bio_length) >= + bp->bio_length) { + printf("%s: %s bio_length %jd len %zu -> EFAULT\n", + __func__, bp->bio_to->name, + (intmax_t)bp->bio_length, strlen(val)); + error = EFAULT; + } + } else if (bp->bio_length == len) { bcopy(val, bp->bio_data, len); bp->bio_completed = len; + } else { + printf("%s: %s bio_length %jd len %d -> EFAULT\n", __func__, + bp->bio_to->name, (intmax_t)bp->bio_length, len); + error = EFAULT; } g_io_deliver(bp, error); return (1); ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/part/g_part.c,v 1.2 2007/04/27 05:58:10 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/part/g_part.c,v 1.5 2007/05/09 05:37:53 marcel Exp $"); #include #include @@ -64,12 +64,12 @@ const char *lexeme; enum g_part_alias alias; } g_part_alias_list[G_PART_ALIAS_COUNT] = { - { "@efi", G_PART_ALIAS_EFI }, - { "@freebsd", G_PART_ALIAS_FREEBSD }, - { "@freebsd-swap", G_PART_ALIAS_FREEBSD_SWAP }, - { "@freebsd-ufs", G_PART_ALIAS_FREEBSD_UFS }, - { "@freebsd-vinum", G_PART_ALIAS_FREEBSD_VINUM }, - { "@mbr", G_PART_ALIAS_MBR } + { "efi", G_PART_ALIAS_EFI }, + { "freebsd", G_PART_ALIAS_FREEBSD }, + { "freebsd-swap", G_PART_ALIAS_FREEBSD_SWAP }, + { "freebsd-ufs", G_PART_ALIAS_FREEBSD_UFS }, + { "freebsd-vinum", G_PART_ALIAS_FREEBSD_VINUM }, + { "mbr", G_PART_ALIAS_MBR } }; /* @@ -111,7 +111,6 @@ G_PART_CTL_DESTROY, G_PART_CTL_MODIFY, G_PART_CTL_MOVE, - G_PART_CTL_QUERY, G_PART_CTL_RECOVER, G_PART_CTL_RESIZE, G_PART_CTL_UNDO @@ -247,7 +246,7 @@ SET_FOREACH(iter, g_part_scheme_set) { if ((*iter)->name == NULL) continue; - if (!strcmp((*iter)->name, p)) { + if (!strcasecmp((*iter)->name, p)) { s = *iter; break; } @@ -331,11 +330,12 @@ static int g_part_ctl_add(struct gctl_req *req, struct g_part_parms *gpp) { - char buf[16]; + char buf[32]; struct g_geom *gp; struct g_provider *pp; struct g_part_entry *delent, *last, *entry; struct g_part_table *table; + struct sbuf *sb; quad_t end; unsigned int index; int error; @@ -396,8 +396,6 @@ gctl_error(req, "%d index '%d'", EEXIST, gpp->gpp_index); return (EEXIST); } - snprintf(buf, sizeof(buf), "%d", index); - gctl_set_param(req, "index", buf, strlen(buf) + 1); entry = (delent == NULL) ? g_malloc(table->gpt_scheme->gps_entrysz, M_WAITOK | M_ZERO) : delent; @@ -422,6 +420,15 @@ entry->gpe_modified = 1; } g_part_new_provider(gp, table, entry); + + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(sb, "%s%s added\n", gp->name, + G_PART_NAME(table, entry, buf, sizeof(buf))); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } return (0); } @@ -510,6 +517,7 @@ struct g_provider *pp; struct g_part_scheme *scheme; struct g_part_table *null, *table; + struct sbuf *sb; int attr, error; pp = gpp->gpp_provider; @@ -583,6 +591,14 @@ table->gpt_created = 1; if (null != NULL) kobj_delete((kobj_t)null, M_GEOM); + + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(sb, "%s created\n", gp->name); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } return (0); fail: @@ -601,10 +617,12 @@ static int g_part_ctl_delete(struct gctl_req *req, struct g_part_parms *gpp) { + char buf[32]; struct g_geom *gp; struct g_provider *pp; struct g_part_entry *entry; struct g_part_table *table; + struct sbuf *sb; gp = gpp->gpp_geom; G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); @@ -639,6 +657,15 @@ entry->gpe_deleted = 1; } g_wither_provider(pp, ENXIO); + + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(sb, "%s%s deleted\n", gp->name, + G_PART_NAME(table, entry, buf, sizeof(buf))); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } return (0); } @@ -648,6 +675,7 @@ struct g_geom *gp; struct g_part_entry *entry; struct g_part_table *null, *table; + struct sbuf *sb; int error; gp = gpp->gpp_geom; @@ -685,15 +713,24 @@ } kobj_delete((kobj_t)table, M_GEOM); + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(sb, "%s destroyed\n", gp->name); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } return (0); } static int g_part_ctl_modify(struct gctl_req *req, struct g_part_parms *gpp) { + char buf[32]; struct g_geom *gp; struct g_part_entry *entry; struct g_part_table *table; + struct sbuf *sb; int error; gp = gpp->gpp_geom; @@ -721,6 +758,15 @@ if (!entry->gpe_created) entry->gpe_modified = 1; + + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(sb, "%s%s modified\n", gp->name, + G_PART_NAME(table, entry, buf, sizeof(buf))); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } return (0); } @@ -732,13 +778,6 @@ } static int -g_part_ctl_query(struct gctl_req *req, struct g_part_parms *gpp) -{ - gctl_error(req, "%d verb 'query'", ENOSYS); - return (ENOSYS); -} - -static int g_part_ctl_recover(struct gctl_req *req, struct g_part_parms *gpp) { gctl_error(req, "%d verb 'recover'", ENOSYS); @@ -799,8 +838,12 @@ goto fail; } error = g_part_probe(gp, cp, table->gpt_depth); - if (error) - goto fail; + if (error) { + g_topology_lock(); + g_access(cp, -1, -1, -1); + g_part_wither(gp, error); + return (0); + } table = gp->softc; } @@ -863,83 +906,67 @@ ctlreq = G_PART_CTL_NONE; modifies = 0; - mparms = oparms = 0; + mparms = 0; + oparms = G_PART_PARM_FLAGS | G_PART_PARM_OUTPUT | G_PART_PARM_VERSION; switch (*verb) { case 'a': if (!strcmp(verb, "add")) { ctlreq = G_PART_CTL_ADD; modifies = 1; - mparms = G_PART_PARM_GEOM | G_PART_PARM_SIZE | + mparms |= G_PART_PARM_GEOM | G_PART_PARM_SIZE | G_PART_PARM_START | G_PART_PARM_TYPE; - oparms = G_PART_PARM_FLAGS | G_PART_PARM_INDEX | - G_PART_PARM_LABEL; + oparms |= G_PART_PARM_INDEX | G_PART_PARM_LABEL; } break; case 'c': if (!strcmp(verb, "commit")) { ctlreq = G_PART_CTL_COMMIT; - mparms = G_PART_PARM_GEOM; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM; } else if (!strcmp(verb, "create")) { ctlreq = G_PART_CTL_CREATE; modifies = 1; - mparms = G_PART_PARM_PROVIDER | - G_PART_PARM_SCHEME; - oparms = G_PART_PARM_ENTRIES | G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_PROVIDER | G_PART_PARM_SCHEME; + oparms |= G_PART_PARM_ENTRIES; } break; case 'd': if (!strcmp(verb, "delete")) { ctlreq = G_PART_CTL_DELETE; modifies = 1; - mparms = G_PART_PARM_GEOM | G_PART_PARM_INDEX; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX; } else if (!strcmp(verb, "destroy")) { ctlreq = G_PART_CTL_DESTROY; modifies = 1; - mparms = G_PART_PARM_GEOM; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM; } break; case 'm': if (!strcmp(verb, "modify")) { ctlreq = G_PART_CTL_MODIFY; modifies = 1; - mparms = G_PART_PARM_GEOM | G_PART_PARM_INDEX; - oparms = G_PART_PARM_FLAGS | G_PART_PARM_LABEL | - G_PART_PARM_TYPE; + mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX; + oparms |= G_PART_PARM_LABEL | G_PART_PARM_TYPE; } else if (!strcmp(verb, "move")) { ctlreq = G_PART_CTL_MOVE; modifies = 1; - mparms = G_PART_PARM_GEOM | G_PART_PARM_INDEX; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX; } break; - case 'q': - if (!strcmp(verb, "query")) { - ctlreq = G_PART_CTL_QUERY; - mparms = G_PART_PARM_REQUEST | G_PART_PARM_RESPONSE; - oparms = G_PART_PARM_FLAGS | G_PART_PARM_GEOM; - } - break; case 'r': if (!strcmp(verb, "recover")) { ctlreq = G_PART_CTL_RECOVER; modifies = 1; - mparms = G_PART_PARM_GEOM; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM; } else if (!strcmp(verb, "resize")) { ctlreq = G_PART_CTL_RESIZE; modifies = 1; - mparms = G_PART_PARM_GEOM | G_PART_PARM_INDEX; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX; } break; case 'u': if (!strcmp(verb, "undo")) { ctlreq = G_PART_CTL_UNDO; - mparms = G_PART_PARM_GEOM; - oparms = G_PART_PARM_FLAGS; + mparms |= G_PART_PARM_GEOM; } break; } @@ -977,16 +1004,14 @@ if (!strcmp(ap->name, "label")) parm = G_PART_PARM_LABEL; break; + case 'o': + if (!strcmp(ap->name, "output")) + parm = G_PART_PARM_OUTPUT; + break; case 'p': if (!strcmp(ap->name, "provider")) parm = G_PART_PARM_PROVIDER; break; - case 'r': - if (!strcmp(ap->name, "request")) - parm = G_PART_PARM_REQUEST; - else if (!strcmp(ap->name, "response")) - parm = G_PART_PARM_RESPONSE; - break; case 's': if (!strcmp(ap->name, "scheme")) parm = G_PART_PARM_SCHEME; @@ -1002,6 +1027,8 @@ case 'v': if (!strcmp(ap->name, "verb")) continue; + else if (!strcmp(ap->name, "version")) + parm = G_PART_PARM_VERSION; break; } if ((parm & (mparms | oparms)) == 0) { @@ -1029,15 +1056,12 @@ case G_PART_PARM_LABEL: error = g_part_parm_str(p, &gpp.gpp_label); break; + case G_PART_PARM_OUTPUT: + error = 0; /* Write-only parameter */ + break; case G_PART_PARM_PROVIDER: error = g_part_parm_provider(p, &gpp.gpp_provider); break; - case G_PART_PARM_REQUEST: - error = g_part_parm_str(p, &gpp.gpp_request); - break; - case G_PART_PARM_RESPONSE: - error = 0; /* Write-only parameter. */ - break; case G_PART_PARM_SCHEME: error = g_part_parm_scheme(p, &gpp.gpp_scheme); break; @@ -1050,6 +1074,9 @@ case G_PART_PARM_TYPE: error = g_part_parm_str(p, &gpp.gpp_type); break; + case G_PART_PARM_VERSION: + error = g_part_parm_uint(p, &gpp.gpp_version); + break; default: error = EDOOFUS; break; @@ -1106,9 +1133,6 @@ case G_PART_CTL_MOVE: error = g_part_ctl_move(req, &gpp); break; - case G_PART_CTL_QUERY: - error = g_part_ctl_query(req, &gpp); - break; case G_PART_CTL_RECOVER: error = g_part_ctl_recover(req, &gpp); break; ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/part/g_part.h,v 1.1 2007/02/07 18:55:30 marcel Exp $ + * $FreeBSD: src/sys/geom/part/g_part.h,v 1.2 2007/05/08 20:18:17 marcel Exp $ */ #ifndef _GEOM_PART_H_ @@ -104,13 +104,13 @@ #define G_PART_PARM_GEOM 0x0004 #define G_PART_PARM_INDEX 0x0008 #define G_PART_PARM_LABEL 0x0010 -#define G_PART_PARM_PROVIDER 0x0020 -#define G_PART_PARM_REQUEST 0x0040 -#define G_PART_PARM_RESPONSE 0x0080 -#define G_PART_PARM_SCHEME 0x0100 -#define G_PART_PARM_SIZE 0x0200 -#define G_PART_PARM_START 0x0400 -#define G_PART_PARM_TYPE 0x0800 +#define G_PART_PARM_OUTPUT 0x0020 +#define G_PART_PARM_PROVIDER 0x0040 +#define G_PART_PARM_SCHEME 0x0080 +#define G_PART_PARM_SIZE 0x0100 +#define G_PART_PARM_START 0x0200 +#define G_PART_PARM_TYPE 0x0400 +#define G_PART_PARM_VERSION 0x0800 struct g_part_parms { unsigned int gpp_parms; @@ -120,11 +120,11 @@ unsigned int gpp_index; const char *gpp_label; struct g_provider *gpp_provider; - const char *gpp_request; struct g_part_scheme *gpp_scheme; quad_t gpp_size; quad_t gpp_start; const char *gpp_type; + unsigned int gpp_version; }; #endif /* !_GEOM_PART_H_ */ ==== //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part_apm.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/part/g_part_apm.c,v 1.1 2007/02/07 18:55:30 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/part/g_part_apm.c,v 1.2 2007/05/08 20:18:17 marcel Exp $"); #include #include @@ -99,8 +99,10 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<