linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efivarfs: Never return ENOENT from firmware again
@ 2013-05-10 10:29 Lingzhu Xiang
  2013-05-13 19:21 ` Matt Fleming
  0 siblings, 1 reply; 5+ messages in thread
From: Lingzhu Xiang @ 2013-05-10 10:29 UTC (permalink / raw)
  To: Matt Fleming, Jeremy Kerr, Matthew Garrett
  Cc: linux-efi, linux-kernel, Josh Boyer, Lee, Chun-Yi, Andy Whitcroft

Previously in 1fa7e69 efi_status_to_err() translated firmware status
EFI_NOT_FOUND to -EIO instead of -ENOENT for efivarfs operations to
avoid confusion. After refactoring in e14ab23, it is also used in other
places where the translation may be unnecessary.

So move the translation to efivarfs specific code. Also return EOF
for reading zero-length files, which is what users would expect.

Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Lee, Chun-Yi <jlee@suse.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Lingzhu Xiang <lxiang@redhat.com>
---
This is to be applied against mainline or Matt Fleming's chainsaw branch.

 fs/efivarfs/file.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c
index bfb5315..8dd524f 100644
--- a/fs/efivarfs/file.c
+++ b/fs/efivarfs/file.c
@@ -44,8 +44,11 @@ static ssize_t efivarfs_file_write(struct file *file,
 
 	bytes = efivar_entry_set_get_size(var, attributes, &datasize,
 					  data, &set);
-	if (!set && bytes)
+	if (!set && bytes) {
+		if (bytes == -ENOENT)
+			bytes = -EIO;
 		goto out;
+	}
 
 	if (bytes == -ENOENT) {
 		drop_nlink(inode);
@@ -76,7 +79,14 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
 	int err;
 
 	err = efivar_entry_size(var, &datasize);
-	if (err)
+
+	/*
+	 * efivarfs represents uncommitted variables with
+	 * zero-length files. Reading them should return EOF.
+	 */
+	if (err == -ENOENT)
+		return 0;
+	else if (err)
 		return err;
 
 	data = kmalloc(datasize + sizeof(attributes), GFP_KERNEL);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] efivarfs: Never return ENOENT from firmware again
  2013-05-10 10:29 [PATCH] efivarfs: Never return ENOENT from firmware again Lingzhu Xiang
@ 2013-05-13 19:21 ` Matt Fleming
  2013-05-14  4:36   ` joeyli
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Fleming @ 2013-05-13 19:21 UTC (permalink / raw)
  To: Lingzhu Xiang
  Cc: Jeremy Kerr, Matthew Garrett, linux-efi, linux-kernel,
	Josh Boyer, Lee, Chun-Yi, Andy Whitcroft

On 05/10/2013 11:29 AM, Lingzhu Xiang wrote:
> Previously in 1fa7e69 efi_status_to_err() translated firmware status
> EFI_NOT_FOUND to -EIO instead of -ENOENT for efivarfs operations to
> avoid confusion. After refactoring in e14ab23, it is also used in other
> places where the translation may be unnecessary.
> 
> So move the translation to efivarfs specific code. Also return EOF
> for reading zero-length files, which is what users would expect.
> 
> Cc: Josh Boyer <jwboyer@redhat.com>
> Cc: Jeremy Kerr <jk@ozlabs.org>
> Cc: Lee, Chun-Yi <jlee@suse.com>
> Cc: Andy Whitcroft <apw@canonical.com>
> Signed-off-by: Lingzhu Xiang <lxiang@redhat.com>
> ---
> This is to be applied against mainline or Matt Fleming's chainsaw branch.

Applied, thanks.

FYI, I rebased my 'urgent' branch on v3.10-rc1, so your patch now
applies there too.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efivarfs: Never return ENOENT from firmware again
  2013-05-13 19:21 ` Matt Fleming
@ 2013-05-14  4:36   ` joeyli
  2013-05-14  7:16     ` Matt Fleming
  0 siblings, 1 reply; 5+ messages in thread
