NetBSD Problem Report #39468

From www@NetBSD.org  Sat Sep  6 11:24:58 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D1C9863B853
	for <gnats-bugs@gnats.netbsd.org>; Sat,  6 Sep 2008 11:24:58 +0000 (UTC)
Message-Id: <20080906112458.9C14E63B11D@narn.NetBSD.org>
Date: Sat,  6 Sep 2008 11:24:58 +0000 (UTC)
From: xtraeme@gmail.com
Reply-To: xtraeme@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Incomplete device_t/softc split for the ld(4) attachments
X-Send-Pr-Version: www-1.0

>Number:         39468
>Category:       kern
>Synopsis:       Incomplete device_t/softc split for the ld(4) attachments
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 06 11:25:00 +0000 2008
>Closed-Date:    Tue Sep 09 12:48:19 +0000 2008
>Last-Modified:  Wed Sep 10 18:45:01 +0000 2008
>Originator:     Juan RP
>Release:        Latest
>Organization:
>Environment:
NetBSD vmware-netbsd 4.99.72 NetBSD 4.99.72 (MASTER) #2: Sat Sep  6 13:03:36 CEST 2008  juan@vmware-netbsd:/home/juan/build/obj/sys/arch/i386/compile/MASTER i386
>Description:
The ld(4) driver will crash at attach time with a NULL pointer dereference due to incomplete device_t/softc split for all its attachments (note that I'm responsible for ataraid(4) crash :-).

I created a patch that will change all ld(4) users to switch to CFATTACH_DECL_NEW. The patch has been tested with ataraid(4), I'd like to hear if there's any problem in the other attachments, as well as someone testing them to verify.

Will send a patch to this PR in a few minutes. This patch will supersede the one from kern/39394.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: Juan RP <xtraeme@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/39468: Incomplete device_t/softc split for the ld(4)
 attachments
Date: Sat, 6 Sep 2008 13:34:09 +0200

 Here's the patch.

 Index: dev/ld.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ld.c,v
 retrieving revision 1.62
 diff -b -u -p -r1.62 ld.c
 --- dev/ld.c	11 Aug 2008 06:43:37 -0000	1.62
 +++ dev/ld.c	6 Sep 2008 11:07:37 -0000
 @@ -102,12 +102,12 @@ ldattach(struct ld_softc *sc)
  	mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_VM);

  	if ((sc->sc_flags & LDF_ENABLED) == 0) {
 -		aprint_normal_dev(&sc->sc_dv, "disabled\n");
 +		aprint_normal_dev(sc->sc_dv, "disabled\n");
  		return;
  	}

  	/* Initialise and attach the disk structure. */
 -	disk_init(&sc->sc_dk, device_xname(&sc->sc_dv), &lddkdriver);
 +	disk_init(&sc->sc_dk, device_xname(sc->sc_dv), &lddkdriver);
  	disk_attach(&sc->sc_dk);

  	if (sc->sc_maxxfer > MAXPHYS)
 @@ -139,7 +139,8 @@ ldattach(struct ld_softc *sc)

  	format_bytes(tbuf, sizeof(tbuf), sc->sc_secperunit *
  	    sc->sc_secsize);
 -	aprint_normal_dev(&sc->sc_dv, "%s, %d cyl, %d head, %d sec, %d bytes/sect x %"PRIu64" sectors\n",
 +	aprint_normal_dev(sc->sc_dv, "%s, %d cyl, %d head, %d sec, "
 +	    "%d bytes/sect x %"PRIu64" sectors\n",
  	    tbuf, sc->sc_ncylinders, sc->sc_nheads,
  	    sc->sc_nsectors, sc->sc_secsize, sc->sc_secperunit);

 @@ -147,19 +148,19 @@ ldattach(struct ld_softc *sc)

  #if NRND > 0
  	/* Attach the device into the rnd source list. */
 -	rnd_attach_source(&sc->sc_rnd_source, device_xname(&sc->sc_dv),
 +	rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv),
  	    RND_TYPE_DISK, 0);
  #endif

  	/* Register with PMF */
 -	if (!pmf_device_register1(&sc->sc_dv, NULL, NULL, ld_shutdown))
 -		aprint_error_dev(&sc->sc_dv,
 +	if (!pmf_device_register1(sc->sc_dv, NULL, NULL, ld_shutdown))
 +		aprint_error_dev(sc->sc_dv,
  		    "couldn't establish power handler\n");

  	bufq_alloc(&sc->sc_bufq, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);

  	/* Discover wedges on this disk. */
 -	config_interrupts(&sc->sc_dv, ld_config_interrupts);
 +	config_interrupts(sc->sc_dv, ld_config_interrupts);
  }

  int
 @@ -210,7 +211,7 @@ ldenddetach(struct ld_softc *sc)
  	/* Wait for commands queued with the hardware to complete. */
  	if (sc->sc_queuecnt != 0)
  		if (tsleep(&sc->sc_queuecnt, PRIBIO, "lddtch", 30 * hz))
 -			printf("%s: not drained\n", device_xname(&sc->sc_dv));
 +			printf("%s: not drained\n", device_xname(sc->sc_dv));

  	/* Locate the major numbers. */
  	bmaj = bdevsw_lookup_major(&ld_bdevsw);
 @@ -225,7 +226,7 @@ ldenddetach(struct ld_softc *sc)

  	/* Nuke the vnodes for any open instances. */
  	for (i = 0; i < MAXPARTITIONS; i++) {
 -		mn = DISKMINOR(device_unit(&sc->sc_dv), i);
 +		mn = DISKMINOR(device_unit(sc->sc_dv), i);
  		vdevgone(bmaj, mn, mn, VBLK);
  		vdevgone(cmaj, mn, mn, VCHR);
  	}
 @@ -243,7 +244,7 @@ ldenddetach(struct ld_softc *sc)
  #endif

  	/* Deregister with PMF */
 -	pmf_device_deregister(&sc->sc_dv);
 +	pmf_device_deregister(sc->sc_dv);

  	/*
  	 * XXX We can't really flush the cache here, beceause the
 @@ -346,7 +347,7 @@ ldclose(dev_t dev, int flags, int fmt, s

  	if (sc->sc_dk.dk_openmask == 0) {
  		if (sc->sc_flush != NULL && (*sc->sc_flush)(sc, 0) != 0)
 -			aprint_error_dev(&sc->sc_dv, "unable to flush cache\n");
 +			aprint_error_dev(sc->sc_dv, "unable to flush cache\n");
  		if ((sc->sc_flags & LDF_KLABEL) == 0)
  			sc->sc_flags &= ~LDF_VLABEL;
  	}
 @@ -500,7 +501,7 @@ ldioctl(dev_t dev, u_long cmd, void *add
  			return (EBADF);

  		/* If the ioctl happens here, the parent is us. */
 -		strlcpy(dkw->dkw_parent, device_xname(&sc->sc_dv),
 +		strlcpy(dkw->dkw_parent, device_xname(sc->sc_dv),
  			sizeof(dkw->dkw_parent));
  		return (dkwedge_add(dkw));
  	    }
 @@ -513,7 +514,7 @@ ldioctl(dev_t dev, u_long cmd, void *add
  			return (EBADF);

  		/* If the ioctl happens here, the parent is us. */
 -		strlcpy(dkw->dkw_parent, device_xname(&sc->sc_dv),
 +		strlcpy(dkw->dkw_parent, device_xname(sc->sc_dv),
  			sizeof(dkw->dkw_parent));
  		return (dkwedge_del(dkw));
  	    }
 @@ -755,10 +756,10 @@ ldgetdisklabel(struct ld_softc *sc)
  	ldgetdefaultlabel(sc, sc->sc_dk.dk_label);

  	/* Call the generic disklabel extraction routine. */
 -	errstring = readdisklabel(MAKEDISKDEV(0, device_unit(&sc->sc_dv),
 +	errstring = readdisklabel(MAKEDISKDEV(0, device_unit(sc->sc_dv),
  	    RAW_PART), ldstrategy, sc->sc_dk.dk_label, sc->sc_dk.dk_cpulabel);
  	if (errstring != NULL)
 -		printf("%s: %s\n", device_xname(&sc->sc_dv), errstring);
 +		printf("%s: %s\n", device_xname(sc->sc_dv), errstring);

  	/* In-core label now valid. */
  	sc->sc_flags |= LDF_VLABEL;
 @@ -899,7 +900,7 @@ ld_set_properties(struct ld_softc *ld)
  	prop_dictionary_set(disk_info, "geometry", geom);
  	prop_object_release(geom);

 -	prop_dictionary_set(device_properties(&ld->sc_dv),
 +	prop_dictionary_set(device_properties(ld->sc_dv),
  	    "disk-info", disk_info);

  	/*
 Index: dev/ldvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ldvar.h,v
 retrieving revision 1.14
 diff -b -u -p -r1.14 ldvar.h
 --- dev/ldvar.h	11 Aug 2008 06:43:37 -0000	1.14
 +++ dev/ldvar.h	6 Sep 2008 11:07:37 -0000
 @@ -35,7 +35,7 @@
  #include <sys/mutex.h>

  struct ld_softc {
 -	struct	device sc_dv;
 +	struct	device *sc_dv;
  	struct	disk sc_dk;
  	struct	bufq_state *sc_bufq;
  	kmutex_t sc_mutex;
 Index: dev/ata/ld_ataraid.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ata/ld_ataraid.c,v
 retrieving revision 1.28
 diff -b -u -p -r1.28 ld_ataraid.c
 --- dev/ata/ld_ataraid.c	24 Aug 2008 09:19:03 -0000	1.28
 +++ dev/ata/ld_ataraid.c	6 Sep 2008 11:07:38 -0000
 @@ -130,6 +130,8 @@ ld_ataraid_attach(device_t parent, devic
  	char unklev[32];
  	u_int i;

 +	ld->sc_dv = self;
 +
  	if (ld_ataraid_initialized == 0) {
  		ld_ataraid_initialized = 1;
  		pool_init(&ld_ataraid_cbufpl, sizeof(struct cbuf), 0,
 @@ -180,7 +182,7 @@ ld_ataraid_attach(device_t parent, devic
  	    ata_raid_type_name(aai->aai_type), level);

  	if (ld->sc_start == NULL) {
 -		aprint_error_dev(&ld->sc_dv, "unsupported array type\n");
 +		aprint_error_dev(ld->sc_dv, "unsupported array type\n");
  		return;
  	}

 @@ -472,7 +474,7 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
  		adi->adi_status &= ~ADI_S_ONLINE;

  		printf("%s: error %d on component %d (%s)\n",
 -		    device_xname(&sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
 +		    device_xname(sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
  		    device_xname(adi->adi_dev));

  		/*
 Index: dev/i2o/ld_iop.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/i2o/ld_iop.c,v
 retrieving revision 1.30
 diff -b -u -p -r1.30 ld_iop.c
 --- dev/i2o/ld_iop.c	11 Aug 2008 06:43:37 -0000	1.30
 +++ dev/i2o/ld_iop.c	6 Sep 2008 11:07:39 -0000
 @@ -74,18 +74,18 @@ struct ld_iop_softc {
  	int	sc_flags;
  };

 -static void	ld_iop_adjqparam(struct device *, int);
 -static void	ld_iop_attach(struct device *, struct device *, void *);
 -static int	ld_iop_detach(struct device *, int);
 +static void	ld_iop_adjqparam(device_t, int);
 +static void	ld_iop_attach(device_t, device_t, void *);
 +static int	ld_iop_detach(device_t, int);
  static int	ld_iop_dump(struct ld_softc *, void *, int, int);
  static int	ld_iop_flush(struct ld_softc *, int);
 -static void	ld_iop_intr(struct device *, struct iop_msg *, void *);
 -static void	ld_iop_intr_event(struct device *, struct iop_msg *, void *);
 -static int	ld_iop_match(struct device *, struct cfdata *, void *);
 +static void	ld_iop_intr(device_t, struct iop_msg *, void *);
 +static void	ld_iop_intr_event(device_t, struct iop_msg *, void *);
 +static int	ld_iop_match(device_t, cfdata_t, void *);
  static int	ld_iop_start(struct ld_softc *, struct buf *);
  static void	ld_iop_unconfig(struct ld_iop_softc *, int);

 -CFATTACH_DECL(ld_iop, sizeof(struct ld_iop_softc),
 +CFATTACH_DECL_NEW(ld_iop, sizeof(struct ld_iop_softc),
      ld_iop_match, ld_iop_attach, ld_iop_detach, NULL);

  static const char * const ld_iop_errors[] = {
 @@ -107,8 +107,7 @@ static const char * const ld_iop_errors[
  };

  static int
 -ld_iop_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_iop_match(device_t parent, cfdata_t match, void *aux)
  {
  	struct iop_attach_args *ia;

 @@ -118,12 +117,12 @@ ld_iop_match(struct device *parent, stru
  }

  static void
 -ld_iop_attach(struct device *parent, struct device *self, void *aux)
 +ld_iop_attach(device_t parent, device_t self, void *aux)
  {
 -	struct iop_attach_args *ia;
 -	struct ld_softc *ld;
 -	struct ld_iop_softc *sc;
 -	struct iop_softc *iop;
 +	struct iop_attach_args *ia = aux;
 +	struct ld_iop_softc *sc = device_private(self);
 +	struct iop_softc *iop = device_private(parent);
 +	struct ld_softc *ld = &sc->sc_ld;
  	int rv, evreg, enable;
  	const char *typestr, *fixedstr;
  	u_int cachesz;
 @@ -137,10 +136,7 @@ ld_iop_attach(struct device *parent, str
  		} p;
  	} __attribute__ ((__packed__)) param;

 -	sc = device_private(self);
 -	ld = &sc->sc_ld;
 -	iop = device_private(parent);
 -	ia = (struct iop_attach_args *)aux;
 +	ld->sc_dv = self;
  	evreg = 0;

  	/* Register us as an initiator. */
 @@ -287,7 +283,7 @@ ld_iop_unconfig(struct ld_iop_softc *sc,
  {
  	struct iop_softc *iop;

 -	iop = (struct iop_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	iop = device_private(device_parent(sc->sc_ld.sc_dv));

  	if ((sc->sc_flags & LD_IOP_CLAIMED) != 0)
  		iop_util_claim(iop, &sc->sc_ii, 1,
 @@ -318,7 +314,7 @@ ld_iop_unconfig(struct ld_iop_softc *sc,
  }

  static int
 -ld_iop_detach(struct device *self, int flags)
 +ld_iop_detach(device_t self, int flags)
  {
  	struct ld_iop_softc *sc;
  	struct iop_softc *iop;
 @@ -359,7 +355,7 @@ ld_iop_start(struct ld_softc *ld, struct
  	u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];

  	sc = (struct ld_iop_softc *)ld;
 -	iop = (struct iop_softc *)device_parent(&ld->sc_dv);
 +	iop = device_private(device_parent(ld->sc_dv));

  	im = iop_msg_alloc(iop, 0);
  	im->im_dvcontext = bp;
 @@ -419,7 +415,7 @@ ld_iop_dump(struct ld_softc *ld, void *d
  	u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];

  	sc = (struct ld_iop_softc *)ld;
 -	iop = (struct iop_softc *)device_parent(&ld->sc_dv);
 +	iop = device_private(device_parent(ld->sc_dv));
  	bcount = blkcnt * ld->sc_secsize;
  	ba = (u_int64_t)blkno * ld->sc_secsize;
  	im = iop_msg_alloc(iop, IM_POLL);
 @@ -455,7 +451,7 @@ ld_iop_flush(struct ld_softc *ld, int fl
  	int rv;

  	sc = (struct ld_iop_softc *)ld;
 -	iop = (struct iop_softc *)device_parent(&ld->sc_dv);
 +	iop = device_private(device_parent(ld->sc_dv));
  	im = iop_msg_alloc(iop, IM_WAIT);

  	mf.msgflags = I2O_MSGFLAGS(i2o_rbs_cache_flush);
 @@ -471,7 +467,7 @@ ld_iop_flush(struct ld_softc *ld, int fl
  }

  void
 -ld_iop_intr(struct device *dv, struct iop_msg *im, void *reply)
 +ld_iop_intr(device_t dv, struct iop_msg *im, void *reply)
  {
  	struct i2o_rbs_reply *rb;
  	struct buf *bp;
 @@ -483,7 +479,7 @@ ld_iop_intr(struct device *dv, struct io
  	rb = reply;
  	bp = im->im_dvcontext;
  	sc = (struct ld_iop_softc *)dv;
 -	iop = (struct iop_softc *)device_parent(dv);
 +	iop = device_private(device_parent(dv));

  	err = ((rb->msgflags & I2O_MSGFLAGS_FAIL) != 0);

 @@ -509,7 +505,7 @@ ld_iop_intr(struct device *dv, struct io
  }

  static void
 -ld_iop_intr_event(struct device *dv, struct iop_msg *im, void *reply)
 +ld_iop_intr_event(device_t dv, struct iop_msg *im, void *reply)
  {
  	struct i2o_util_event_register_reply *rb;
  	struct ld_iop_softc *sc;
 @@ -537,17 +533,18 @@ ld_iop_intr_event(struct device *dv, str
  }

  static void
 -ld_iop_adjqparam(struct device *dv, int mpi)
 +ld_iop_adjqparam(device_t dv, int mpi)
  {
 -	struct iop_softc *iop;
 +	struct ld_iop_softc *sc = device_private(dv);
 +	struct iop_softc *iop = device_private(device_parent(dv));
 +	struct ld_softc *ld = &sc->sc_ld;

  	/*
  	 * AMI controllers seem to loose the plot if you hand off lots of
  	 * queued commands.
  	 */
 -	iop = (struct iop_softc *)device_parent(dv);
  	if (le16toh(I2O_ORG_AMI) == iop->sc_status.orgid && mpi > 64)
  		mpi = 64;

 -	ldadjqparam((struct ld_softc *)dv, mpi);
 +	ldadjqparam(ld, mpi);
  }
 Index: dev/ic/ld_aac.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/ld_aac.c,v
 retrieving revision 1.20
 diff -b -u -p -r1.20 ld_aac.c
 --- dev/ic/ld_aac.c	30 Apr 2008 14:07:13 -0000	1.20
 +++ dev/ic/ld_aac.c	6 Sep 2008 11:07:39 -0000
 @@ -61,46 +61,42 @@ struct ld_aac_softc {
  	int	sc_hwunit;
  };

 -static void	ld_aac_attach(struct device *, struct device *, void *);
 +static void	ld_aac_attach(device_t, device_t, void *);
  static void	ld_aac_intr(struct aac_ccb *);
  static int	ld_aac_dobio(struct ld_aac_softc *, void *, int, int, int,
  			     struct buf *);
  static int	ld_aac_dump(struct ld_softc *, void *, int, int);
 -static int	ld_aac_match(struct device *, struct cfdata *, void *);
 +static int	ld_aac_match(device_t, cfdata_t, void *);
  static int	ld_aac_start(struct ld_softc *, struct buf *);

 -CFATTACH_DECL(ld_aac, sizeof(struct ld_aac_softc),
 +CFATTACH_DECL_NEW(ld_aac, sizeof(struct ld_aac_softc),
      ld_aac_match, ld_aac_attach, NULL, NULL);

  static int
 -ld_aac_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_aac_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  static void
 -ld_aac_attach(struct device *parent, struct device *self, void *aux)
 +ld_aac_attach(device_t parent, device_t self, void *aux)
  {
 -	struct aac_attach_args *aaca;
 -	struct aac_drive *hdr;
 -	struct ld_aac_softc *sc;
 -	struct ld_softc *ld;
 -	struct aac_softc *aac;
 +	struct aac_attach_args *aaca = aux;
 +	struct ld_aac_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct aac_softc *aac = device_private(parent);
 +	struct aac_drive *hdr = &aac->sc_hdr[aaca->aaca_unit];

 -	aaca = aux;
 -	aac = (struct aac_softc *)parent;
 -	sc = (struct ld_aac_softc *)self;
 -	ld = &sc->sc_ld;
 -	hdr = &aac->sc_hdr[aaca->aaca_unit];
 +	ld->sc_dv = self;

  	sc->sc_hwunit = aaca->aaca_unit;
  	ld->sc_flags = LDF_ENABLED;
  	ld->sc_maxxfer = AAC_MAX_XFER(aac);
  	ld->sc_secperunit = hdr->hd_size;
  	ld->sc_secsize = AAC_SECTOR_SIZE;
 -	ld->sc_maxqueuecnt = (aac->sc_max_fibs - AAC_NCCBS_RESERVE) / aac->sc_nunits;
 +	ld->sc_maxqueuecnt =
 +	    (aac->sc_max_fibs - AAC_NCCBS_RESERVE) / aac->sc_nunits;
  	ld->sc_start = ld_aac_start;
  	ld->sc_dump = ld_aac_dump;

 @@ -123,7 +119,7 @@ ld_aac_dobio(struct ld_aac_softc *sc, vo
  	u_int16_t size;
  	int s, rv, i;

 -	aac = (struct aac_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	aac = device_private(device_parent(sc->sc_ld.sc_dv));

  	/*
  	 * Allocate a command control block and map the data transfer.
 @@ -271,7 +267,8 @@ ld_aac_dobio(struct ld_aac_softc *sc, vo
  			}

  			if (status != ST_OK) {
 -				aprint_error_dev(&sc->sc_ld.sc_dv, "I/O error: %s\n",
 +				aprint_error_dev(sc->sc_ld.sc_dv,
 +				    "I/O error: %s\n",
  				    aac_describe_code(aac_command_status_table,
  				    status));
  				rv = EIO;
 @@ -308,7 +305,7 @@ ld_aac_intr(struct aac_ccb *ac)

  	bp = ac->ac_context;
  	sc = (struct ld_aac_softc *)ac->ac_device;
 -	aac = (struct aac_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	aac = device_private(device_parent(sc->sc_ld.sc_dv));

  	if ((bp->b_flags & B_READ) != 0) {
  		brr = (struct aac_blockread_response *)&ac->ac_fib->data[0];
 @@ -325,7 +322,7 @@ ld_aac_intr(struct aac_ccb *ac)
  		bp->b_error = EIO;
  		bp->b_resid = bp->b_bcount;

 -		aprint_error_dev(&sc->sc_ld.sc_dv, "I/O error: %s\n",
 +		aprint_error_dev(sc->sc_ld.sc_dv, "I/O error: %s\n",
  		    aac_describe_code(aac_command_status_table, status));
  	} else
  		bp->b_resid = 0;
 Index: dev/ic/ld_cac.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/ld_cac.c,v
 retrieving revision 1.21
 diff -b -u -p -r1.21 ld_cac.c
 --- dev/ic/ld_cac.c	28 Apr 2008 20:23:50 -0000	1.21
 +++ dev/ic/ld_cac.c	6 Sep 2008 11:07:40 -0000
 @@ -66,40 +66,36 @@ struct ld_cac_softc {
  	struct	timeval sc_serrtm;
  };

 -void	ld_cac_attach(struct device *, struct device *, void *);
 -void	ld_cac_done(struct device *, void *, int);
 +void	ld_cac_attach(device_t, device_t, void *);
 +void	ld_cac_done(device_t, void *, int);
  int	ld_cac_dump(struct ld_softc *, void *, int, int);
 -int	ld_cac_match(struct device *, struct cfdata *, void *);
 +int	ld_cac_match(device_t, cfdata_t, void *);
  int	ld_cac_start(struct ld_softc *, struct buf *);

  static const struct	timeval ld_cac_serrintvl = { 60, 0 };

 -CFATTACH_DECL(ld_cac, sizeof(struct ld_cac_softc),
 +CFATTACH_DECL_NEW(ld_cac, sizeof(struct ld_cac_softc),
      ld_cac_match, ld_cac_attach, NULL, NULL);

  int
 -ld_cac_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_cac_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  void
 -ld_cac_attach(struct device *parent, struct device *self, void *aux)
 +ld_cac_attach(device_t parent, device_t self, void *aux)
  {
  	struct cac_drive_info dinfo;
  	struct cac_attach_args *caca;
 -	struct ld_softc *ld;
 -	struct ld_cac_softc *sc;
 -	struct cac_softc *cac;
 +	struct ld_cac_softc *sc = device_private(self);
 +	struct cac_softc *cac = device_private(parent);
 +	struct ld_softc *ld = &sc->sc_ld;
  	const char *type;

 -	sc = (struct ld_cac_softc *)self;
 -	ld = &sc->sc_ld;
 -	caca = (struct cac_attach_args *)aux;
 -	sc->sc_hwunit = caca->caca_unit;
 -	cac = (struct cac_softc *)parent;
 +	caca = aux;
 +	ld->sc_dv = self;
  	sc->sc_mutex = &cac->sc_mutex;

  	if (cac_cmd(cac, CAC_CMD_GET_LOG_DRV_INFO, &dinfo, sizeof(dinfo),
 @@ -150,11 +146,11 @@ ld_cac_start(struct ld_softc *ld, struct
  	struct cac_context cc;

  	sc = (struct ld_cac_softc *)ld;
 -	cac = (struct cac_softc *)device_parent(&ld->sc_dv);
 +	cac = device_private(device_parent(ld->sc_dv));

  	cc.cc_handler = ld_cac_done;
  	cc.cc_context = bp;
 -	cc.cc_dv = &ld->sc_dv;
 +	cc.cc_dv = ld->sc_dv;

  	if ((bp->b_flags & B_READ) == 0) {
  		cmd = CAC_CMD_WRITE;
 @@ -175,7 +171,7 @@ ld_cac_dump(struct ld_softc *ld, void *d

  	sc = (struct ld_cac_softc *)ld;

 -	return (cac_cmd((struct cac_softc *)device_parent(&ld->sc_dv),
 +	return (cac_cmd(device_private(device_parent(ld->sc_dv)),
  	    CAC_CMD_WRITE_MEDIA, data, blkcnt * ld->sc_secsize,
  	    sc->sc_hwunit, blkno, CAC_CCB_DATA_OUT, NULL));
  }
 @@ -207,7 +203,8 @@ ld_cac_done(struct device *dv, void *con
  		sc->sc_serrcnt++;
  		if (ratecheck(&sc->sc_serrtm, &ld_cac_serrintvl)) {
  			sc->sc_serrcnt = 0;
 -			aprint_error_dev(dv, "%d soft errors; array may be degraded\n",
 +			aprint_error_dev(dv,
 +			    "%d soft errors; array may be degraded\n",
  			    sc->sc_serrcnt);
  		}
  	}
 Index: dev/ic/ld_icp.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/ld_icp.c,v
 retrieving revision 1.21
 diff -b -u -p -r1.21 ld_icp.c
 --- dev/ic/ld_icp.c	11 Aug 2008 06:43:38 -0000	1.21
 +++ dev/ic/ld_icp.c	6 Sep 2008 11:07:40 -0000
 @@ -65,19 +65,19 @@ struct ld_icp_softc {
  	int	sc_hwunit;
  };

 -void	ld_icp_attach(struct device *, struct device *, void *);
 -int	ld_icp_detach(struct device *, int);
 +void	ld_icp_attach(device_t, device_t, void *);
 +int	ld_icp_detach(device_t, int);
  int	ld_icp_dobio(struct ld_icp_softc *, void *, int, int, int,
  		     struct buf *);
  int	ld_icp_dump(struct ld_softc *, void *, int, int);
  int	ld_icp_flush(struct ld_softc *, int);
  void	ld_icp_intr(struct icp_ccb *);
 -int	ld_icp_match(struct device *, struct cfdata *, void *);
 +int	ld_icp_match(device_t, cfdata_t, void *);
  int	ld_icp_start(struct ld_softc *, struct buf *);

 -void	ld_icp_adjqparam(struct device *, int);
 +void	ld_icp_adjqparam(device_t, int);

 -CFATTACH_DECL(ld_icp, sizeof(struct ld_icp_softc),
 +CFATTACH_DECL_NEW(ld_icp, sizeof(struct ld_icp_softc),
      ld_icp_match, ld_icp_attach, ld_icp_detach, NULL);

  static const struct icp_servicecb ld_icp_servicecb = {
 @@ -85,8 +85,7 @@ static const struct icp_servicecb ld_icp
  };

  int
 -ld_icp_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_icp_match(device_t parent, cfdata_t match, void *aux)
  {
  	struct icp_attach_args *icpa;

 @@ -96,22 +95,18 @@ ld_icp_match(struct device *parent, stru
  }

  void
 -ld_icp_attach(struct device *parent, struct device *self, void *aux)
 +ld_icp_attach(device_t parent, device_t self, void *aux)
  {
 -	struct icp_attach_args *icpa;
 -	struct ld_icp_softc *sc;
 -	struct ld_softc *ld;
 -	struct icp_softc *icp;
 -	struct icp_cachedrv *cd;
 +	struct icp_attach_args *icpa = aux;
 +	struct ld_icp_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct icp_softc *icp = device_private(parent);
 +	struct icp_cachedrv *cd = &icp->icp_cdr[icpa->icpa_unit];
  	struct icp_cdevinfo *cdi;
  	const char *str;
  	int t;

 -	sc = (struct ld_icp_softc *)self;
 -	ld = &sc->sc_ld;
 -	icp = (struct icp_softc *)parent;
 -	icpa = aux;
 -	cd = &icp->icp_cdr[icpa->icpa_unit];
 +	ld->sc_dv = self;

  	icp_register_servicecb(icp, icpa->icpa_unit, &ld_icp_servicecb);

 @@ -174,7 +169,7 @@ ld_icp_attach(struct device *parent, str
  }

  int
 -ld_icp_detach(struct device *dv, int flags)
 +ld_icp_detach(device_t dv, int flags)
  {
  	int rv;

 @@ -194,7 +189,7 @@ ld_icp_dobio(struct ld_icp_softc *sc, vo
  	struct icp_softc *icp;
  	int s, rv;

 -	icp = (struct icp_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	icp = device_private(device_parent(sc->sc_ld.sc_dv));

  	/*
  	 * Allocate a command control block.
 @@ -241,7 +236,7 @@ ld_icp_dobio(struct ld_icp_softc *sc, vo
  	} else {
   		ic->ic_intr = ld_icp_intr;
  		ic->ic_context = bp;
 -		ic->ic_dv = &sc->sc_ld.sc_dv;
 +		ic->ic_dv = sc->sc_ld.sc_dv;
  		icp_ccb_enqueue(icp, ic);
  	}

 @@ -274,7 +269,7 @@ ld_icp_flush(struct ld_softc *ld, int fl
  	int rv;

  	sc = (struct ld_icp_softc *)ld;
 -	icp = (struct icp_softc *)device_parent(&ld->sc_dv);
 +	icp = device_private(device_parent(ld->sc_dv));

  	ic = icp_ccb_alloc_wait(icp);
  	ic->ic_cmd.cmd_opcode = htole16(ICP_FLUSH);
 @@ -304,7 +299,7 @@ ld_icp_intr(struct icp_ccb *ic)

  	bp = ic->ic_context;
  	sc = (struct ld_icp_softc *)ic->ic_dv;
 -	icp = (struct icp_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	icp = device_private(device_parent(sc->sc_ld.sc_dv));

  	if (ic->ic_status != ICP_S_OK) {
  		aprint_error_dev(ic->ic_dv, "request failed; status=0x%04x\n",
 @@ -332,7 +327,7 @@ ld_icp_intr(struct icp_ccb *ic)
  }

  void
 -ld_icp_adjqparam(struct device *dv, int openings)
 +ld_icp_adjqparam(device_t dv, int openings)
  {

  	ldadjqparam((struct ld_softc *) dv, openings);
 Index: dev/ic/ld_mlx.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/ld_mlx.c,v
 retrieving revision 1.17
 diff -b -u -p -r1.17 ld_mlx.c
 --- dev/ic/ld_mlx.c	28 Apr 2008 20:23:50 -0000	1.17
 +++ dev/ic/ld_mlx.c	6 Sep 2008 11:07:40 -0000
 @@ -65,41 +65,36 @@ struct ld_mlx_softc {
  	int	sc_hwunit;
  };

 -static void	ld_mlx_attach(struct device *, struct device *, void *);
 -static int	ld_mlx_detach(struct device *, int);
 +static void	ld_mlx_attach(device_t, device_t, void *);
 +static int	ld_mlx_detach(device_t, int);
  static int	ld_mlx_dobio(struct ld_mlx_softc *, void *, int, int, int,
  			     struct buf *);
  static int	ld_mlx_dump(struct ld_softc *, void *, int, int);
  static void	ld_mlx_handler(struct mlx_ccb *);
 -static int	ld_mlx_match(struct device *, struct cfdata *, void *);
 +static int	ld_mlx_match(device_t, cfdata_t, void *);
  static int	ld_mlx_start(struct ld_softc *, struct buf *);

 -CFATTACH_DECL(ld_mlx, sizeof(struct ld_mlx_softc),
 +CFATTACH_DECL_NEW(ld_mlx, sizeof(struct ld_mlx_softc),
      ld_mlx_match, ld_mlx_attach, ld_mlx_detach, NULL);

  static int
 -ld_mlx_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_mlx_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  static void
 -ld_mlx_attach(struct device *parent, struct device *self, void *aux)
 +ld_mlx_attach(device_t parent, device_t self, void *aux)
  {
 -	struct mlx_attach_args *mlxa;
 -	struct ld_mlx_softc *sc;
 -	struct ld_softc *ld;
 -	struct mlx_softc *mlx;
 -	struct mlx_sysdrive *ms;
 +	struct mlx_attach_args *mlxa = aux;
 +	struct ld_mlx_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct mlx_softc *mlx = device_private(parent);
 +	struct mlx_sysdrive *ms = &mlx->mlx_sysdrive[mlxa->mlxa_unit];
  	const char *statestr;

 -	sc = (struct ld_mlx_softc *)self;
 -	ld = &sc->sc_ld;
 -	mlx = (struct mlx_softc *)parent;
 -	mlxa = aux;
 -	ms = &mlx->mlx_sysdrive[mlxa->mlxa_unit];
 +	ld->sc_dv = self;

  	sc->sc_hwunit = mlxa->mlxa_unit;
  	ld->sc_maxxfer = MLX_MAX_XFER;
 @@ -141,14 +136,17 @@ ld_mlx_attach(struct device *parent, str
  }

  static int
 -ld_mlx_detach(struct device *dv, int flags)
 +ld_mlx_detach(device_t dv, int flags)
  {
 +	struct ld_mlx_softc *sc = device_private(dv);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct mlx_softc *mlx = device_private(device_parent(dv));
  	int rv;

 -	if ((rv = ldbegindetach((struct ld_softc *)dv, flags)) != 0)
 +	if ((rv = ldbegindetach(ld, flags)) != 0)
  		return (rv);
 -	ldenddetach((struct ld_softc *)dv);
 -	mlx_flush((struct mlx_softc *)device_parent(dv), 1);
 +	ldenddetach(ld);
 +	mlx_flush(mlx, 1);

  	return (0);
  }
 @@ -162,7 +160,7 @@ ld_mlx_dobio(struct ld_mlx_softc *sc, vo
  	int s, rv;
  	bus_addr_t sgphys;

 -	mlx = (struct mlx_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	mlx = device_private(device_parent(sc->sc_ld.sc_dv));

  	if ((rv = mlx_ccb_alloc(mlx, &mc, bp == NULL)) != 0)
  		return (rv);
 @@ -200,7 +198,7 @@ ld_mlx_dobio(struct ld_mlx_softc *sc, vo
  	} else {
   		mc->mc_mx.mx_handler = ld_mlx_handler;
  		mc->mc_mx.mx_context = bp;
 -		mc->mc_mx.mx_dv = &sc->sc_ld.sc_dv;
 +		mc->mc_mx.mx_dv = sc->sc_ld.sc_dv;
  		mlx_ccb_enqueue(mlx, mc);
  		rv = 0;
  	}
 @@ -227,7 +225,7 @@ ld_mlx_handler(struct mlx_ccb *mc)
  	mx = &mc->mc_mx;
  	bp = mx->mx_context;
  	sc = (struct ld_mlx_softc *)mx->mx_dv;
 -	mlx = (struct mlx_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	mlx = device_private(device_parent(sc->sc_ld.sc_dv));

  	if (mc->mc_status != MLX_STATUS_OK) {
  		bp->b_error = EIO;
 @@ -235,10 +233,10 @@ ld_mlx_handler(struct mlx_ccb *mc)

  		if (mc->mc_status == MLX_STATUS_RDWROFFLINE)
  			printf("%s: drive offline\n",
 -			    device_xname(&sc->sc_ld.sc_dv));
 +			    device_xname(sc->sc_ld.sc_dv));
  		else
  			printf("%s: I/O error - %s\n",
 -			    device_xname(&sc->sc_ld.sc_dv),
 +			    device_xname(sc->sc_ld.sc_dv),
  			    mlx_ccb_diagnose(mc));
  	} else
  		bp->b_resid = 0;
 Index: dev/ic/mlx.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/mlx.c,v
 retrieving revision 1.56
 diff -b -u -p -r1.56 mlx.c
 --- dev/ic/mlx.c	8 Jun 2008 12:43:51 -0000	1.56
 +++ dev/ic/mlx.c	6 Sep 2008 11:07:42 -0000
 @@ -669,7 +669,7 @@ mlx_adjqparam(struct mlx_softc *mlx, int
  	for (i = 0; i < ld_cd.cd_ndevs; i++) {
  		if ((ld = device_lookup_private(&ld_cd, i)) == NULL)
  			continue;
 -		if (device_parent(&ld->sc_dv) != &mlx->mlx_dv)
 +		if (device_parent(ld->sc_dv) != &mlx->mlx_dv)
  			continue;
  		ldadjqparam(ld, mpu + (slop-- > 0));
  	}
 Index: dev/pci/ld_amr.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/ld_amr.c,v
 retrieving revision 1.16
 diff -b -u -p -r1.16 ld_amr.c
 --- dev/pci/ld_amr.c	28 Apr 2008 20:23:55 -0000	1.16
 +++ dev/pci/ld_amr.c	6 Sep 2008 11:07:46 -0000
 @@ -74,27 +74,23 @@ static void	ld_amr_handler(struct amr_cc
  static int	ld_amr_start(struct ld_softc *, struct buf *);

  static int
 -ld_amr_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_amr_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  static void
 -ld_amr_attach(struct device *parent, struct device *self, void *aux)
 +ld_amr_attach(device_t parent, device_t self, void *aux)
  {
 -	struct amr_attach_args *amra;
 -	struct ld_amr_softc *sc;
 -	struct ld_softc *ld;
 -	struct amr_softc *amr;
 +	struct amr_attach_args *amra = aux;
 +	struct ld_amr_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct amr_softc *amr = device_private(parent);
  	const char *statestr;
  	int happy;

 -	sc = (struct ld_amr_softc *)self;
 -	ld = &sc->sc_ld;
 -	amr = (struct amr_softc *)parent;
 -	amra = aux;
 +	ld->sc_dv = self;

  	sc->sc_hwunit = amra->amra_unit;
  	ld->sc_maxxfer = amr_max_xfer;
 @@ -122,7 +118,7 @@ ld_amr_attach(struct device *parent, str
  	ldattach(ld);
  }

 -CFATTACH_DECL(ld_amr, sizeof(struct ld_amr_softc),
 +CFATTACH_DECL_NEW(ld_amr, sizeof(struct ld_amr_softc),
      ld_amr_match, ld_amr_attach, NULL, NULL);

  static int
 @@ -134,7 +130,7 @@ ld_amr_dobio(struct ld_amr_softc *sc, vo
  	struct amr_mailbox_cmd *mb;
  	int s, rv;

 -	amr = (struct amr_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	amr = device_private(device_parent(sc->sc_ld.sc_dv));

  	if ((rv = amr_ccb_alloc(amr, &ac)) != 0)
  		return (rv);
 @@ -190,10 +186,10 @@ ld_amr_handler(struct amr_ccb *ac)

  	bp = ac->ac_context;
  	sc = (struct ld_amr_softc *)ac->ac_dv;
 -	amr = (struct amr_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	amr = device_private(device_parent(sc->sc_ld.sc_dv));

  	if (ac->ac_status != AMR_STATUS_SUCCESS) {
 -		printf("%s: cmd status 0x%02x\n", device_xname(&sc->sc_ld.sc_dv),
 +		printf("%s: cmd status 0x%02x\n", device_xname(sc->sc_ld.sc_dv),
  		    ac->ac_status);

  		bp->b_error = EIO;
 Index: dev/pci/ld_twa.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/ld_twa.c,v
 retrieving revision 1.12
 diff -b -u -p -r1.12 ld_twa.c
 --- dev/pci/ld_twa.c	11 Aug 2008 06:43:38 -0000	1.12
 +++ dev/pci/ld_twa.c	6 Sep 2008 11:07:46 -0000
 @@ -76,22 +76,22 @@ struct ld_twa_softc {
  	int	sc_hwunit;
  };

 -static void	ld_twa_attach(struct device *, struct device *, void *);
 -static int	ld_twa_detach(struct device *, int);
 +static void	ld_twa_attach(device_t, device_t, void *);
 +static int	ld_twa_detach(device_t, int);
  static int	ld_twa_dobio(struct ld_twa_softc *, void *, size_t, daddr_t,
  			     struct buf *);
  static int	ld_twa_dump(struct ld_softc *, void *, int, int);
  static int	ld_twa_flush(struct ld_softc *, int);
  static void	ld_twa_handler(struct twa_request *);
 -static int	ld_twa_match(struct device *, struct cfdata *, void *);
 +static int	ld_twa_match(device_t, cfdata_t, void *);
  static int	ld_twa_start(struct ld_softc *, struct buf *);

 -static void	ld_twa_adjqparam(struct device *, int);
 +static void	ld_twa_adjqparam(device_t, int);

  static int ld_twa_scsicmd(struct ld_twa_softc *,
  	struct twa_request *, struct buf *);

 -CFATTACH_DECL(ld_twa, sizeof(struct ld_twa_softc),
 +CFATTACH_DECL_NEW(ld_twa, sizeof(struct ld_twa_softc),
      ld_twa_match, ld_twa_attach, ld_twa_detach, NULL);

  static const struct twa_callbacks ld_twa_callbacks = {
 @@ -99,24 +99,21 @@ static const struct twa_callbacks ld_twa
  };

  static int
 -ld_twa_match(struct device *parent, struct cfdata *match, void *aux)
 +ld_twa_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  static void
 -ld_twa_attach(struct device *parent, struct device *self, void *aux)
 +ld_twa_attach(device_t parent, device_t self, void *aux)
  {
 -	struct twa_attach_args *twa_args;
 -	struct ld_twa_softc *sc;
 -	struct ld_softc *ld;
 -	struct twa_softc *twa;
 +	struct twa_attach_args *twa_args = aux;
 +	struct ld_twa_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct twa_softc *twa = device_private(parent);

 -	sc = (struct ld_twa_softc *)self;
 -	ld = &sc->sc_ld;
 -	twa = (struct twa_softc *)parent;
 -	twa_args = aux;
 +	ld->sc_dv = self;

  	twa_register_callbacks(twa, twa_args->twaa_unit, &ld_twa_callbacks);

 @@ -133,13 +130,15 @@ ld_twa_attach(struct device *parent, str
  }

  static int
 -ld_twa_detach(struct device *self, int flags)
 +ld_twa_detach(device_t self, int flags)
  {
 +	struct ld_twa_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
  	int error;

 -	if ((error = ldbegindetach((struct ld_softc *)self, flags)) != 0)
 +	if ((error = ldbegindetach(ld, flags)) != 0)
  		return (error);
 -	ldenddetach((struct ld_softc *)self);
 +	ldenddetach(ld);

  	return (0);
  }
 @@ -152,7 +151,7 @@ ld_twa_dobio(struct ld_twa_softc *sc, vo
  	struct twa_request	*tr;
  	struct twa_softc *twa;

 -	twa = (struct twa_softc *)sc->sc_ld.sc_dv.dv_parent;
 +	twa = device_private(device_parent(sc->sc_ld.sc_dv));

  	if ((tr = twa_get_request(twa, 0)) == NULL) {
  		return (EAGAIN);
 @@ -211,7 +210,7 @@ ld_twa_handler(struct twa_request *tr)

  	bp = tr->bp;
  	sc = (struct ld_twa_softc *)tr->tr_ld_sc;
 -	twa = (struct twa_softc *)sc->sc_ld.sc_dv.dv_parent;
 +	twa = device_private(device_parent(sc->sc_ld.sc_dv));

  	status = tr->tr_command->command.cmd_pkt_9k.status;

 @@ -247,7 +246,7 @@ ld_twa_flush(struct ld_softc *ld, int fl
  {
  	int s, rv = 0;
  	struct twa_request *tr;
 -	struct twa_softc *twa = (void *)ld->sc_dv.dv_parent;
 +	struct twa_softc *twa = device_private(device_parent(ld->sc_dv));
  	struct ld_twa_softc *sc = (void *)ld;
  	struct twa_command_generic *generic_cmd;

 @@ -285,10 +284,12 @@ ld_twa_flush(struct ld_softc *ld, int fl
  }

  static void
 -ld_twa_adjqparam(struct device *self, int openings)
 +ld_twa_adjqparam(device_t self, int openings)
  {
 +	struct ld_twa_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;

 -	ldadjqparam((struct ld_softc *)self, openings);
 +	ldadjqparam(ld, openings);
  }


 Index: dev/pci/ld_twe.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/ld_twe.c,v
 retrieving revision 1.31
 diff -b -u -p -r1.31 ld_twe.c
 --- dev/pci/ld_twe.c	11 Aug 2008 06:46:10 -0000	1.31
 +++ dev/pci/ld_twe.c	6 Sep 2008 11:07:47 -0000
 @@ -66,19 +66,19 @@ struct ld_twe_softc {
  	int	sc_hwunit;
  };

 -static void	ld_twe_attach(struct device *, struct device *, void *);
 -static int	ld_twe_detach(struct device *, int);
 +static void	ld_twe_attach(device_t, device_t, void *);
 +static int	ld_twe_detach(device_t, int);
  static int	ld_twe_dobio(struct ld_twe_softc *, void *, int, int, int,
  			     struct buf *);
  static int	ld_twe_dump(struct ld_softc *, void *, int, int);
  static int	ld_twe_flush(struct ld_softc *, int);
  static void	ld_twe_handler(struct twe_ccb *, int);
 -static int	ld_twe_match(struct device *, struct cfdata *, void *);
 +static int	ld_twe_match(device_t, cfdata_t, void *);
  static int	ld_twe_start(struct ld_softc *, struct buf *);

 -static void	ld_twe_adjqparam(struct device *, int);
 +static void	ld_twe_adjqparam(device_t, int);

 -CFATTACH_DECL(ld_twe, sizeof(struct ld_twe_softc),
 +CFATTACH_DECL_NEW(ld_twe, sizeof(struct ld_twe_softc),
      ld_twe_match, ld_twe_attach, ld_twe_detach, NULL);

  static const struct twe_callbacks ld_twe_callbacks = {
 @@ -86,31 +86,26 @@ static const struct twe_callbacks ld_twe
  };

  static int
 -ld_twe_match(struct device *parent, struct cfdata *match,
 -    void *aux)
 +ld_twe_match(device_t parent, cfdata_t match, void *aux)
  {

  	return (1);
  }

  static void
 -ld_twe_attach(struct device *parent, struct device *self, void *aux)
 +ld_twe_attach(device_t parent, device_t self, void *aux)
  {
 -	struct twe_attach_args *twea;
 -	struct ld_twe_softc *sc;
 -	struct ld_softc *ld;
 -	struct twe_softc *twe;
 -	struct twe_drive *td;
 +	struct twe_attach_args *twea = aux;
 +	struct ld_twe_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
 +	struct twe_softc *twe = device_private(parent);
 +	struct twe_drive *td = &twe->sc_units[twea->twea_unit];
  	const char *typestr, *stripestr, *statstr;
  	char unktype[16], stripebuf[32], unkstat[32];
  	int error;
  	uint8_t status;

 -	sc = (struct ld_twe_softc *)self;
 -	ld = &sc->sc_ld;
 -	twe = (struct twe_softc *)parent;
 -	twea = aux;
 -	td = &twe->sc_units[twea->twea_unit];
 +	ld->sc_dv = self;

  	twe_register_callbacks(twe, twea->twea_unit, &ld_twe_callbacks);

 @@ -164,13 +159,15 @@ ld_twe_attach(struct device *parent, str
  }

  static int
 -ld_twe_detach(struct device *self, int flags)
 +ld_twe_detach(device_t self, int flags)
  {
 +	struct ld_twe_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;
  	int rv;

 -	if ((rv = ldbegindetach((struct ld_softc *)self, flags)) != 0)
 +	if ((rv = ldbegindetach(ld, flags)) != 0)
  		return (rv);
 -	ldenddetach((struct ld_softc *)self);
 +	ldenddetach(ld);

  	return (0);
  }
 @@ -184,7 +181,7 @@ ld_twe_dobio(struct ld_twe_softc *sc, vo
  	struct twe_softc *twe;
  	int s, rv, flags;

 -	twe = (struct twe_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	twe = device_private(device_parent(sc->sc_ld.sc_dv));

  	flags = (dowrite ? TWE_CCB_DATA_OUT : TWE_CCB_DATA_IN);
  	if ((ccb = twe_ccb_alloc(twe, flags)) == NULL)
 @@ -251,7 +248,7 @@ ld_twe_handler(struct twe_ccb *ccb, int 
  	tx = &ccb->ccb_tx;
  	bp = tx->tx_context;
  	sc = (struct ld_twe_softc *)tx->tx_dv;
 -	twe = (struct twe_softc *)device_parent(&sc->sc_ld.sc_dv);
 +	twe = device_private(device_parent(sc->sc_ld.sc_dv));

  	twe_ccb_unmap(twe, ccb);
  	twe_ccb_free(twe, ccb);
 @@ -277,7 +274,7 @@ static int
  ld_twe_flush(struct ld_softc *ld, int flags)
  {
  	struct ld_twe_softc *sc = (void *) ld;
 -	struct twe_softc *twe = (void *) device_parent(&ld->sc_dv);
 +	struct twe_softc *twe = device_private(device_parent(ld->sc_dv));
  	struct twe_ccb *ccb;
  	struct twe_cmd *tc;
  	int s, rv;
 @@ -307,7 +304,7 @@ ld_twe_flush(struct ld_softc *ld, int fl
  	} else {
  		ccb->ccb_tx.tx_handler = twe_ccb_wait_handler;
  		ccb->ccb_tx.tx_context = NULL;
 -		ccb->ccb_tx.tx_dv = &ld->sc_dv;
 +		ccb->ccb_tx.tx_dv = ld->sc_dv;
  		twe_ccb_enqueue(twe, ccb);

  		rv = 0;
 @@ -326,6 +323,8 @@ ld_twe_flush(struct ld_softc *ld, int fl
  static void
  ld_twe_adjqparam(struct device *self, int openings)
  {
 +	struct ld_twe_softc *sc = device_private(self);
 +	struct ld_softc *ld = &sc->sc_ld;

 -	ldadjqparam((struct ld_softc *)self, openings);
 +	ldadjqparam(ld, openings);
  }

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@NetBSD.org
Responsible-Changed-When: Tue, 09 Sep 2008 12:42:18 +0000
Responsible-Changed-Why:
I'll handle this PR.


State-Changed-From-To: open->closed
State-Changed-By: tron@NetBSD.org
State-Changed-When: Tue, 09 Sep 2008 12:48:19 +0000
State-Changed-Why:
I've committed your patch. Thanks a lot.


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39468 CVS commit: src/sys/dev
Date: Tue,  9 Sep 2008 12:45:40 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Tue Sep  9 12:45:40 UTC 2008

 Modified Files:
 	src/sys/dev: ld.c ldvar.h
 	src/sys/dev/ata: ld_ataraid.c
 	src/sys/dev/i2o: ld_iop.c
 	src/sys/dev/ic: ld_aac.c ld_cac.c ld_icp.c ld_mlx.c mlx.c
 	src/sys/dev/pci: ld_amr.c ld_twa.c ld_twe.c

 Log Message:
 Complete device_t/softc split for the ld(4) attachments. This should
 prevent crashes while attaching a drive.

 Patch supplied by Juan RP in PR kern/39468.


 To generate a diff of this commit:
 cvs rdiff -r1.62 -r1.63 src/sys/dev/ld.c
 cvs rdiff -r1.14 -r1.15 src/sys/dev/ldvar.h
 cvs rdiff -r1.28 -r1.29 src/sys/dev/ata/ld_ataraid.c
 cvs rdiff -r1.31 -r1.32 src/sys/dev/i2o/ld_iop.c
 cvs rdiff -r1.20 -r1.21 src/sys/dev/ic/ld_aac.c
 cvs rdiff -r1.21 -r1.22 src/sys/dev/ic/ld_cac.c src/sys/dev/ic/ld_icp.c
 cvs rdiff -r1.17 -r1.18 src/sys/dev/ic/ld_mlx.c
 cvs rdiff -r1.56 -r1.57 src/sys/dev/ic/mlx.c
 cvs rdiff -r1.16 -r1.17 src/sys/dev/pci/ld_amr.c
 cvs rdiff -r1.12 -r1.13 src/sys/dev/pci/ld_twa.c
 cvs rdiff -r1.31 -r1.32 src/sys/dev/pci/ld_twe.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/39468 (Incomplete device_t/softc split for the ld(4) attachments)
Date: Tue, 9 Sep 2008 14:49:46 +0200

 2008/9/9  <tron@netbsd.org>:
 > Synopsis: Incomplete device_t/softc split for the ld(4) attachments
 >
 > State-Changed-From-To: open->closed
 > State-Changed-By: tron@NetBSD.org
 > State-Changed-When: Tue, 09 Sep 2008 12:48:19 +0000
 > State-Changed-Why:
 > I've committed your patch. Thanks a lot.

 Thanks. Please close kern/39394 as well, it's not necessary anymore.

From: "Greg A. Woods" <woods@planix.com>
To: NetBSD GNATS <gnats-bugs@NetBSD.org>
Cc: tron@NetBSD.org,
	xtraeme@gmail.com
Subject: Re: PR/39468 CVS commit: src/sys/dev
Date: Wed, 10 Sep 2008 14:18:45 -0400

 --pgp-sign-Multipart_Wed_Sep_10_14:17:51_2008-1
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: quoted-printable

 At Tue,  9 Sep 2008 12:50:04 +0000 (UTC), Matthias Scheler wrote:
 Subject: PR/39468 CVS commit: src/sys/dev
 >=20
 >  Module Name:	src
 >  Committed By:	tron
 >  Date:		Tue Sep  9 12:45:40 UTC 2008
 > =20
 >  Modified Files:
 >  	src/sys/dev: ld.c ldvar.h
 >  	src/sys/dev/ata: ld_ataraid.c
 >  	src/sys/dev/i2o: ld_iop.c
 >  	src/sys/dev/ic: ld_aac.c ld_cac.c ld_icp.c ld_mlx.c mlx.c
 >  	src/sys/dev/pci: ld_amr.c ld_twa.c ld_twe.c
 > =20
 >  Log Message:
 >  Complete device_t/softc split for the ld(4) attachments. This should
 >  prevent crashes while attaching a drive.
 > =20
 >  Patch supplied by Juan RP in PR kern/39468.

 =46rom what I can tell this patch undid the following change, or at least
 one small part of it:

 	src/sys/dev/ata/ld_ataraid.c

 	revision 1.26
 	date: 2008/04/05 22:04:36;  author: cegger;  state: Exp;  lines: +6 -7
 	branches:  1.26.2;  1.26.4;
 	use aprint_*_dev and device_xname

 I noticed this because when merging this file against my local copy with
 the manually applied patch I encountered the following conflict:


 <<<<<<< ld_ataraid.c
 		aprint_error_dev(&sc->sc_ld.sc_dv, "error %d on component %d (%s)\n",
 				 bp->b_error, cbp->cb_comp,
 				 device_xname(adi->adi_dev));
 =3D=3D=3D=3D=3D=3D=3D
 		printf("%s: error %d on component %d (%s)\n",
 		    device_xname(sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
 		    device_xname(adi->adi_dev));
 >>>>>>> 1.29


 --=20
 						Greg A. Woods
 						Planix, Inc.

 <woods@planix.com>     +1 416 489-5852 x122     http://www.planix.com/

 --pgp-sign-Multipart_Wed_Sep_10_14:17:51_2008-1
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit

 -----BEGIN PGP SIGNATURE-----
 Version: PGPfreeware 5.0i for non-commercial use
 MessageID: Wbc1XxJuzOrbl524zYsbbor4gq7qmYeX

 iQA/AwUBSMgPhWZ9cbd4v/R/EQKDPACgvPXVuiqauNwJqptBulImTuNZw0MAnjfX
 dSu/iHVdoOlNbOtX1mn3OUeU
 =Qsgw
 -----END PGP SIGNATURE-----

 --pgp-sign-Multipart_Wed_Sep_10_14:17:51_2008-1--

From: "Juan Romero Pardines" <xtraeme@gmail.com>
To: "NetBSD GNATS" <gnats-bugs@netbsd.org>
Cc: woods@planix.com
Subject: Re: PR/39468 CVS commit: src/sys/dev
Date: Wed, 10 Sep 2008 20:23:22 +0200

 2008/9/10 Greg A. Woods <woods@planix.com>:
 > At Tue,  9 Sep 2008 12:50:04 +0000 (UTC), Matthias Scheler wrote:
 > Subject: PR/39468 CVS commit: src/sys/dev
 >>
 >>  Module Name: src
 >>  Committed By:        tron
 >>  Date:                Tue Sep  9 12:45:40 UTC 2008
 >>
 >>  Modified Files:
 >>       src/sys/dev: ld.c ldvar.h
 >>       src/sys/dev/ata: ld_ataraid.c
 >>       src/sys/dev/i2o: ld_iop.c
 >>       src/sys/dev/ic: ld_aac.c ld_cac.c ld_icp.c ld_mlx.c mlx.c
 >>       src/sys/dev/pci: ld_amr.c ld_twa.c ld_twe.c
 >>
 >>  Log Message:
 >>  Complete device_t/softc split for the ld(4) attachments. This should
 >>  prevent crashes while attaching a drive.
 >>
 >>  Patch supplied by Juan RP in PR kern/39468.
 >
 > From what I can tell this patch undid the following change, or at least
 > one small part of it:
 >
 >        src/sys/dev/ata/ld_ataraid.c
 >
 >        revision 1.26
 >        date: 2008/04/05 22:04:36;  author: cegger;  state: Exp;  lines: +6 -7
 >        branches:  1.26.2;  1.26.4;
 >        use aprint_*_dev and device_xname
 >
 > I noticed this because when merging this file against my local copy with
 > the manually applied patch I encountered the following conflict:
 >
 >
 > <<<<<<< ld_ataraid.c
 >                aprint_error_dev(&sc->sc_ld.sc_dv, "error %d on component %d (%s)\n",
 >                                 bp->b_error, cbp->cb_comp,
 >                                 device_xname(adi->adi_dev));
 > =======
 >                printf("%s: error %d on component %d (%s)\n",
 >                    device_xname(sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
 >                    device_xname(adi->adi_dev));
 >>>>>>>> 1.29

 That's not correct. Probably you are using an old revision or something,
 but I'm sure I haven't done this on this commit. Check it out yourself:

 http://cvsweb.netbsd.se/cgi-bin/bsdweb.cgi/src/sys/dev/ata/ld_ataraid.c.diff?r1=1.28;r2=1.29;f=h

From: "Greg A. Woods" <woods@planix.com>
To: NetBSD GNATS <gnats-bugs@NetBSD.org>
Cc: tron@NetBSD.org,
	xtraeme@gmail.com
Subject: Re: PR/39468 CVS commit: src/sys/dev
Date: Wed, 10 Sep 2008 14:28:53 -0400

 --pgp-sign-Multipart_Wed_Sep_10_14:28:53_2008-1
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: quoted-printable

 At Tue,  9 Sep 2008 12:50:04 +0000 (UTC), Matthias Scheler wrote:
 Subject: PR/39468 CVS commit: src/sys/dev
 >=20
 >  Module Name:	src
 >  Committed By:	tron
 >  Date:		Tue Sep  9 12:45:40 UTC 2008
 > =20
 >  Modified Files:
 >  	src/sys/dev: ld.c ldvar.h
 >  	src/sys/dev/ata: ld_ataraid.c
 >  	src/sys/dev/i2o: ld_iop.c
 >  	src/sys/dev/ic: ld_aac.c ld_cac.c ld_icp.c ld_mlx.c mlx.c
 >  	src/sys/dev/pci: ld_amr.c ld_twa.c ld_twe.c
 > =20
 >  Log Message:
 >  Complete device_t/softc split for the ld(4) attachments. This should
 >  prevent crashes while attaching a drive.
 > =20
 >  Patch supplied by Juan RP in PR kern/39468.
 > =20

 Also this conflict shows up now too:

 Index: sys/dev/ic/ld_mlx.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/master/m-NetBSD/main/src/sys/dev/ic/ld_mlx.c,v
 retrieving revision 1.18
 diff -u -r1.18 ld_mlx.c
 --- sys/dev/ic/ld_mlx.c	9 Sep 2008 12:45:40 -0000	1.18
 +++ sys/dev/ic/ld_mlx.c	10 Sep 2008 18:21:50 -0000
 @@ -232,12 +232,21 @@
  		bp->b_resid =3D bp->b_bcount;
 =20
  		if (mc->mc_status =3D=3D MLX_STATUS_RDWROFFLINE)
 +<<<<<<< ld_mlx.c
 +			aprint_error_dev(&sc->sc_ld.sc_dv, "drive offline\n");
 +=3D=3D=3D=3D=3D=3D=3D
  			printf("%s: drive offline\n",
  			    device_xname(sc->sc_ld.sc_dv));
 +>>>>>>> 1.18
  		else
 +<<<<<<< ld_mlx.c
 +			aprint_error_dev(&sc->sc_ld.sc_dv, "I/O error - %s\n",
 +					 mlx_ccb_diagnose(mc));
 +=3D=3D=3D=3D=3D=3D=3D
  			printf("%s: I/O error - %s\n",
  			    device_xname(sc->sc_ld.sc_dv),
  			    mlx_ccb_diagnose(mc));
 +>>>>>>> 1.18
  	} else
  		bp->b_resid =3D 0;

 Index: sys/dev/pci/ld_amr.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/master/m-NetBSD/main/src/sys/dev/pci/ld_amr.c,v
 retrieving revision 1.17
 diff -u -r1.17 ld_amr.c
 --- sys/dev/pci/ld_amr.c	9 Sep 2008 12:45:40 -0000	1.17
 +++ sys/dev/pci/ld_amr.c	10 Sep 2008 18:26:08 -0000
 @@ -189,8 +189,13 @@
  	amr =3D device_private(device_parent(sc->sc_ld.sc_dv));
 =20
  	if (ac->ac_status !=3D AMR_STATUS_SUCCESS) {
 +<<<<<<< ld_amr.c
 +		aprint_error_dev(&sc->sc_ld.sc_dv, "cmd status 0x%02x\n",
 +				 ac->ac_status);
 +=3D=3D=3D=3D=3D=3D=3D
  		printf("%s: cmd status 0x%02x\n", device_xname(sc->sc_ld.sc_dv),
  		    ac->ac_status);
 +>>>>>>> 1.17
 =20
  		bp->b_error =3D EIO;
  		bp->b_resid =3D bp->b_bcount;
 =20

 And I have the following change in the previously mentioned file which I
 find very helpful:

 Index: sys/dev/ata/ld_ataraid.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/master/m-NetBSD/main/src/sys/dev/ata/ld_ataraid.c,v
 retrieving revision 1.29
 diff -u -r1.29 ld_ataraid.c
 --- sys/dev/ata/ld_ataraid.c	9 Sep 2008 12:45:39 -0000	1.29
 +++ sys/dev/ata/ld_ataraid.c	10 Sep 2008 18:20:15 -0000
 @@ -180,6 +180,9 @@
  	aprint_naive(": ATA %s array\n", level);
  	aprint_normal(": %s ATA %s array\n",
  	    ata_raid_type_name(aai->aai_type), level);
 +#ifdef DIAGNOSTIC
 +	aprint_normal_dev(&ld->sc_dv, "ld_ataraid_attach(): ld unit %d (ld->sc_dv=
  =3D %p)\n", ld->sc_dv.dv_unit, &ld->sc_dv);
 +#endif
 =20
  	if (ld->sc_start =3D=3D NULL) {
  		aprint_error_dev(ld->sc_dv, "unsupported array type\n");


 --=20
 						Greg A. Woods
 						Planix, Inc.

 <woods@planix.com>     +1 416 489-5852 x122     http://www.planix.com/

 --pgp-sign-Multipart_Wed_Sep_10_14:28:53_2008-1
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit

 -----BEGIN PGP SIGNATURE-----
 Version: PGPfreeware 5.0i for non-commercial use
 MessageID: HygYynrwnZfx1n9U7Qa8tddz1fuOIqU7

 iQA/AwUBSMgR5WZ9cbd4v/R/EQJpIQCfQMw3JJMYlc0rFlaD0473HStC1gwAnA/w
 HiR5F/FwZZh9IohDSW6B2i4u
 =Bf1n
 -----END PGP SIGNATURE-----

 --pgp-sign-Multipart_Wed_Sep_10_14:28:53_2008-1--

From: "Greg A. Woods; Planix, Inc." <woods@planix.ca>
To: "Juan Romero Pardines" <xtraeme@gmail.com>
Cc: NetBSD GNATS <gnats-bugs@netbsd.org>
Subject: Re: PR/39468 CVS commit: src/sys/dev
Date: Wed, 10 Sep 2008 14:34:48 -0400

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --Apple-Mail-2-98836928
 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
 Content-Transfer-Encoding: 7bit


 On 10-Sep-08, at 2:23 PM, Juan Romero Pardines wrote:

 > 2008/9/10 Greg A. Woods <woods@planix.com>:
 >> From what I can tell this patch undid the following change, or at  
 >> least
 >> one small part of it:
 >>
 >>       src/sys/dev/ata/ld_ataraid.c
 >>
 >>       revision 1.26
 >>       date: 2008/04/05 22:04:36;  author: cegger;  state: Exp;   
 >> lines: +6 -7
 >>       branches:  1.26.2;  1.26.4;
 >>       use aprint_*_dev and device_xname
 >>
 >> I noticed this because when merging this file against my local copy  
 >> with
 >> the manually applied patch I encountered the following conflict:
 >>
 >>
 >> <<<<<<< ld_ataraid.c
 >>               aprint_error_dev(&sc->sc_ld.sc_dv, "error %d on  
 >> component %d (%s)\n",
 >>                                bp->b_error, cbp->cb_comp,
 >>                                device_xname(adi->adi_dev));
 >> =======
 >>               printf("%s: error %d on component %d (%s)\n",
 >>                   device_xname(sc->sc_ld.sc_dv), bp->b_error, cbp- 
 >> >cb_comp,
 >>                   device_xname(adi->adi_dev));
 >>>>>>>>> 1.29
 >
 > That's not correct. Probably you are using an old revision or  
 > something,
 > but I'm sure I haven't done this on this commit. Check it out  
 > yourself:

 Hmmm... perhaps it was me who made that change locally to fix that one  
 last lone printf() that I thought may have been missed by the 1.26 rev.

 -- 
 					Greg A. Woods; Planix, Inc.
 					<woods@planix.ca>


 --Apple-Mail-2-98836928
 content-type: application/pgp-signature; x-mac-type=70674453;
 	name=PGP.sig
 content-description: This is a digitally signed message part
 content-disposition: inline; filename=PGP.sig
 content-transfer-encoding: 7bit

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.8 (Darwin)

 iD8DBQFIyBNJZn1xt3i/9H8RAkatAJ0ZyegOOy5CXkzYig6zS1yyznLF0wCdFSuj
 JlHh4mSw6UbwCFjkDdRCsYs=
 =Iuq5
 -----END PGP SIGNATURE-----

 --Apple-Mail-2-98836928--

From: Matthias Scheler <tron@NetBSD.org>
To: "Greg A. Woods" <woods@planix.com>
Cc: NetBSD GNATS <gnats-bugs@NetBSD.org>
Subject: Re: PR/39468 CVS commit: src/sys/dev
Date: Wed, 10 Sep 2008 19:41:00 +0100

 --+QahgC5+KEYLbs62
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Wed, Sep 10, 2008 at 02:18:45PM -0400, Greg A. Woods wrote:
 > >  Log Message:
 > >  Complete device_t/softc split for the ld(4) attachments. This should
 > >  prevent crashes while attaching a drive.
 > > =20
 > >  Patch supplied by Juan RP in PR kern/39468.
 >=20
 > From what I can tell this patch undid the following change, or at least
 > one small part of it:
 >=20
 > 	src/sys/dev/ata/ld_ataraid.c
 >=20
 > 	revision 1.26
 > 	date: 2008/04/05 22:04:36;  author: cegger;  state: Exp;  lines: +6 -7
 > 	branches:  1.26.2;  1.26.4;
 > 	use aprint_*_dev and device_xname

 That was not part of the commit. Here is the output of the "rdiff"
 command mentioned in
 <http://mail-index.netbsd.org/source-changes/2008/09/09/msg210084.html>:

 Index: src/sys/dev/ata/ld_ataraid.c
 diff -c src/sys/dev/ata/ld_ataraid.c:1.28 src/sys/dev/ata/ld_ataraid.c:1.29
 *** src/sys/dev/ata/ld_ataraid.c:1.28	Sun Aug 24 09:19:03 2008
 --- src/sys/dev/ata/ld_ataraid.c	Tue Sep  9 12:45:39 2008
 ***************
 *** 1,4 ****
 ! /*	$NetBSD: ld_ataraid.c,v 1.28 2008/08/24 09:19:03 hannken Exp $	*/
  =20
   /*
    * Copyright (c) 2003 Wasabi Systems, Inc.
 --- 1,4 ----
 ! /*	$NetBSD: ld_ataraid.c,v 1.29 2008/09/09 12:45:39 tron Exp $	*/
  =20
   /*
    * Copyright (c) 2003 Wasabi Systems, Inc.
 ***************
 *** 45,51 ****
    */
  =20
   #include <sys/cdefs.h>
 ! __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.28 2008/08/24 09:19:03 hannk=
 en Exp $");
  =20
   #include "rnd.h"
  =20
 --- 45,51 ----
    */
  =20
   #include <sys/cdefs.h>
 ! __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.29 2008/09/09 12:45:39 tron =
 Exp $");
  =20
   #include "rnd.h"
  =20
 ***************
 *** 130,135 ****
 --- 130,137 ----
   	char unklev[32];
   	u_int i;
  =20
 + 	ld->sc_dv =3D self;
 +=20
   	if (ld_ataraid_initialized =3D=3D 0) {
   		ld_ataraid_initialized =3D 1;
   		pool_init(&ld_ataraid_cbufpl, sizeof(struct cbuf), 0,
 ***************
 *** 180,186 ****
   	    ata_raid_type_name(aai->aai_type), level);
  =20
   	if (ld->sc_start =3D=3D NULL) {
 ! 		aprint_error_dev(&ld->sc_dv, "unsupported array type\n");
   		return;
   	}
  =20
 --- 182,188 ----
   	    ata_raid_type_name(aai->aai_type), level);
  =20
   	if (ld->sc_start =3D=3D NULL) {
 ! 		aprint_error_dev(ld->sc_dv, "unsupported array type\n");
   		return;
   	}
  =20
 ***************
 *** 472,478 ****
   		adi->adi_status &=3D ~ADI_S_ONLINE;
  =20
   		printf("%s: error %d on component %d (%s)\n",
 ! 		    device_xname(&sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
   		    device_xname(adi->adi_dev));
  =20
   		/*
 --- 474,480 ----
   		adi->adi_status &=3D ~ADI_S_ONLINE;
  =20
   		printf("%s: error %d on component %d (%s)\n",
 ! 		    device_xname(sc->sc_ld.sc_dv), bp->b_error, cbp->cb_comp,
   		    device_xname(adi->adi_dev));
  =20
   		/*

 It looks to me like you have uncommitted changes in your source tree.
 Please resolve the conflicts carefully and submit the changes in a PR.

 	Thanks in advance

 --=20
 Matthias Scheler                                  http://zhadum.org.uk/

 --+QahgC5+KEYLbs62
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (NetBSD)

 iD8DBQFIyBS8iYEmcnvdc3cRAuTgAJ9SS4S/iXI0FKD/UGbZy9cfsI+5ngCgo/B+
 8nVxTqLXZ4ogFGf6acJFoyE=
 =1BD9
 -----END PGP SIGNATURE-----

 --+QahgC5+KEYLbs62--

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.