* grub-core/disk/loopback.c: Use sequential IDs rather than pointer.

In case of quick removal of loopback and adding another one it may
	get same ID, confusing the cache system.
This commit is contained in:
Vladimir Serbinenko 2013-12-15 14:31:21 +01:00
parent ed55931073
commit 8ae6704517
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2013-12-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/loopback.c: Use sequential IDs rather than pointer.
In case of quick removal of loopback and adding another one it may
get same ID, confusing the cache system.
2013-12-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/acpi.c: Use grub_addr_t rather than long when

View File

@ -32,9 +32,11 @@ struct grub_loopback
char *devname;
grub_file_t file;
struct grub_loopback *next;
unsigned long id;
};
static struct grub_loopback *loopback_list;
static unsigned long last_id = 0;
static const struct grub_arg_option options[] =
{
@ -120,6 +122,7 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
}
newdev->file = file;
newdev->id = last_id++;
/* Add the new entry to the list. */
newdev->next = loopback_list;
@ -171,7 +174,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
disk->max_agglomerate = 1 << (29 - GRUB_DISK_SECTOR_BITS
- GRUB_DISK_CACHE_BITS);
disk->id = (unsigned long) dev;
disk->id = dev->id;
disk->data = dev;