From owner-freebsd-current@FreeBSD.ORG Fri Feb 25 15:03:40 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD6ED1065672; Fri, 25 Feb 2011 15:03:40 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from adsum.doit.wisc.edu (adsum.doit.wisc.edu [144.92.197.210]) by mx1.freebsd.org (Postfix) with ESMTP id 9A4F48FC19; Fri, 25 Feb 2011 15:03:40 +0000 (UTC) MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_+Gto84ci2qSTVw4E+ff1fA)" Received: from avs-daemon.smtpauth1.wiscmail.wisc.edu by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LH600C04HU3X600@smtpauth1.wiscmail.wisc.edu>; Fri, 25 Feb 2011 09:03:39 -0600 (CST) Received: from comporellon.tachypleus.net ([unknown] [76.210.68.25]) by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LH6001Y6HU0FJ30@smtpauth1.wiscmail.wisc.edu>; Fri, 25 Feb 2011 09:03:38 -0600 (CST) Date: Fri, 25 Feb 2011 09:03:32 -0600 From: Nathan Whitehorn In-reply-to: <201102241707.58995.jhb@freebsd.org> To: John Baldwin Message-id: <4D67C4C4.5030909@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.68.25 X-Spam-PmxInfo: Server=avs-10, Version=5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.2.25.145716, SenderIP=76.210.68.25 References: <4D64FF99.2070908@cabletv.dp.ua> <201102241514.19727.jhb@freebsd.org> <4D66C127.6060701@freebsd.org> <201102241707.58995.jhb@freebsd.org> User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20101214 Thunderbird/3.1.7 Cc: freebsd-current@freebsd.org, Mitya Subject: Re: Cosmetic path to bsdinstall X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 15:03:40 -0000 This is a multi-part message in MIME format. --Boundary_(ID_+Gto84ci2qSTVw4E+ff1fA) Content-type: text/plain; CHARSET=US-ASCII; format=flowed Content-transfer-encoding: 7BIT On 02/24/11 16:07, John Baldwin wrote: > On Thursday, February 24, 2011 3:35:51 pm Nathan Whitehorn wrote: >> On 02/24/11 14:14, John Baldwin wrote: >>> On Thursday, February 24, 2011 10:00:44 am Nathan Whitehorn wrote: >>>> Thanks! I've received basically this patch from a couple people now. I'm >>>> going to investigate whether this is a more generic way to get this >>>> information (so the list doesn't grow infinitely long), and will commit >>>> this if I can't. Having CAM devices be part of newbus would simplify >>>> this a very great deal... >>> Note that all these disk devices are not CAM devices, so CAM changing to >>> use new-bus wouldn't really matter one whit. They do all show up as 'DISK' >>> GEOM's however (I also hacked on a GEOM-based libdisk replacement at one >>> point, though probably less developed than Marcel's. I used libgeom to >>> discover DISK devices.) Given that disk_create() already hooks into GEOM, >>> that is probably the right way to discover disks in a generic fashion. >> Right, stepping through that is how I build the list. Adding a device >> description to the XML actually seems like a good idea (and maybe the >> drive serial number?). Would anyone have any objections to me starting >> to go through and do that? > I think that would be fine, but I don't think GEOM knows about those > properties yet? It doesn't, but the attached patch changes that. I've added a new field to struct disk (d_descr) meant to hold a human-readable description of the disk, and changed several drivers (cd, ada, ad) to fill it with their model strings. I've also modified geom_disk's config XML to report the disk ident and description. If there aren't any objections, I'll commit this at the end of the day. -Nathan --Boundary_(ID_+Gto84ci2qSTVw4E+ff1fA) Content-type: text/plain; name=geom-ident-descr.diff Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=geom-ident-descr.diff Index: cam/scsi/scsi_cd.c =================================================================== --- cam/scsi/scsi_cd.c (revision 219031) +++ cam/scsi/scsi_cd.c (working copy) @@ -724,6 +724,12 @@ softc->disk->d_strategy = cdstrategy; softc->disk->d_ioctl = cdioctl; softc->disk->d_name = "cd"; + cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor, + sizeof(cgd->inq_data.vendor), sizeof(softc->disk->d_descr)); + strlcat(softc->disk->d_descr, " ", sizeof(softc->disk->d_descr)); + cam_strvis(&softc->disk->d_descr[strlen(softc->disk->d_descr)], + cgd->inq_data.product, sizeof(cgd->inq_data.product), + sizeof(softc->disk->d_descr) - strlen(softc->disk->d_descr)); softc->disk->d_unit = periph->unit_number; softc->disk->d_drv1 = periph; if (cpi.maxio == 0) Index: cam/ata/ata_da.c =================================================================== --- cam/ata/ata_da.c (revision 219031) +++ cam/ata/ata_da.c (working copy) @@ -746,6 +746,8 @@ softc->disk->d_flags |= DISKFLAG_CANDELETE; strlcpy(softc->disk->d_ident, cgd->serial_num, MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); + strlcpy(softc->disk->d_descr, cgd->ident_data.model, + MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); softc->disk->d_hba_vendor = cpi.hba_vendor; softc->disk->d_hba_device = cpi.hba_device; softc->disk->d_hba_subvendor = cpi.hba_subvendor; Index: dev/ata/ata-disk.c =================================================================== --- dev/ata/ata-disk.c (revision 219031) +++ dev/ata/ata-disk.c (working copy) @@ -145,6 +145,8 @@ adp->disk->d_flags |= DISKFLAG_CANDELETE; strlcpy(adp->disk->d_ident, atadev->param.serial, sizeof(adp->disk->d_ident)); + strlcpy(adp->disk->d_descr, atadev->param.model, + sizeof(adp->disk->d_descr)); parent = device_get_parent(ch->dev); if (parent != NULL && device_get_parent(parent) != NULL && (device_get_devclass(parent) == Index: geom/geom_disk.c =================================================================== --- geom/geom_disk.c (revision 219031) +++ geom/geom_disk.c (working copy) @@ -371,6 +371,8 @@ indent, dp->d_fwheads); sbuf_printf(sb, "%s%u\n", indent, dp->d_fwsectors); + sbuf_printf(sb, "%s%s\n", indent, dp->d_ident); + sbuf_printf(sb, "%s%s\n", indent, dp->d_descr); } } Index: geom/geom_disk.h =================================================================== --- geom/geom_disk.h (revision 219031) +++ geom/geom_disk.h (working copy) @@ -85,6 +85,7 @@ u_int d_stripeoffset; u_int d_stripesize; char d_ident[DISK_IDENT_SIZE]; + char d_descr[DISK_IDENT_SIZE]; uint16_t d_hba_vendor; uint16_t d_hba_device; uint16_t d_hba_subvendor; --Boundary_(ID_+Gto84ci2qSTVw4E+ff1fA)--