Exemplo n.º 1
0
errcode_t ea_refcount_fetch(ext2_refcount_t refcount, ea_key_t ea_key,
			    ea_value_t *ret)
{
	struct ea_refcount_el	*el;

	el = get_refcount_el(refcount, ea_key, 0);
	if (!el) {
		*ret = 0;
		return 0;
	}
	*ret = el->ea_value;
	return 0;
}
Exemplo n.º 2
0
errcode_t ea_refcount_store(ext2_refcount_t refcount, blk_t blk, int count)
{
	struct ea_refcount_el	*el;

	/*
	 * Get the refcount element
	 */
	el = get_refcount_el(refcount, blk, count ? 1 : 0);
	if (!el)
		return count ? EXT2_ET_NO_MEMORY : 0;
	el->ea_count = count;
	return 0;
}
Exemplo n.º 3
0
errcode_t ea_refcount_increment(ext2_refcount_t refcount, blk_t blk, int *ret)
{
	struct ea_refcount_el	*el;

	el = get_refcount_el(refcount, blk, 1);
	if (!el)
		return EXT2_ET_NO_MEMORY;
	el->ea_count++;

	if (ret)
		*ret = el->ea_count;
	return 0;
}
Exemplo n.º 4
0
errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk_t blk,
				int *ret)
{
	struct ea_refcount_el	*el;
	
	el = get_refcount_el(refcount, blk, 0);
	if (!el) {
		*ret = 0;
		return 0;
	}
	*ret = el->ea_count;
	return 0;
}
Exemplo n.º 5
0
errcode_t ea_refcount_store(ext2_refcount_t refcount, ea_key_t ea_key,
			    ea_value_t ea_value)
{
	struct ea_refcount_el	*el;

	/*
	 * Get the refcount element
	 */
	el = get_refcount_el(refcount, ea_key, ea_value ? 1 : 0);
	if (!el)
		return ea_value ? EXT2_ET_NO_MEMORY : 0;
	el->ea_value = ea_value;
	return 0;
}
Exemplo n.º 6
0
errcode_t ea_refcount_increment(ext2_refcount_t refcount, ea_key_t ea_key,
				ea_value_t *ret)
{
	struct ea_refcount_el	*el;

	el = get_refcount_el(refcount, ea_key, 1);
	if (!el)
		return EXT2_ET_NO_MEMORY;
	el->ea_value++;

	if (ret)
		*ret = el->ea_value;
	return 0;
}
Exemplo n.º 7
0
errcode_t ea_refcount_decrement(ext2_refcount_t refcount, blk_t blk, int *ret)
{
	struct ea_refcount_el	*el;

	el = get_refcount_el(refcount, blk, 0);
	if (!el || el->ea_count == 0)
		return EXT2_ET_INVALID_ARGUMENT;

	el->ea_count--;

	if (ret)
		*ret = el->ea_count;
	return 0;
}
Exemplo n.º 8
0
errcode_t ea_refcount_decrement(ext2_refcount_t refcount, ea_key_t ea_key,
				ea_value_t *ret)
{
	struct ea_refcount_el	*el;

	el = get_refcount_el(refcount, ea_key, 0);
	if (!el || el->ea_value == 0)
		return EXT2_ET_INVALID_ARGUMENT;

	el->ea_value--;

	if (ret)
		*ret = el->ea_value;
	return 0;
}