[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: partition map reorganization
From: |
Hollis Blanchard |
Subject: |
Re: partition map reorganization |
Date: |
Tue, 2 Nov 2004 09:10:39 -0600 |
On Nov 2, 2004, at 12:56 AM, Tomas Ebenlendr wrote:
I have just two questions. (I didn't see the code for a long time, so
I'm sory if I misunderstand something.)
struct grub_partition_ops {
grub_err_t (*iterate) (struct grub_disk *disk,
int (*hook) (const grub_partition_t
partition));
grub_partition_t (*probe) (struct grub_disk *disk, const char *str);
char * (*get_name) (const grub_partition_t p);
};
Impact to existing code can be minimized with wrappers like this:
static inline char *
grub_partition_get_name (const grub_partition_t p)
{
return p->disk->ops->get_name (p);
}
Do you want partition ops to be member of disk structure?
Yes. A disk has a particular partition map format.
struct grub_partition {
unsigned long start;
unsigned long len;
unsigned int index;
struct grub_disk_t disk;
};
Umm, what about 'type' field? (To be sure that some generic partition
is
the dos one.)
I don't understand what you mean, can you provide an example of how it
would be used by arch-neutral code? If you're thinking of something
like this:
switch (p->type) {
case DOS_PARTITION:
name = dos_get_name(p);
break;
case APPLE_PARTITION:
name = apple_get_name(p);
break;
}
... then that is much better handled by calling through the disk->ops
function pointers:
name = grub_partition_get_name(p);
Also consider that an Apple partition map entry has a 32-character
"type" field. How would you represent that as an integer (which I think
is what you're requesting)?
-Hollis