Re: [patch 1/3] efivars driver update and move
From: Matt Domsch
Date: Fri Apr 23 2004 - 22:44:52 EST
On Fri, Apr 23, 2004 at 05:29:45PM -0500, Matt Domsch wrote:
> Trying these against 2.6.5 + ia64 patch, with efibootmgr-0.5.2-test2.
>
> Works: reading, deleting values.
> Doesn't work: creating and editing values
>
> I note that efibootmgr prints out a warning when it can't read
> nonexistant variables, like BootNext. I'll remove that warning.
>
> It's likely a bug in efibootmgr, as this is the first time I've tried
> the sysfs side of things. If you're in a position to help debug, I'd
> appreciate it.
In fact, it *was* a bug in efibootmgr. Here's the patch to fix it...
There's also a bug in efivars.c:efivar_delete(), this one-liner should fix it.
--- linux-2.6.5/drivers/firmware/efivars.c 2004-04-24 06:58:08.000000000 -0400
+++ linux-2.6.5.mld/drivers/firmware/efivars.c 2004-04-24 12:09:28.099545422 -0400
@@ -532,7 +532,7 @@ efivar_delete(struct subsystem *sub, con
efivar_unregister(search_efivar);
/* It's dead Jim.... */
- return status;
+ return size;
}
--
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
diff -urNp --exclude='*~' efibootmgr-0.5.0-test2.orig/src/lib/efi.c efibootmgr-0.5.0-test2/src/lib/efi.c
--- efibootmgr-0.5.0-test2.orig/src/lib/efi.c 2003-09-07 00:24:18.000000000 -0400
+++ efibootmgr-0.5.0-test2/src/lib/efi.c 2004-04-24 12:15:25.375908233 -0400
@@ -166,7 +166,7 @@ create_or_edit_variable(efi_variable_t *
memcpy(&testvar, var, sizeof(*var));
variable_to_name(var, name);
- if (read_variable(name, &testvar))
+ if (read_variable(name, &testvar) == EFI_SUCCESS)
return edit_variable(var);
else
return create_variable(var);
diff -urNp --exclude='*~' efibootmgr-0.5.0-test2.orig/src/lib/efivars_sysfs.c efibootmgr-0.5.0-test2/src/lib/efivars_sysfs.c
--- efibootmgr-0.5.0-test2.orig/src/lib/efivars_sysfs.c 2003-09-07 00:21:37.000000000 -0400
+++ efibootmgr-0.5.0-test2/src/lib/efivars_sysfs.c 2004-04-24 12:35:38.207924626 -0400
@@ -49,8 +49,6 @@ sysfs_read_variable(const char *name, ef
snprintf(filename, PATH_MAX-1, "%s/%s/raw_var", SYSFS_DIR_EFI_VARS,name);
fd = open(filename, O_RDONLY);
if (fd == -1) {
- sprintf(buffer, "sysfs_read_variable():open(%s)", filename);
- perror(buffer);
return EFI_NOT_FOUND;
}
readsize = read(fd, var, sizeof(*var));
@@ -74,8 +72,6 @@ sysfs_write_variable(const char *filenam
fd = open(filename, O_WRONLY);
if (fd == -1) {
- sprintf(buffer, "sysfs_write_variable():open(%s)", filename);
- perror(buffer);
return EFI_INVALID_PARAMETER;
}
writesize = write(fd, var, sizeof(*var));
Attachment:
pgp00000.pgp
Description: PGP signature