All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Domsch <Matt_Domsch@dell.com>
To: Matt Tolentino <metolent@snoqualmie.dp.intel.com>
Cc: akpm@osdl.org, bjorn.helgaas@hp.com, linux-ia64@vger.kernel.org,
	linux-kernel@vger.kernel.org, matthew.e.tolentino@intel.com
Subject: Re: [patch 1/3] efivars driver update and move
Date: Sat, 24 Apr 2004 03:41:09 +0000	[thread overview]
Message-ID: <20040424034109.GA15589@lists.us.dell.com> (raw)
In-Reply-To: <20040423222945.GA9594@lists.us.dell.com>

[-- Attachment #1: Type: text/plain, Size: 2734 bytes --]

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 #2: Type: application/pgp-signature, Size: 189 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Matt Domsch <Matt_Domsch@dell.com>
To: Matt Tolentino <metolent@snoqualmie.dp.intel.com>
Cc: akpm@osdl.org, bjorn.helgaas@hp.com, linux-ia64@vger.kernel.org,
	linux-kernel@vger.kernel.org, matthew.e.tolentino@intel.com
Subject: Re: [patch 1/3] efivars driver update and move
Date: Fri, 23 Apr 2004 22:41:09 -0500	[thread overview]
Message-ID: <20040424034109.GA15589@lists.us.dell.com> (raw)
In-Reply-To: <20040423222945.GA9594@lists.us.dell.com>

[-- Attachment #1: Type: text/plain, Size: 2734 bytes --]

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 #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-04-24  3:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-22 15:51 [patch 1/3] efivars driver update and move Matt Tolentino
2004-04-22 17:32 ` Matt Tolentino
2004-04-22 16:46 ` Bjorn Helgaas
2004-04-22 16:46   ` Bjorn Helgaas
2004-04-22 17:14 ` Tolentino, Matthew E
2004-04-22 17:14   ` Tolentino, Matthew E
2004-04-22 17:20   ` Bjorn Helgaas
2004-04-22 17:20     ` Bjorn Helgaas
2004-04-29 19:50   ` Alex Williamson
2004-04-29 19:50     ` Alex Williamson
2004-04-29 21:19     ` Matt Domsch
2004-04-29 21:19       ` Matt Domsch
2004-04-29 22:08       ` Alex Williamson
2004-04-29 22:08         ` Alex Williamson
2004-04-23 22:29 ` Matt Domsch
2004-04-23 22:29   ` Matt Domsch
2004-04-24  3:41   ` Matt Domsch [this message]
2004-04-24  3:41     ` Matt Domsch
2004-04-26 18:57     ` Matt Domsch
2004-04-26 18:57       ` Matt Domsch
2004-04-26 19:30 ` Matt Tolentino
2004-04-26 21:15   ` Matt Tolentino
2004-04-30  0:09 ` Matt Tolentino
2004-04-30  1:55   ` Matt Tolentino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040424034109.GA15589@lists.us.dell.com \
    --to=matt_domsch@dell.com \
    --cc=akpm@osdl.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.e.tolentino@intel.com \
    --cc=metolent@snoqualmie.dp.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.