From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 24 16:30:22 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DBAC16A4A0 for ; Sat, 24 Jun 2006 16:30:22 +0000 (UTC) (envelope-from mitchell@cloudynwuk.force9.co.uk) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id D13D743D5E for ; Sat, 24 Jun 2006 16:30:21 +0000 (GMT) (envelope-from mitchell@cloudynwuk.force9.co.uk) Received: from [81.174.213.13] (helo=hal) by pih-relay06.plus.net with esmtp (Exim) id 1FuB1X-00042c-5C; Sat, 24 Jun 2006 17:30:19 +0100 Received: from 127.0.0.1 (AVG SMTP 7.1.394 [268.9.3/374]); Sat, 24 Jun 2006 17:30:37 +0100 Message-ID: <000101c697ab$8684f4e0$0dd5ae51@hal> From: "Frank Mitchell" To: "Andrew" References: <1151008839.2360.30.camel@LatitudeFC5.network> Date: Sat, 24 Jun 2006 17:20:49 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: Coding question: finding the size of a block device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jun 2006 16:30:22 -0000 Let's assume your Block Device is an ATA Hard Disk and you're using FreeBSD 6.0 like me. Take a look at and you'll see a large fully-commented structure, "struct ata_params", which is used to return the information from the ATA "IDENTIFY DEVICE" command using something like: "ioctl(DevFil,IOCATAGPARM,&Parms);" This probably tells you everything you need. Plus IOCATAGPARM also returns CD/DVD Drive information using the related IDENTIFY PACKET DEVICE command. For further details consult the T13 Website. For ATA/ATAPI you might start with: "T13 1153D Revision 18" "Information Technology - AT Attachment with Packet Interface Extension (ATA/ATAPI-4)". Though there are later versions: "T13 1321D" (ATA/ATAPI-5) and "T13 1410D" (ATA/ATAPI-6). Whatever device you have there's probably some Hardware Command which gives you all the technical details. Faictz Ce Que Vouldras: Frank Mitchell -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.3/374 - Release Date: 23/06/2006