[PATCH 05/11] powerpc/nvram: Completely clear a new partition

Michael Ellerman michael at ellerman.id.au
Mon Aug 2 13:50:37 EST 2010


On Mon, 2010-08-02 at 10:55 +1000, Benjamin Herrenschmidt wrote:
> When creating a partition, we clear it entirely rather than
> just the first two words since the previous code was rather
> specific to the pseries log partition format.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> ---
>  arch/powerpc/kernel/nvram_64.c |   19 ++++++++++---------
>  1 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
> index dd18a5a..7ddeaa6 100644
> --- a/arch/powerpc/kernel/nvram_64.c
> +++ b/arch/powerpc/kernel/nvram_64.c
> @@ -320,7 +320,7 @@ static int __init nvram_create_partition(const char *name, int sig,
>  	struct nvram_partition *part;
>  	struct nvram_partition *new_part;
>  	struct nvram_partition *free_part = NULL;
> -	int seq_init[2] = { 0, 0 };
> +	static char nv_init_vals[16];

Or should we just grab a zeroed page?

>  	loff_t tmp_index;
>  	long size = 0;
>  	int rc;
> @@ -379,14 +379,15 @@ static int __init nvram_create_partition(const char *name, int sig,
>  		return rc;
>  	}
>  
> -	/* make sure and initialize to zero the sequence number and the error
> -	   type logged */
> -	tmp_index = new_part->index + NVRAM_HEADER_LEN;
> -	rc = ppc_md.nvram_write((char *)&seq_init, sizeof(seq_init), &tmp_index);
> -	if (rc <= 0) {
> -		printk(KERN_ERR "nvram_create_os_partition: nvram_write "
> -		       "failed (%d)\n", rc);
> -		return rc;
> +	/* Clear the partition */
> +	for (tmp_index = new_part->index + NVRAM_HEADER_LEN;
> +	     tmp_index <  ((size - 1) * NVRAM_BLOCK_LEN);
                          ^
Extra whitespace          |

cheers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100802/2831eb25/attachment.pgp>


More information about the Linuxppc-dev mailing list