Prefix two non-static libmemstat(3) internal functions with '_' symbols, to
try and discourage use outside the library. Remove duplicate declaration of memstat_mtl_free() from memstat_internal.h, as it's not internal, and the memstat.h definition suffices.
This commit is contained in:
parent
8a1ae47f87
commit
ddefbc898a
@ -99,9 +99,11 @@ memstat_mtl_find(struct memory_type_list *list, int allocator,
|
||||
/*
|
||||
* Allocate a new memory_type with the specificed allocator type and name,
|
||||
* then insert into the list. The structure will be zero'd.
|
||||
*
|
||||
* libmemstat(3) internal function.
|
||||
*/
|
||||
struct memory_type *
|
||||
memstat_mt_allocate(struct memory_type_list *list, int allocator,
|
||||
_memstat_mt_allocate(struct memory_type_list *list, int allocator,
|
||||
const char *name)
|
||||
{
|
||||
struct memory_type *mtp;
|
||||
@ -122,9 +124,11 @@ memstat_mt_allocate(struct memory_type_list *list, int allocator,
|
||||
* Reset any libmemstat(3)-owned statistics in a memory_type record so that
|
||||
* it can be reused without incremental addition problems. Caller-owned
|
||||
* memory is left "as-is", and must be updated by the caller if desired.
|
||||
*
|
||||
* libmemstat(3) internal function.
|
||||
*/
|
||||
void
|
||||
memstat_mt_reset_stats(struct memory_type *mtp)
|
||||
_memstat_mt_reset_stats(struct memory_type *mtp)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -113,9 +113,8 @@ struct memory_type {
|
||||
*/
|
||||
LIST_HEAD(memory_type_list, memory_type);
|
||||
|
||||
void memstat_mtl_free(struct memory_type_list *list);
|
||||
struct memory_type *memstat_mt_allocate(struct memory_type_list *list,
|
||||
struct memory_type *_memstat_mt_allocate(struct memory_type_list *list,
|
||||
int allocator, const char *name);
|
||||
void memstat_mt_reset_stats(struct memory_type *mtp);
|
||||
void _memstat_mt_reset_stats(struct memory_type *mtp);
|
||||
|
||||
#endif /* !_MEMSTAT_INTERNAL_H_ */
|
||||
|
@ -174,15 +174,10 @@ memstat_sysctl_malloc(struct memory_type_list *list, int flags)
|
||||
if (hint_dontsearch == 0) {
|
||||
mtp = memstat_mtl_find(list, ALLOCATOR_MALLOC,
|
||||
mthp->mth_name);
|
||||
/*
|
||||
* Reset the statistics on a reused node.
|
||||
*/
|
||||
if (mtp != NULL)
|
||||
memstat_mt_reset_stats(mtp);
|
||||
} else
|
||||
mtp = NULL;
|
||||
if (mtp == NULL)
|
||||
mtp = memstat_mt_allocate(list, ALLOCATOR_MALLOC,
|
||||
mtp = _memstat_mt_allocate(list, ALLOCATOR_MALLOC,
|
||||
mthp->mth_name);
|
||||
if (mtp == NULL) {
|
||||
memstat_mtl_free(list);
|
||||
@ -196,7 +191,7 @@ memstat_sysctl_malloc(struct memory_type_list *list, int flags)
|
||||
/*
|
||||
* Reset the statistics on a current node.
|
||||
*/
|
||||
memstat_mt_reset_stats(mtp);
|
||||
_memstat_mt_reset_stats(mtp);
|
||||
|
||||
for (j = 0; j < maxcpus; j++) {
|
||||
mtsp = (struct malloc_type_stats *)p;
|
||||
|
@ -175,15 +175,10 @@ memstat_sysctl_uma(struct memory_type_list *list, int flags)
|
||||
if (hint_dontsearch == 0) {
|
||||
mtp = memstat_mtl_find(list, ALLOCATOR_UMA,
|
||||
uthp->uth_name);
|
||||
/*
|
||||
* Reset the statistics on a reused node.
|
||||
*/
|
||||
if (mtp != NULL)
|
||||
memstat_mt_reset_stats(mtp);
|
||||
} else
|
||||
mtp = NULL;
|
||||
if (mtp == NULL)
|
||||
mtp = memstat_mt_allocate(list, ALLOCATOR_UMA,
|
||||
mtp = _memstat_mt_allocate(list, ALLOCATOR_UMA,
|
||||
uthp->uth_name);
|
||||
if (mtp == NULL) {
|
||||
memstat_mtl_free(list);
|
||||
@ -197,7 +192,7 @@ memstat_sysctl_uma(struct memory_type_list *list, int flags)
|
||||
/*
|
||||
* Reset the statistics on a current node.
|
||||
*/
|
||||
memstat_mt_reset_stats(mtp);
|
||||
_memstat_mt_reset_stats(mtp);
|
||||
|
||||
mtp->mt_numallocs = uthp->uth_allocs;
|
||||
mtp->mt_numfrees = uthp->uth_frees;
|
||||
|
Loading…
Reference in New Issue
Block a user