/* This function returns %1 if @offs was in the last write to the LEB whose data is in @buf, otherwise %0 is returned. The determination is made by checking for subsequent empty space starting from the next min_io_size boundary (or a bit less than the common header size if min_io_size is one).  */
static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
/* This function returns %1 if @offs was in the last write to the LEB whose data is in @buf, otherwise %0 is returned. The determination is made by checking for subsequent empty space starting from the next min_io_size boundary (or a bit less than the common header size if min_io_size is one).  */
static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
{
	int empty_offs;
	int check_len;
	uint8_t *p;
	if (c->min_io_size == 1) {
		check_len = c->leb_size - offs;
		p = buf + check_len;
		for (; check_len > 0; check_len--)
			if (*--p != 0xff)
				break;
		if (check_len > UBIFS_MAX_NODE_SZ)
			return 0;
		return 1;
	}
	empty_offs = ALIGN(offs + 1, c->min_io_size);
	check_len = c->leb_size - empty_offs;
	p = buf + empty_offs - offs;
	for (; check_len > 0; check_len--)
		if (*p++ != 0xff)
			return 0;
	return 1;
}