disk/fs_uuid.c
PATCH 1/1 disk/fs_uuid.c
This disk driver allows access to partitions that contain a filesystem with known UUID via "(UUID=xxxxxxx)" syntax.
The iterator is unimplemented on purpose, because it makes the code smaller and it isn't useful to waste time inspecting the same devices twice while scanning for LVM / whatsoever.
Also note that as it currently stands it is highly inefficient. I can't understand why; new UUIDs are searched everytime on each open() call, but this shouldn't be much of an issue since we have a disk cache in kernel to make that efficient. At least, it isn't e.g. for grub_fs_probe() which is called multiple times.
Even with this efficiency problem, since it doesn't interfere with anything else I'm inclined to commit it, if nobody objects.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What good is a phone call… if you are unable to speak? (as seen on /.)
2008-06-06 Robert Millan <[email protected]>
* disk/fs_uuid.c: New file.
* conf/common.rmk (pkglib_MODULES): Add `fs_uuid.mod'. (fs_uuid_mod_SOURCES, fs_uuid_mod_CFLAGS) (fs_uuid_mod_LDFLAGS): New variables.
* include/grub/disk.h (grub_disk_dev_id): Add `GRUB_DISK_DEVICE_UUID_ID'.
* kern/disk.c (grub_disk_dev_iterate): Allow disk devices not to implement iterate().
conf/common.rmk renamed from grub2/conf/common.rmk +6 -1
@@ -280,7 +280,7 @@ lvm_mod_LDFLAGS = $(COMMON_LDFLAGS) # Commands. pkglib_MODULES += hello.mod boot.mod terminal.mod ls.mod \ cmp.mod cat.mod help.mod font.mod search.mod \ - loopback.mod configfile.mod echo.mod \ + loopback.mod fs_uuid.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ read.mod sleep.mod
@@ -344,6 +344,11 @@ loopback_mod_SOURCES = disk/loopback.c loopback_mod_CFLAGS = $(COMMON_CFLAGS) loopback_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For fs_uuid.mod +fs_uuid_mod_SOURCES = disk/fs_uuid.c +fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS) +fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For configfile.mod configfile_mod_SOURCES = commands/configfile.c configfile_mod_CFLAGS = $(COMMON_CFLAGS)
disk/fs_uuid.c renamed from grub2/disk/fs_uuid.c +137 -0
137 lines not on this page · raw message
include/grub/disk.h renamed from grub2/include/grub/disk.h +1 -0
@@ -38,6 +38,7 @@ enum grub_disk_dev_idGRUB_DISK_DEVICE_ATA_ID ,GRUB_DISK_DEVICE_MEMDISK_ID ,GRUB_DISK_DEVICE_NAND_ID , + GRUB_DISK_DEVICE_UUID_ID, };struct grub_disk ;
kern/disk.c renamed from grub2/kern/disk.c +1 -1
@@ -202,7 +202,7 @@ grub_disk_dev_iterate (int (*hook) (consgrub_disk_dev_t p;for (p = grub_disk_dev_list; p; p = p->next) -if ((p->iterate) (hook)) +if (p->iterate && (p->iterate) (hook))return 1 ;return 0 ;
Quoted 3 lines · Robert Millan
Even with this efficiency problem, since it doesn't interfere with anything else I'm inclined to commit it, if nobody objects.
Committed.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What good is a phone call… if you are unable to speak? (as seen on /.)
Quoted 7 lines · Robert Millan
This disk driver allows access to partitions that contain a filesystem with known UUID via "(UUID=xxxxxxx)" syntax.
The iterator is unimplemented on purpose, because it makes the code smaller and it isn't useful to waste time inspecting the same devices twice while scanning for LVM / whatsoever.
Quoted 8 lines
Also note that as it currently stands it is highly inefficient. I can't understand why; new UUIDs are searched everytime on each
open()call, but this shouldn't be much of an issue since we have a disk cache in kernel to make that efficient. At least, it isn't e.g. forgrub_fs_probe()which is called multiple times.Even with this efficiency problem, since it doesn't interfere with anything else I'm inclined to commit it, if nobody objects.
Why didn't you just extend the search command? I think that would be favorable.
--
Marco
Quoted 15 lines · Marco Gerards
Quoted 13 lines · Robert Millan
This disk driver allows access to partitions that contain a filesystem with known UUID via "(UUID=xxxxxxx)" syntax.
The iterator is unimplemented on purpose, because it makes the code smaller and it isn't useful to waste time inspecting the same devices twice while scanning for LVM / whatsoever.
Also note that as it currently stands it is highly inefficient. I can't understand why; new UUIDs are searched everytime on each
open()call, but this shouldn't be much of an issue since we have a disk cache in kernel to make that efficient. At least, it isn't e.g. forgrub_fs_probe()which is called multiple times.
Quoted 5 lines
Quoted 2 lines
Even with this efficiency problem, since it doesn't interfere with anything else I'm inclined to commit it, if nobody objects.
Why didn't you just extend the search command? I think that would be favorable.
I _did_ extend the search command (before this patch). The reason for providing this is basicaly that it makes grub.cfg more readable (and easier to understand), and can't be used outside the context of scripting (for example, to set your root/prefix to it, but that would require a patch I intend to put together soon).
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What good is a phone call… if you are unable to speak? (as seen on /.)
Quoted 6 lines · Robert Millan
I _did_ extend the search command (before this patch). The reason for providing this is basicaly that it makes grub.cfg more readable (and easier to understand), and can't be used outside the context of scripting (for example, to set your root/prefix to it, but that would require a patch I intend to put together soon).
Basicaly like this; but it'd have to check that UUID is needed rather than using it unconditionaly, of course.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What good is a phone call… if you are unable to speak? (as seen on /.)
grub/i386/pc/kernel.h +1 -1
@@ -41,7 +41,7 @@#define GRUB_KERNEL_MACHINE_PREFIX 0x20/* End of the data section. */ -#define GRUB_KERNEL_MACHINE_DATA_END 0x50 +#define GRUB_KERNEL_MACHINE_DATA_END 0x60/* The size of the first region which won't be compressed. */ #define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x450)
i386/pc/grub-install.in +2 -2
@@ -232,13 +232,13 @@ devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}` if [ "x${devabstraction_module}" = "x" ] ; then - prefix_drive= + prefix_drive=\(UUID=`$grub_probe --target=fs_uuid --device ${grub_device}`\) else prefix_drive=`$grub_probe --target=drive --device ${grub_device}` fi # The order in this list is critical. Be careful when modifiing it. -modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module" +modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module fs_uuid" $grub_mkimage --output=${grubdir}/core.img \ --prefix=${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`/ \