[PATCH 08/10] fs: efivar: don't store attributes in file
Lucas Stach
l.stach at pengutronix.de
Tue Nov 4 01:42:54 PST 2014
We don't have a use-case yet where we need to manipulate
the attributes of a variable and it confuses "normal"
users of the variables.
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
fs/efivarfs.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index a36020d2d08e..f54925133848 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -131,6 +131,7 @@ struct efivars_file {
unsigned long size;
efi_guid_t vendor;
s16 *name;
+ u32 attributes;
};
static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
@@ -138,7 +139,6 @@ static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
struct efivars_file *efile;
efi_status_t efiret;
int ret;
- uint32_t attributes;
efile = xzalloc(sizeof(*efile));
@@ -146,28 +146,27 @@ static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
if (ret)
return -ENOENT;
- efiret = RT->get_variable(efile->name, &efile->vendor, &attributes, &efile->size, NULL);
+ efiret = RT->get_variable(efile->name, &efile->vendor,
+ &efile->attributes, &efile->size, NULL);
if (EFI_ERROR(efiret) && efiret != EFI_BUFFER_TOO_SMALL) {
ret = -efi_errno(efiret);
goto out;
}
- efile->buf = malloc(efile->size + sizeof(uint32_t));
+ efile->buf = malloc(efile->size);
if (!efile->buf) {
ret = -ENOMEM;
goto out;
}
efiret = RT->get_variable(efile->name, &efile->vendor, NULL, &efile->size,
- efile->buf + sizeof(uint32_t));
+ efile->buf);
if (EFI_ERROR(efiret)) {
ret = -efi_errno(efiret);
goto out;
}
- *(uint32_t *)efile->buf = attributes;
-
- f->size = efile->size + sizeof(uint32_t);
+ f->size = efile->size;
f->inode = efile;
return 0;
--
2.1.1
More information about the barebox
mailing list