Date: Mon, 30 Jul 2012 11:02:53 +0400 From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: FreeBSD Current <freebsd-current@FreeBSD.ORG> Cc: Marcel Moolenaar <marcel@FreeBSD.org>, Andriy Gapon <avg@FreeBSD.org>, Hiroki Sato <hrs@FreeBSD.org> Subject: [Request for review] loader changes Message-ID: <5016319D.5000503@FreeBSD.org>
index | next in thread | raw e-mail
[-- Attachment #1 --] 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 week. 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_SUPPORT and LOADER_NO_MBR_SUPPORT can disable they. * common/part.c common/part.h these files are new. They contains partition tables related code. Several words about API: Partition table described with opaque type "struct ptable", partition entries 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. This 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 partition. The ptable_iterate() functions calls a callback function for each partition 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 partitions. 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 handler was added. It handles DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls. * i386/libi386/libi386.h The offset field was added to the i386_devdesc.d_kind.biosdisk structure. * 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 the 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 without disk support. zfs.diff: Use new partitions API to probe all ZFS partitions in the GPT and BSD partition 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. -- WBR, Andrey V. Elsukov [-- Attachment #2 --] -----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-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5016319D.5000503>
