Lines Matching refs:db
385 static int db_verify(const struct os_area_db *db) in db_verify() argument
387 if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, in db_verify()
388 sizeof(db->magic_num))) { in db_verify()
393 if (db->version != 1) { in db_verify()
407 const struct os_area_db *db; member
430 static int db_for_each_64(const struct os_area_db *db, in db_for_each_64() argument
434 if (!i->db) { in db_for_each_64()
435 i->db = db; in db_for_each_64()
437 i->idx = (void *)db + db->index_64; in db_for_each_64()
438 i->last_idx = i->idx + db->count_64; in db_for_each_64()
439 i->value_64 = (void *)db + db->index_64 in db_for_each_64()
440 + db_align_up(db->count_64, 8); in db_for_each_64()
461 static int db_delete_64(struct os_area_db *db, const struct os_area_db_id *id) in db_delete_64() argument
465 for (i.db = NULL; db_for_each_64(db, id, &i); ) { in db_delete_64()
478 static int db_set_64(struct os_area_db *db, const struct os_area_db_id *id, in db_set_64() argument
493 db_delete_64(db, id); in db_set_64()
495 i.db = NULL; in db_set_64()
496 if (db_for_each_64(db, &os_area_db_id_empty, &i)) { in db_set_64()
516 static int db_get_64(const struct os_area_db *db, in db_get_64() argument
521 i.db = NULL; in db_get_64()
522 if (db_for_each_64(db, id, &i)) { in db_get_64()
532 static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff) in db_get_rtc_diff() argument
534 return db_get_64(db, &os_area_db_id_rtc_diff, (uint64_t*)rtc_diff); in db_get_rtc_diff()
538 static void _dump_db(const struct os_area_db *db, const char *func, in _dump_db() argument
541 char str[sizeof(db->magic_num) + 1]; in _dump_db()
543 dump_field(str, db->magic_num, sizeof(db->magic_num)); in _dump_db()
547 db->version); in _dump_db()
549 db->index_64); in _dump_db()
551 db->count_64); in _dump_db()
553 db->index_32); in _dump_db()
555 db->count_32); in _dump_db()
557 db->index_16); in _dump_db()
559 db->count_16); in _dump_db()
562 static void os_area_db_init(struct os_area_db *db) in os_area_db_init() argument
574 memset(db, 0, sizeof(struct os_area_db)); in os_area_db_init()
576 memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num)); in os_area_db_init()
577 db->version = 1; in os_area_db_init()
578 db->index_64 = HEADER_SIZE; in os_area_db_init()
579 db->count_64 = VALUES_64_COUNT; in os_area_db_init()
580 db->index_32 = HEADER_SIZE in os_area_db_init()
583 db->count_32 = VALUES_32_COUNT; in os_area_db_init()
584 db->index_16 = HEADER_SIZE in os_area_db_init()
589 db->count_16 = VALUES_16_COUNT; in os_area_db_init()
623 struct os_area_db* db; in update_flash_db() local
652 db = (void *)header + pos; in update_flash_db()
654 error = db_verify(db); in update_flash_db()
658 dump_db(db); in update_flash_db()
659 os_area_db_init(db); in update_flash_db()
664 db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff); in update_flash_db()
666 count = os_area_flash_write(db, sizeof(struct os_area_db), pos); in update_flash_db()
736 struct os_area_db *db; in ps3_os_area_save_params() local
761 db = (struct os_area_db *)__va(lpar_addr in ps3_os_area_save_params()
766 dump_db(db); in ps3_os_area_save_params()
768 result = db_verify(db) || db_get_rtc_diff(db, &saved_params.rtc_diff); in ps3_os_area_save_params()