Skip to content

Commit

Permalink
powerpc/nvram: Add nvram_find_partition()
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Benjamin Herrenschmidt committed Nov 30, 2010
1 parent fa2b4e5 commit cf5cbf9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions arch/powerpc/kernel/nvram_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,28 @@ static int nvram_get_partition_size(loff_t data_index)
}


/**
* nvram_find_partition - Find an nvram partition by signature and name
* @name: Name of the partition or NULL for any name
* @sig: Signature to test against
* @out_size: if non-NULL, returns the size of the data part of the partition
*/
loff_t nvram_find_partition(const char *name, int sig, int *out_size)
{
struct nvram_partition *p;

list_for_each_entry(p, &nvram_part->partition, partition) {
if (p->header.signature == sig &&
(!name || !strncmp(p->header.name, name, 12))) {
if (out_size)
*out_size = (p->header.length - 1) *
NVRAM_BLOCK_LEN;
return p->index + NVRAM_HEADER_LEN;
}
}
return 0;
}

/* nvram_setup_partition
*
* This will setup the partition we need for buffering the
Expand Down

0 comments on commit cf5cbf9

Please sign in to comment.