示例#1
0
void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
{
	uint32_t val = ~0;

	if (fd == -1) {
		const char *name = getenv("TESTNAME");
		if (!name)
			name = "unknown";
		rd_start(name, "");
		printf("opened rd, %d\n", fd);
	}

	if (type == RD_GPU_ID) {
		gpu_id = *(unsigned int *)buf;
	}

	rd_write(&val, 4);
	rd_write(&val, 4);

	rd_write(&type, 4);
	val = ALIGN(sz, 4);
	rd_write(&val, 4);
	rd_write(buf, sz);

	val = 0;
	rd_write(&val, ALIGN(sz, 4) - sz);

	if (wrap_safe())
		fsync(fd);
}
示例#2
0
void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
{
	if (fd == -1) {
		rd_start("unknown", "unknown");
		printf("opened rd, %d\n", fd);
	}

	if (type == RD_GPU_ID) {
		gpu_id = *(unsigned int *)buf;
	}

	rd_write(&type, sizeof(type));
	rd_write(&sz, 4);
	rd_write(buf, sz);
	if (wrap_safe())
		fsync(fd);
}