Beispiel #1
0
struct tmpfs_dirent *
tmpfs_dirent_get(struct tmpfs_mount *mp)
{

	if (!tmpfs_mem_incr(mp, sizeof(struct tmpfs_dirent))) {
		return NULL;
	}
	return pool_get(&tmpfs_dirent_pool, PR_WAITOK);
}
Beispiel #2
0
char *
tmpfs_strname_alloc(struct tmpfs_mount *mp, size_t len)
{
	const size_t sz = roundup2(len, TMPFS_NAME_QUANTUM);

	if (sz == 0 || sz > 1024 || !tmpfs_mem_incr(mp, sz))
		return NULL;

	return malloc(sz, M_TEMP, M_WAITOK); /* XXX */
}
Beispiel #3
0
char *
tmpfs_strname_alloc(struct tmpfs_mount *mp, size_t len)
{
	const size_t sz = roundup2(len, TMPFS_NAME_QUANTUM);

	KASSERT(sz > 0 && sz <= 1024);
	if (!tmpfs_mem_incr(mp, sz)) {
		return NULL;
	}
	return kmem_alloc(sz, KM_SLEEP);
}
Beispiel #4
0
char *
tmpfs_strname_alloc(struct tmpfs_mount *mp, size_t len)
{
	const size_t sz = roundup2(len, TMPFS_NAME_QUANTUM);

	KASSERT(sz > 0 && sz <= 1024);
	if (!tmpfs_mem_incr(mp, sz)) {
		return NULL;
	}
	return malloc(sz, M_TEMP, M_WAITOK); /* XXX */
}
struct tmpfs_node *
tmpfs_node_get(struct tmpfs_mount *mp)
{

	if (atomic_inc_uint_nv(&mp->tm_nodes_cnt) >= mp->tm_nodes_max) {
		atomic_dec_uint(&mp->tm_nodes_cnt);
		return NULL;
	}
	if (!tmpfs_mem_incr(mp, sizeof(struct tmpfs_node))) {
		return NULL;
	}
	return pool_get(&tmpfs_node_pool, PR_WAITOK);
}
Beispiel #6
0
struct tmpfs_node *
tmpfs_node_get(struct tmpfs_mount *mp)
{

	mp->tm_nodes_cnt++;
	if (mp->tm_nodes_cnt > mp->tm_nodes_max) {
		mp->tm_nodes_cnt--;
		return NULL;
	}
	if (!tmpfs_mem_incr(mp, sizeof(struct tmpfs_node))) {
		return NULL;
	}
	return pool_get(&tmpfs_node_pool, PR_WAITOK);
}