diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-01 20:01:58 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-11-29 23:34:05 -0500 |
commit | cf5cbf9f8085eb45316d6e3c888a77cc50696701 (patch) | |
tree | 992a3ae5d78703bb67b660508fac204dd02243ce /arch/powerpc/kernel/nvram_64.c | |
parent | fa2b4e54d41f3c9f1bee6a7d63ecd4f0ab161e89 (diff) |
powerpc/nvram: Add nvram_find_partition()
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/nvram_64.c')
-rw-r--r-- | arch/powerpc/kernel/nvram_64.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c index 6dd2700852f0..01e6844be8d7 100644 --- a/arch/powerpc/kernel/nvram_64.c +++ b/arch/powerpc/kernel/nvram_64.c | |||
@@ -429,6 +429,28 @@ static int nvram_get_partition_size(loff_t data_index) | |||
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | /** | ||
433 | * nvram_find_partition - Find an nvram partition by signature and name | ||
434 | * @name: Name of the partition or NULL for any name | ||
435 | * @sig: Signature to test against | ||
436 | * @out_size: if non-NULL, returns the size of the data part of the partition | ||
437 | */ | ||
438 | loff_t nvram_find_partition(const char *name, int sig, int *out_size) | ||
439 | { | ||
440 | struct nvram_partition *p; | ||
441 | |||
442 | list_for_each_entry(p, &nvram_part->partition, partition) { | ||
443 | if (p->header.signature == sig && | ||
444 | (!name || !strncmp(p->header.name, name, 12))) { | ||
445 | if (out_size) | ||
446 | *out_size = (p->header.length - 1) * | ||
447 | NVRAM_BLOCK_LEN; | ||
448 | return p->index + NVRAM_HEADER_LEN; | ||
449 | } | ||
450 | } | ||
451 | return 0; | ||
452 | } | ||
453 | |||
432 | /* nvram_setup_partition | 454 | /* nvram_setup_partition |
433 | * | 455 | * |
434 | * This will setup the partition we need for buffering the | 456 | * This will setup the partition we need for buffering the |