From owner-freebsd-hackers@FreeBSD.ORG Sat May 5 09:53:11 2012 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 03D14106564A; Sat, 5 May 2012 09:53:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id DC7258FC18; Sat, 5 May 2012 09:53:09 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA18187; Sat, 05 May 2012 12:53:08 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SQbfo-000A3q-B1; Sat, 05 May 2012 12:53:08 +0300 Message-ID: <4FA4F883.2060008@FreeBSD.org> Date: Sat, 05 May 2012 12:53:07 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120425 Thunderbird/12.0 MIME-Version: 1.0 To: John Baldwin References: <4F8999D2.1080902@FreeBSD.org> <4FA29E1B.7040005@FreeBSD.org> <4FA2A307.2090108@FreeBSD.org> <201205041125.15155.jhb@freebsd.org> <4FA4F36A.6030903@FreeBSD.org> In-Reply-To: <4FA4F36A.6030903@FreeBSD.org> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-fs@FreeBSD.org, freebsd-hackers@FreeBSD.org Subject: Re: [review request] zfsboot/zfsloader: support accessing filesystems within a pool 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, 05 May 2012 09:53:11 -0000 on 05/05/2012 12:31 Andriy Gapon said the following: > on 04/05/2012 18:25 John Baldwin said the following: >> On Thursday, May 03, 2012 11:23:51 am Andriy Gapon wrote: >>> on 03/05/2012 18:02 Andriy Gapon said the following: >>>> >>>> Here's the latest version of the patches: >>>> http://people.freebsd.org/~avg/zfsboot.patches.4.diff >>> >>> I've found a couple of problems in the previous version, so here's another one: >>> http://people.freebsd.org/~avg/zfsboot.patches.5.diff >>> The important change is in the first patch (__exec args). >> >> A few comments/suggestions on the args bits: > > John, > > these are excellent suggestions! Thank you! The new patchset: http://people.freebsd.org/~avg/zfsboot.patches.7.diff > Some comments: > >> - Please move the type of the 'kargs' struct into the new header and >> give it a type name. Don't add the LOADER_ZFS_SUPPORT #ifdef's >> however or the new size field (see below). > > Done. I've named the header and the struct "bootargs". > >> - Add #ifndef LOCORE guards to the new header around the structure so >> it can be used in assembly as well as C. > > Done. I have had to go into a few btx makefiles and add a necessary include > path and -DLOCORE to make the header usable from asm. > >> - Move BI_SIZE and ARGOFF into the header as constants. > > Done. > >> - Add a CTASSERT() in loader/main.c that BI_SIZE == sizeof(struct bootinfo) > > I have added a definition of CTASSERT to boostrap.h as it was not available for > sys/boot and there were two local definitions of the macro in individual files. > > However the assertion would fail right now. > The backward-compatible value of BI_SIZE (72 == 0x48) covers only part of the > fields in struct bootinfo, those up to the following comment: > /* Items below only from advanced bootloader */ > > I am a little bit hesitant: should I increase BI_SIZE to cover the whole struct > bootinfo or should I compare BI_SIZE to offsetof bi_kernend? > >> - Add a KA_SIZE for sizeof(struct kargs) with a CTASSERT. Use it in this >> instruction: > > Done. > >> + addl 0x1c(%esp),%ecx # Add size of variable args >> >> in place of the 0x1c > > Done. Plus some more. > >> - Don't add the new 'size' field to the end of the 'struct kargs'. Instead >> add a comment saying that if KARGS_FLAGS_EXT is set, then a structure will >> be present at (kargs + 1) that has a int size as its first member. > > Done. > >> Maybe >> create a 'struct kargs_ext' that looks like this: >> >> struct kargs_ext { >> uint32_t size; >> char data[0]; >> }; > > I've decided to skip on this. > >> - Use 'zargs = (struct zfs_boot_args)(kargs + 1)' in loader/main.c. >> - Change the ARGADJ line in btxcsu to be this: >> >> .set ARGADJ,0x1000 - ARGOFF > > I've decided to define ARGADJ in the new common header, then I've had to rename > btxcsu.s to .S, so that the preprocessing is executed for it. > >> - If you are adventurous, you could even add a new constant ARGSPACE or some >> such with an appropriate comment in the new header that you use to replace >> the 0x1000 in btx.S and in the definition of ARGADJ. > > Done. > >> Hope that isn't too much, but I do think this will help make things even more >> understandable. >> > > I will send the new patch shortly. > -- Andriy Gapon