From: joeyli @ 2013-05-14  4:36 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Lingzhu Xiang, Jeremy Kerr, Matthew Garrett, linux-efi,
	linux-kernel, Josh Boyer, Andy Whitcroft

Hi Matt, 

於 一,2013-05-13 於 20:21 +0100,Matt Fleming 提到:
> On 05/10/2013 11:29 AM, Lingzhu Xiang wrote:
> > Previously in 1fa7e69 efi_status_to_err() translated firmware status
> > EFI_NOT_FOUND to -EIO instead of -ENOENT for efivarfs operations to
> > avoid confusion. After refactoring in e14ab23, it is also used in other
> > places where the translation may be unnecessary.
> > 
> > So move the translation to efivarfs specific code. Also return EOF
> > for reading zero-length files, which is what users would expect.
> > 
> > Cc: Josh Boyer <jwboyer@redhat.com>
> > Cc: Jeremy Kerr <jk@ozlabs.org>
> > Cc: Lee, Chun-Yi <jlee@suse.com>
> > Cc: Andy Whitcroft <apw@canonical.com>
> > Signed-off-by: Lingzhu Xiang <lxiang@redhat.com>
> > ---
> > This is to be applied against mainline or Matt Fleming's chainsaw branch.
> 
> Applied, thanks.
> 
> FYI, I rebased my 'urgent' branch on v3.10-rc1, so your patch now
> applies there too.
> 
> 

I found the "[PATCH] x86, efi: initial the local variable of DataSize to
zero" lost in urgent branch, and it also didn't in Linus's v3.10-rc1.

Did this patch move to other branch?


Thanks a lot!
Joey Lee





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efivarfs: Never return ENOENT from firmware again
  2013-05-14  4:36   ` joeyli
@ 2013-05-14  7:16     ` Matt Fleming
  2013-05-14  8:32       ` joeyli
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Fleming @ 2013-05-14  7:16 UTC (permalink / raw)
  To: joeyli
  Cc: Lingzhu Xiang, Jeremy Kerr, Matthew Garrett, linux-efi,
	linux-kernel, Josh Boyer, Andy Whitcroft

On 05/14/2013 05:36 AM, joeyli wrote:
> I found the "[PATCH] x86, efi: initial the local variable of DataSize to
> zero" lost in urgent branch, and it also didn't in Linus's v3.10-rc1.
> 
> Did this patch move to other branch?

It appears I dropped this patch when doing the rebase against -rc1. I'm
really sorry about that. I've applied it again.

Thanks for being so diligent.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] efivarfs: Never return ENOENT from firmware again
  2013-05-14  7:16     ` Matt Fleming
@ 2013-05-14  8:32       ` joeyli
  0 siblings, 0 replies; 5+ messages in thread
From: joeyli @ 2013-05-14  8:32 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Lingzhu Xiang, Jeremy Kerr, Matthew Garrett, linux-efi,
	linux-kernel, Josh Boyer, Andy Whitcroft

於 二,2013-05-14 於 08:16 +0100,Matt Fleming 提到:
> On 05/14/2013 05:36 AM, joeyli wrote:
> > I found the "[PATCH] x86, efi: initial the local variable of DataSize to
> > zero" lost in urgent branch, and it also didn't in Linus's v3.10-rc1.
> > 
> > Did this patch move to other branch?
> 
> It appears I dropped this patch when doing the rebase against -rc1. I'm
> really sorry about that. I've applied it again.

Thanks for your help!

> 
> Thanks for being so diligent.
> --

That because I need apply this patch on v3.9 and v3.10 when debugging
issue on Acer machine.


Thank a lot!
Joey Lee


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-14  8:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 10:29 [PATCH] efivarfs: Never return ENOENT from firmware again Lingzhu Xiang
2013-05-13 19:21 ` Matt Fleming
2013-05-14  4:36   ` joeyli
2013-05-14  7:16     ` Matt Fleming
2013-05-14  8:32       ` joeyli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).