Skip to content

Commit

Permalink
pstore/ram_core: Factor persistent_ram_zap() out of post_init()
Browse files Browse the repository at this point in the history
A handy function that we will use outside of ram_core soon. But
so far just factor it out and start using it in post_init().

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Anton Vorontsov authored and Greg Kroah-Hartman committed Jun 13, 2012
1 parent 25b63da commit fce3979
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/pstore/ram_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz)
prz->old_log_size = 0;
}

void persistent_ram_zap(struct persistent_ram_zone *prz)
{
atomic_set(&prz->buffer->start, 0);
atomic_set(&prz->buffer->size, 0);
persistent_ram_update_header_ecc(prz);
}

static void *persistent_ram_vmap(phys_addr_t start, size_t size)
{
struct page **pages;
Expand Down Expand Up @@ -414,8 +421,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
}

prz->buffer->sig = PERSISTENT_RAM_SIG;
atomic_set(&prz->buffer->start, 0);
atomic_set(&prz->buffer->size, 0);
persistent_ram_zap(prz);

return 0;
}
Expand Down Expand Up @@ -450,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
goto err;

persistent_ram_post_init(prz, ecc);
persistent_ram_update_header_ecc(prz);

return prz;
err:
Expand Down
1 change: 1 addition & 0 deletions include/linux/pstore_ram.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
size_t size,
bool ecc);
void persistent_ram_free(struct persistent_ram_zone *prz);
void persistent_ram_zap(struct persistent_ram_zone *prz);
struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
bool ecc);

Expand Down

0 comments on commit fce3979

Please sign in to comment.