From owner-freebsd-current@FreeBSD.ORG Mon Jul 30 07:10:06 2012 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 AEC7E1065678; Mon, 30 Jul 2012 07:10:06 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mail.kirov.so-ups.ru (ns.kirov.so-ups.ru [178.74.170.1]) by mx1.freebsd.org (Postfix) with ESMTP id C9B918FC0A; Mon, 30 Jul 2012 07:10:05 +0000 (UTC) Received: from kas30pipe.localhost (localhost.kirov.so-ups.ru [127.0.0.1]) by mail.kirov.so-ups.ru (Postfix) with SMTP id D6BF4B805F; Mon, 30 Jul 2012 11:02:58 +0400 (MSK) Received: from kirov.so-ups.ru (unknown [172.21.81.1]) by mail.kirov.so-ups.ru (Postfix) with ESMTP id A045CB805E; Mon, 30 Jul 2012 11:02:58 +0400 (MSK) Received: by ns.kirov.so-ups.ru (Postfix, from userid 1010) id 9B02EBA09A; Mon, 30 Jul 2012 11:02:58 +0400 (MSK) Received: from [127.0.0.1] (elsukov.kirov.oduur.so [10.118.3.52]) by ns.kirov.so-ups.ru (Postfix) with ESMTP id 60CCEBA084; Mon, 30 Jul 2012 11:02:58 +0400 (MSK) Message-ID: <5016319D.5000503@FreeBSD.org> Date: Mon, 30 Jul 2012 11:02:53 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: FreeBSD Current X-Enigmail-Version: 1.4.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig934F2ECCF177386C153B9787" X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0284], KAS30/Release X-SpamTest-Info: Not protected Cc: Marcel Moolenaar , Andriy Gapon , Hiroki Sato Subject: [Request for review] loader changes 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: Mon, 30 Jul 2012 07:10:07 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig934F2ECCF177386C153B9787 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable Hi, All. It's been a long ago, when i published my patches first time. And it seems, there is no one who is against or wants suggest something. So I'm asking for review, and I want start merge changes at the end of we= ek. Patches are here: http://people.freebsd.org/~ae/bootcode/ full.diff: The full diff, except tools. tools.diff: A small test program bootparttest. It uses sys/boot/common/part.c to taste GEOM provider or disk image in the similar way, how loader does. common.diff: Changes to the common code. This code is used with many architectures and= libraries. * common/Makefile.inc added LOADER_NO_DISK_SUPPORT knob to disable build common code related = to disks and partitions. By default GPT and MBR support are enabled, LOADER_NO_GPT_S= UPPORT and LOADER_NO_MBR_SUPPORT can disable they. * common/part.c common/part.h these files are new. They contains partition tables related code. Sever= al words about API: Partition table described with opaque type "struct ptable", partition e= ntries with struct ptable_entry { uint64_t start; uint64_t end; int index; enum partition_type type; }; The partition tables detection occurs when ptable_open() is called. Thi= s function takes as arguments the number of disk sectors, sector size and pointer to the= callback function, that is know how to read from the disk. The ptable_close() function releases allocated resources. The ptable_gettype() functions returns the type of partition table. The ptable_getpart() functions returns information about specified part= ition. The ptable_iterate() functions calls a callback function for each parti= tion in the table. The parttype2str() converts partition type to the string. The following partition tables are supported: BSD label, GPT, MBR, EBR = and VTOC8. * common/disk.c common/disk.h These files have been changed and they use new API to work with partiti= ons. Also now they provide new disk API to the devsw disk drivers: disk_open(), disk_= close(), disk_print(), disk_fmtdev() and disk_parsedev(). i386.diff: Changes related to the i386 architecture: * i386/libi386/devicename.c Use disk_fmtdev() and disk_parsedev() functions from the common code. * i386/libi386/biosdisk.c The disk driver was rewritten to use new disk API. To the devsw ioctl h= andler was added. It handles DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls. * i386/libi386/libi386.h The offset field was added to the i386_devdesc.d_kind.biosdisk structur= e. * i386/libi386/Makefile removed unneeded flag. * i386/pmbr/pmbr.s Added secondary GPT support. * i386/loader/main.c ZFS probing simplified. * i386/loader/Makefile removed unneeded flag. userboot.diff: The disk driver and sample program updated according to the changes in th= e disk.c. Also new diskioctl callback added. uboot.diff: The disk driver was rewritten to use new disk API. arm.diff: powerpc.diff: Added LOADER_NO_DISK_SUPPORT handling to be able build uboot with or with= out disk support. zfs.diff: Use new partitions API to probe all ZFS partitions in the GPT and BSD par= tition tables. So, if there will not any opinions against these APIs and patches I will = start commit. The first step will be common and userboot code, then - i386 and = zfs parts. --=20 WBR, Andrey V. Elsukov --------------enig934F2ECCF177386C153B9787 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJQFjGiAAoJEAHF6gQQyKF6RIcIAJLsM6DEb+zxEkzD7SLGYOxO kFcgC6wHVPunH5tluSf8FVQn6yDkSFin3Sw8xe9qFDmFQ7UCdPbhnrGPDRizzUPD W6Od797a+iEhDdhWx2odglPyCdzaAgogw+sppPjvteRE3qNqK9bWM2MSS472CEpY xcB6Q5Ar1szNph/x2L9JXMt7WMkc7NRGQMGCTb02kss7SAzxxkjUDxxVhY/DCgxV auGBR+xxbRckVAFK27RyxCJuA5/114tbpA7wFiVh70SLu91l29zwc1aOPY0f87NW 6wDDP+QUdL+oO6wxY2f9OqjcL9qmJiyMZ42h4lQG+2Lg9BmT7Qo1q6txo61XTDM= =RWeO -----END PGP SIGNATURE----- --------------enig934F2ECCF177386C153B9787--