Lines Matching full:part

180 int nvram_write_os_partition(struct nvram_os_partition *part,  in nvram_write_os_partition()  argument
189 if (part->index == -1) in nvram_write_os_partition()
192 if (length > part->size) in nvram_write_os_partition()
193 length = part->size; in nvram_write_os_partition()
198 tmp_index = part->index; in nvram_write_os_partition()
219 int nvram_read_partition(struct nvram_os_partition *part, char *buff, in nvram_read_partition() argument
227 if (part->index == -1) in nvram_read_partition()
230 if (length > part->size) in nvram_read_partition()
231 length = part->size; in nvram_read_partition()
233 tmp_index = part->index; in nvram_read_partition()
235 if (part->os_partition) { in nvram_read_partition()
249 if (part->os_partition) { in nvram_read_partition()
274 int __init nvram_init_os_partition(struct nvram_os_partition *part) in nvram_init_os_partition() argument
280 p = nvram_find_partition(part->name, NVRAM_SIG_OS, &size); in nvram_init_os_partition()
283 if (p && size < part->min_size) { in nvram_init_os_partition()
285 " removing it...\n", part->name); in nvram_init_os_partition()
286 nvram_remove_partition(part->name, NVRAM_SIG_OS, NULL); in nvram_init_os_partition()
292 p = nvram_create_partition(part->name, NVRAM_SIG_OS, in nvram_init_os_partition()
293 part->req_size, part->min_size); in nvram_init_os_partition()
297 part->name); in nvram_init_os_partition()
300 p = nvram_create_partition(part->name, NVRAM_SIG_OS, in nvram_init_os_partition()
301 part->req_size, part->min_size); in nvram_init_os_partition()
307 " partition, err %d\n", part->name, (int)p); in nvram_init_os_partition()
311 part->index = p; in nvram_init_os_partition()
312 part->size = nvram_get_partition_size(p) - sizeof(struct err_log_info); in nvram_init_os_partition()
391 /* part 1 has the recent messages from printk buffer */ in nvram_pstore_write()
392 if (record->part > 1 || (record->type != PSTORE_TYPE_DMESG)) in nvram_pstore_write()
412 record->id = record->part; in nvram_pstore_write()
425 struct nvram_os_partition *part = NULL; in nvram_pstore_read() local
434 part = &oops_log_partition; in nvram_pstore_read()
439 part = &common_partition; in nvram_pstore_read()
447 part = &rtas_log_partition; in nvram_pstore_read()
454 part = &of_config_partition; in nvram_pstore_read()
464 part = &skiboot_partition; in nvram_pstore_read()
475 if (!part->os_partition) { in nvram_pstore_read()
476 p = nvram_find_partition(part->name, sig, &size); in nvram_pstore_read()
479 "err %d\n", part->name, (int)p); in nvram_pstore_read()
482 part->index = p; in nvram_pstore_read()
483 part->size = size; in nvram_pstore_read()
486 buff = kmalloc(part->size, GFP_KERNEL); in nvram_pstore_read()
491 if (nvram_read_partition(part, buff, part->size, &err_type, &id_no)) { in nvram_pstore_read()
498 if (part->os_partition) in nvram_pstore_read()
531 return part->size; in nvram_pstore_read()
724 static int __init nvram_write_header(struct nvram_partition * part) in nvram_write_header() argument
730 memcpy(&phead, &part->header, NVRAM_HEADER_LEN); in nvram_write_header()
733 tmp_index = part->index; in nvram_write_header()
758 static int __init nvram_can_remove_partition(struct nvram_partition *part, in nvram_can_remove_partition() argument
761 if (part->header.signature != sig) in nvram_can_remove_partition()
764 if (strncmp(name, part->header.name, 12)) in nvram_can_remove_partition()
769 if (!strncmp(*except, part->header.name, 12)) in nvram_can_remove_partition()
788 struct nvram_partition *part, *prev, *tmp; in nvram_remove_partition() local
791 list_for_each_entry(part, &nvram_partitions, partition) { in nvram_remove_partition()
792 if (!nvram_can_remove_partition(part, name, sig, exceptions)) in nvram_remove_partition()
796 part->header.signature = NVRAM_SIG_FREE; in nvram_remove_partition()
797 memset(part->header.name, 'w', 12); in nvram_remove_partition()
798 part->header.checksum = nvram_checksum(&part->header); in nvram_remove_partition()
799 rc = nvram_write_header(part); in nvram_remove_partition()
808 list_for_each_entry_safe(part, tmp, &nvram_partitions, partition) { in nvram_remove_partition()
809 if (part->header.signature != NVRAM_SIG_FREE) { in nvram_remove_partition()
814 prev->header.length += part->header.length; in nvram_remove_partition()
821 list_del(&part->partition); in nvram_remove_partition()
822 kfree(part); in nvram_remove_partition()
824 prev = part; in nvram_remove_partition()
846 struct nvram_partition *part; in nvram_create_partition() local
874 list_for_each_entry(part, &nvram_partitions, partition) { in nvram_create_partition()
875 if (part->header.signature != NVRAM_SIG_FREE) in nvram_create_partition()
878 if (part->header.length >= req_size) { in nvram_create_partition()
880 free_part = part; in nvram_create_partition()
883 if (part->header.length > size && in nvram_create_partition()
884 part->header.length >= min_size) { in nvram_create_partition()
885 size = part->header.length; in nvram_create_partition()
886 free_part = part; in nvram_create_partition()
952 struct nvram_partition *part; in nvram_get_partition_size() local
954 list_for_each_entry(part, &nvram_partitions, partition) { in nvram_get_partition_size()
955 if (part->index + NVRAM_HEADER_LEN == data_index) in nvram_get_partition_size()
956 return (part->header.length - 1) * NVRAM_BLOCK_LEN; in nvram_get_partition_size()
966 * @out_size: if non-NULL, returns the size of the data part of the partition