示例#1
0
static int affinity_vfile_show(struct xnvfile_regular_iterator *it,
			       void *data)
{
	unsigned long val = 0;
	int cpu;

	for (cpu = 0; cpu < BITS_PER_LONG; cpu++)
		if (xnarch_cpu_isset(cpu, nkaffinity))
			val |= (1ull << cpu);

	xnvfile_printf(it, "%08lx\n", val);

	return 0;
}
示例#2
0
文件: intr.c 项目: chrmorais/miniemc2
static int affinity_read_proc(char *page,
			      char **start,
			      off_t off, int count, int *eof, void *data)
{
	unsigned long val = 0;
	int len, cpu;

	for (cpu = 0; cpu < sizeof(val) * 8; cpu++)
		if (xnarch_cpu_isset(cpu, nkaffinity))
			val |= (1 << cpu);

	len = sprintf(page, "%08lx\n", val);
	len -= off;
	if (len <= off + count)
		*eof = 1;
	*start = page + off;
	if (len > count)
		len = count;
	if (len < 0)
		len = 0;

	return len;
}