Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 272383
b: refs/heads/master
c: b238b8f
h: refs/heads/master
i:
  272381: fd9e64b
  272379: 1937a08
  272375: ddba396
  272367: 8f70469
  272351: 6c74da5
  272319: 0b3e45e
  272255: 3d87ada
  272127: f5e194b
  271871: ccf9a98
  271359: 475eba0
  270335: 472def9
v: v3
  • Loading branch information
Chen Gong authored and Tony Luck committed Oct 12, 2011
1 parent 2fef9c1 commit b59ddc0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: abd4d5587be911f63592537284dad78766d97d62
refs/heads/master: b238b8fa93353ab50c9a2b1e2fa47a0ab01c37cd
10 changes: 6 additions & 4 deletions trunk/drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ static int erst_open_pstore(struct pstore_info *psi);
static int erst_close_pstore(struct pstore_info *psi);
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
struct timespec *time, struct pstore_info *psi);
static u64 erst_writer(enum pstore_type_id type, unsigned int part,
static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part,
size_t size, struct pstore_info *psi);
static int erst_clearer(enum pstore_type_id type, u64 id,
struct pstore_info *psi);
Expand Down Expand Up @@ -1040,11 +1040,12 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
return (rc < 0) ? rc : (len - sizeof(*rcd));
}

static u64 erst_writer(enum pstore_type_id type, unsigned int part,
static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part,
size_t size, struct pstore_info *psi)
{
struct cper_pstore_record *rcd = (struct cper_pstore_record *)
(erst_info.buf - sizeof(*rcd));
int ret;

memset(rcd, 0, sizeof(*rcd));
memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE);
Expand Down Expand Up @@ -1079,9 +1080,10 @@ static u64 erst_writer(enum pstore_type_id type, unsigned int part,
}
rcd->sec_hdr.section_severity = CPER_SEV_FATAL;

erst_write(&rcd->hdr);
ret = erst_write(&rcd->hdr);
*id = rcd->hdr.record_id;

return rcd->hdr.record_id;
return ret;
}

static int erst_clearer(enum pstore_type_id type, u64 id,
Expand Down
17 changes: 9 additions & 8 deletions trunk/drivers/firmware/efivars.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,16 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
return 0;
}

static u64 efi_pstore_write(enum pstore_type_id type, unsigned int part,
size_t size, struct pstore_info *psi)
static int efi_pstore_write(enum pstore_type_id type, u64 *id,
unsigned int part, size_t size, struct pstore_info *psi)
{
char name[DUMP_NAME_LEN];
char stub_name[DUMP_NAME_LEN];
efi_char16_t efi_name[DUMP_NAME_LEN];
efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
struct efivars *efivars = psi->data;
struct efivar_entry *entry, *found = NULL;
int i;
int i, ret = 0;

sprintf(stub_name, "dump-type%u-%u-", type, part);
sprintf(name, "%s%lu", stub_name, get_seconds());
Expand Down Expand Up @@ -548,18 +548,19 @@ static u64 efi_pstore_write(enum pstore_type_id type, unsigned int part,
efivar_unregister(found);

if (size)
efivar_create_sysfs_entry(efivars,
ret = efivar_create_sysfs_entry(efivars,
utf16_strsize(efi_name,
DUMP_NAME_LEN * 2),
efi_name, &vendor);

return part;
*id = part;
return ret;
};

static int efi_pstore_erase(enum pstore_type_id type, u64 id,
struct pstore_info *psi)
{
efi_pstore_write(type, id, 0, psi);
efi_pstore_write(type, &id, (unsigned int)id, 0, psi);

return 0;
}
Expand All @@ -580,8 +581,8 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
return -1;
}

static u64 efi_pstore_write(enum pstore_type_id type, unsigned int part,
size_t size, struct pstore_info *psi)
static int efi_pstore_write(enum pstore_type_id type, u64 *id,
unsigned int part, size_t size, struct pstore_info *psi)
{
return 0;
}
Expand Down
11 changes: 6 additions & 5 deletions trunk/fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
unsigned long size, total = 0;
char *dst, *why;
u64 id;
int hsize;
int hsize, ret;
unsigned int part = 1;
unsigned long flags = 0;
int is_locked = 0;
Expand Down Expand Up @@ -122,9 +122,9 @@ static void pstore_dump(struct kmsg_dumper *dumper,
memcpy(dst, s1 + s1_start, l1_cpy);
memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);

id = psinfo->write(PSTORE_TYPE_DMESG, part,
ret = psinfo->write(PSTORE_TYPE_DMESG, &id, part,
hsize + l1_cpy + l2_cpy, psinfo);
if (reason == KMSG_DUMP_OOPS && pstore_is_mounted())
if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
pstore_new_entry = 1;
l1 -= l1_cpy;
l2 -= l2_cpy;
Expand Down Expand Up @@ -247,6 +247,7 @@ static void pstore_timefunc(unsigned long dummy)
int pstore_write(enum pstore_type_id type, char *buf, size_t size)
{
u64 id;
int ret;
unsigned long flags;

if (!psinfo)
Expand All @@ -257,8 +258,8 @@ int pstore_write(enum pstore_type_id type, char *buf, size_t size)

spin_lock_irqsave(&psinfo->buf_lock, flags);
memcpy(psinfo->buf, buf, size);
id = psinfo->write(type, 0, size, psinfo);
if (pstore_is_mounted())
ret = psinfo->write(type, &id, 0, size, psinfo);
if (ret == 0 && pstore_is_mounted())
pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf,
size, CURRENT_TIME, psinfo);
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/pstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct pstore_info {
int (*close)(struct pstore_info *psi);
ssize_t (*read)(u64 *id, enum pstore_type_id *type,
struct timespec *time, struct pstore_info *psi);
u64 (*write)(enum pstore_type_id type, unsigned int part,
size_t size, struct pstore_info *psi);
int (*write)(enum pstore_type_id type, u64 *id,
unsigned int part, size_t size, struct pstore_info *psi);
int (*erase)(enum pstore_type_id type, u64 id,
struct pstore_info *psi);
void *data;
Expand Down

0 comments on commit b59ddc0

Please sign in to comment.