/* This function returns offset of the first non-0xff byte in @buf or %-1 if the buffer contains only 0xff bytes.  */
static int first_non_ff(void *buf, int len)
/* This function returns offset of the first non-0xff byte in @buf or %-1 if the buffer contains only 0xff bytes.  */
static int first_non_ff(void *buf, int len)
{
	uint8_t *p = buf;
	int i;
	for (i = 0; i < len; i++)
		if (*p++ != 0xff)
			return i;
	return -1;
}