grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iterate return values


From: Marco Gerards
Subject: Re: iterate return values
Date: Sat, 22 Jan 2005 13:01:43 +0000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hollis Blanchard <address@hidden> writes:

> I'm having trouble seeing my Apple-partitioned disk with pc.mod
> loaded. The trouble seems to be a misunderstanding about how iterate
> methods should return.
>
> When a hook is passed to grub_partition_iterate, it is applied to
>  partmap->iterate. However, the partition map's iterate functions can
> return non-zero in case of error (such as "not a PC partition
> map"). Non-zero is then propagated back to grub_partition_map_iterate,
> and the iteration stops. In that case we should clearly keep going to
> try another partition map type.

Right.  Normally iterate functions in GRUB return 1 when the iteration
should stop.  For the iterate function of partition maps this is not
the case, but this is how grub_partition_iterate tries to work.  You
can even see the return type of grub_err_t is directory returned as
int, this is a bug.

> However, the other case is that the hook itself returned non-zero,
> indicating it wishes to stop the iteration. As far as I can see there
> is no way to distinguish this from the above case. Or are there
> actually any hooks that want to stop iteration? If not, the test in
> grub_partition_map_iterate can go. (But that doesn't seem to fix my
> problem either... sigh.)

Right.  I think grub_partition_iterate and the iterate functions for
the partition maps should be changed so they work like an iterate
function and return 0 or 1, the value returned by the hook.

I think it would be easier to add a function to the partition maps to
test if the disk has this kind of partition map.  This will make
things a lot easier and cleaner.

What do you think?

Thanks,
Marco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]