Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#include "bhnd_nvram_private.h" | #include "bhnd_nvram_private.h" | ||||
#include "bhnd_nvram_datavar.h" | #include "bhnd_nvram_datavar.h" | ||||
#include "bhnd_nvram_storevar.h" | #include "bhnd_nvram_storevar.h" | ||||
static int bhnd_nvstore_idx_cmp(void *ctx, | static int bhnd_nvstore_idx_cmp(const void *lhs, const void *rhs, void *ctx); | ||||
const void *lhs, const void *rhs); | |||||
/** | /** | ||||
* Allocate and initialize a new path instance. | * Allocate and initialize a new path instance. | ||||
* | * | ||||
* The caller is responsible for deallocating the instance via | * The caller is responsible for deallocating the instance via | ||||
* bhnd_nvstore_path_free(). | * bhnd_nvstore_path_free(). | ||||
* | * | ||||
* @param path_str The path's canonical string representation. | * @param path_str The path's canonical string representation. | ||||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | bhnd_nvstore_index_append(struct bhnd_nvram_store *sc, | ||||
index->cookiep[index->count] = cookiep; | index->cookiep[index->count] = cookiep; | ||||
index->count++; | index->count++; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* sort function for bhnd_nvstore_index_prepare() */ | /* sort function for bhnd_nvstore_index_prepare() */ | ||||
static int | static int | ||||
bhnd_nvstore_idx_cmp(void *ctx, const void *lhs, const void *rhs) | bhnd_nvstore_idx_cmp(const void *lhs, const void *rhs, void *ctx) | ||||
{ | { | ||||
struct bhnd_nvram_store *sc; | struct bhnd_nvram_store *sc; | ||||
void *l_cookiep, *r_cookiep; | void *l_cookiep, *r_cookiep; | ||||
const char *l_str, *r_str; | const char *l_str, *r_str; | ||||
const char *l_name, *r_name; | const char *l_name, *r_name; | ||||
int order; | int order; | ||||
sc = ctx; | sc = ctx; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
bhnd_nvstore_index_prepare(struct bhnd_nvram_store *sc, | bhnd_nvstore_index_prepare(struct bhnd_nvram_store *sc, | ||||
bhnd_nvstore_index *index) | bhnd_nvstore_index *index) | ||||
{ | { | ||||
BHND_NVSTORE_LOCK_ASSERT(sc, MA_OWNED); | BHND_NVSTORE_LOCK_ASSERT(sc, MA_OWNED); | ||||
/* Sort the index table */ | /* Sort the index table */ | ||||
qsort_r(index->cookiep, index->count, sizeof(index->cookiep[0]), sc, | qsort_r(index->cookiep, index->count, sizeof(index->cookiep[0]), | ||||
bhnd_nvstore_idx_cmp); | bhnd_nvstore_idx_cmp, sc); | ||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* Return a borrowed reference to the root path node. | * Return a borrowed reference to the root path node. | ||||
* | * | ||||
* @param sc The NVRAM store. | * @param sc The NVRAM store. | ||||
▲ Show 20 Lines • Show All 911 Lines • Show Last 20 Lines |