From owner-svn-src-all@FreeBSD.ORG Mon Mar 23 11:02:08 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98632C5E; Mon, 23 Mar 2015 11:02:08 +0000 (UTC) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.81]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56A3081B; Mon, 23 Mar 2015 11:02:08 +0000 (UTC) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Ya07N-0006oF-2P; Mon, 23 Mar 2015 12:02:06 +0100 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Alexander Motin" Subject: Re: svn commit: r280040 - head/usr.sbin/bhyve References: <201503151529.t2FFT4lN012903@svn.freebsd.org> Date: Mon, 23 Mar 2015 12:01:59 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201503151529.t2FFT4lN012903@svn.freebsd.org> User-Agent: Opera Mail/1.0 (Win32) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: - X-Spam-Score: -1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, BAYES_40 autolearn=disabled version=3.3.2 X-Scan-Signature: 67ca9281b58cf5c8a5b2b1d981559170 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2015 11:02:08 -0000 On Sun, 15 Mar 2015 16:29:04 +0100, Alexander Motin wrote: > Author: mav > Date: Sun Mar 15 15:29:03 2015 > New Revision: 280040 > URL: https://svnweb.freebsd.org/changeset/base/280040 > > Log: > Give AHCI disk serial based on backing file path same as for virtio > block. > It is still not good that they may intersect on different hosts, but > that > is better then intersecting on the same host. Hi, Maybe you can mix sysctl 'kern.hostid: 3674800361' into it. Regards, Ronald. > MFC after: 2 weeks > > Modified: > head/usr.sbin/bhyve/pci_ahci.c > > Modified: head/usr.sbin/bhyve/pci_ahci.c > ============================================================================== > --- head/usr.sbin/bhyve/pci_ahci.c Sun Mar 15 15:19:02 2015 (r280039) > +++ head/usr.sbin/bhyve/pci_ahci.c Sun Mar 15 15:29:03 2015 (r280040) > @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include "bhyverun.h" > #include "pci_emul.h" > @@ -131,6 +132,7 @@ struct ahci_port { > struct pci_ahci_softc *pr_sc; > uint8_t *cmd_lst; > uint8_t *rfis; > + char ident[20 + 1]; > int atapi; > int reset; > int mult_sectors; > @@ -855,8 +857,7 @@ handle_identify(struct ahci_port *p, int > buf[1] = cyl; > buf[3] = heads; > buf[6] = sech; > - /* TODO emulate different serial? */ > - ata_string((uint8_t *)(buf+10), "123456", 20); > + ata_string((uint8_t *)(buf+10), p->ident, 20); > ata_string((uint8_t *)(buf+23), "001", 8); > ata_string((uint8_t *)(buf+27), "BHYVE SATA DISK", 40); > buf[47] = (0x8000 | 128); > @@ -946,8 +947,7 @@ handle_atapi_identify(struct ahci_port * > memset(buf, 0, sizeof(buf)); > buf[0] = (2 << 14 | 5 << 8 | 1 << 7 | 2 << 5); > - /* TODO emulate different serial? */ > - ata_string((uint8_t *)(buf+10), "123456", 20); > + ata_string((uint8_t *)(buf+10), p->ident, 20); > ata_string((uint8_t *)(buf+23), "001", 8); > ata_string((uint8_t *)(buf+27), "BHYVE SATA DVD ROM", 40); > buf[49] = (1 << 9 | 1 << 8); > @@ -2167,6 +2167,8 @@ pci_ahci_init(struct vmctx *ctx, struct > struct blockif_ctxt *bctxt; > struct pci_ahci_softc *sc; > int ret, slots; > + MD5_CTX mdctx; > + u_char digest[16]; > ret = 0; > @@ -2204,6 +2206,16 @@ pci_ahci_init(struct vmctx *ctx, struct > sc->port[0].pr_sc = sc; > /* > + * Create an identifier for the backing file. Use parts of the > + * md5 sum of the filename > + */ > + MD5Init(&mdctx); > + MD5Update(&mdctx, opts, strlen(opts)); > + MD5Final(digest, &mdctx); > + sprintf(sc->port[0].ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X", > + digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); > + > + /* > * Allocate blockif request structures and add them > * to the free list > */ > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"