From owner-freebsd-current@FreeBSD.ORG Mon Jan 26 07:22:58 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60124C0B for ; Mon, 26 Jan 2015 07:22:58 +0000 (UTC) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2912E857 for ; Mon, 26 Jan 2015 07:22:57 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id ar1so7169502iec.13 for ; Sun, 25 Jan 2015 23:22:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=VqBLw2o3Pb+kVQcBXTX8vBp8dia7bM/Egmj3TBR4qSs=; b=LkQMpz3Be2vvPQ1Z7LV9viruRqhHcbHSczNXHsOtMnUgcwFVr6tUP9+C3gtL3TDlLc OiCN1YkFH55ebfCJ3HrPtK6if4yvvuZ3/S9SVZIvh9IOPndLB07F9nvh9vOWLasMdGzY f4utT/KO5/0gEnx5BI+nOvpy8OaldvyQJFYW/yLfRJ3tZkLiFzB90g0E16kWknCH3h3h VJ9AQ4YQfglvABJrIMG40U7uJoxC5vvou4YCjLojvDMDnfKTtMw9tO2r8YPbTSuQjBqH d2AnIleBjFiSf04KrDNuvXZlAA2yQucybVreOWiQ3G5Ee8T07b6elopcqGVo7bYO8Ewo NLuQ== X-Gm-Message-State: ALoCoQkC05U6A14L2vrRBKpYVOfDKcxHWu8/YYKOivA9F74VBSDRSfp3HfeJWsfhclfyHsOScVCP X-Received: by 10.42.214.212 with SMTP id hb20mr18972479icb.19.1422256977137; Sun, 25 Jan 2015 23:22:57 -0800 (PST) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by mx.google.com with ESMTPSA id p18sm540928iop.27.2015.01.25.23.22.56 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 Jan 2015 23:22:56 -0800 (PST) Sender: Warner Losh Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: How to read a disklabel (Re: What replaces DIOCGDINFO?) From: Warner Losh In-Reply-To: <54c5d75d.vYjlikWm5nAMV9br%perryh@pluto.rain.com> Date: Mon, 26 Jan 2015 00:22:55 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <197159D3-4654-4F2E-A6CB-582029DAF329@bsdimp.com> References: <54c4a9f2.T1F+E5l9r+DbUlmr%perryh@pluto.rain.com> <54c5d75d.vYjlikWm5nAMV9br%perryh@pluto.rain.com> To: Perry Hutchison X-Mailer: Apple Mail (2.1993) Cc: freebsd-current@freebsd.org, imp@freebsd.org, andrnils@gmail.com X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Mon, 26 Jan 2015 07:22:58 -0000 > On Jan 25, 2015, at 10:57 PM, Perry Hutchison = wrote: >=20 > Andreas Nilsson wrote: >> On Sun, Jan 25, 2015 at 9:31 AM, Perry Hutchison = >> wrote: >>> -r276737 removed 4 ioctls, including DIOCGDINFO, from = . >>> The commit log entry says only "Remove old ioctl use and support, = once >>> and for all." >>>=20 >>> What are users of that mechanism supposed to use instead? >>=20 >> = http://lists.freebsd.org/pipermail/freebsd-current/2015-January/053960.htm= l >> might have the answer for you. >=20 > Same symptom, but DIOCGMEDIASIZE is not the solution in this case > because the port reads the disklabel to identify the partition that > contains a particular sector of the device. To do that, AFAIK it > needs to actually retrieve and examine the label. The other ioctls > in don't look all that promising, either. Most modern disks don=E2=80=99t even have BSD disk labels. They just = have GPT partitions. So the DIOCGDINFO failed to work an interesting amount of the time. There=E2=80=99s no easy way to fix that, since the disk label = sizes aren=E2=80=99t big enough to return GPT data. gpart list contains the information needed. You can find the source in /usr/src/sbin/geom/class/part/geom_part.c libgeom(3) has some of the info you=E2=80=99ll need as well. However, it is likely easier to pull = it out of either the XML version of the config sysctl (kern.geom.confxml) or the simple text version (kern.geom.conftxt). I imagine the latter is likely best = for finding which partition an absolute sector belongs to. Warner