Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 May 2012 12:31:22 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-fs@FreeBSD.org, freebsd-hackers@FreeBSD.org
Subject:   Re: [review request] zfsboot/zfsloader: support accessing filesystems within a pool
Message-ID:  <4FA4F36A.6030903@FreeBSD.org>
In-Reply-To: <201205041125.15155.jhb@freebsd.org>
References:  <4F8999D2.1080902@FreeBSD.org> <4FA29E1B.7040005@FreeBSD.org> <4FA2A307.2090108@FreeBSD.org> <201205041125.15155.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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!
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FA4F36A.6030903>