FreeBSD/tests/sys/aio/aio_test.c
/*
 * Initialize a testing context given the file descriptors provided by the
 * test setup.
 */
Initialize a testing context given the file descriptors provided by the
test setup.
Initialize a testing context given the file descriptors provided by the test setup .
static void
aio_context_init(struct aio_context *ac, int read_fd,
    int write_fd, int buflen, int seconds, void (*cleanup)(void *),
    void *cleanup_arg)
{
	ATF_REQUIRE_MSG(buflen <= BUFFER_MAX,
	    "aio_context_init: buffer too large (%d > %d)",
	    buflen, BUFFER_MAX);
	bzero(ac, sizeof(*ac));
	ac->ac_read_fd = read_fd;
	ac->ac_write_fd = write_fd;
	ac->ac_buflen = buflen;
	srandomdev();
	ac->ac_seed = random();
	aio_fill_buffer(ac->ac_buffer, buflen, ac->ac_seed);
	ATF_REQUIRE_MSG(aio_test_buffer(ac->ac_buffer, buflen,
	    ac->ac_seed) != 0, "aio_test_buffer: internal error");
	ac->ac_seconds = seconds;
	ac->ac_cleanup = cleanup;
	ac->ac_cleanup_arg = cleanup_arg;
}
static void aio_context_init ( struct aio_context * ac , int read_fd , int write_fd , int buflen , int seconds , void ( * cleanup ) ( void * ) , void * cleanup_arg ) { ATF_REQUIRE_MSG ( buflen <= BUFFER_MAX , " " , buflen , BUFFER_MAX ) ; bzero ( ac , sizeof ( * ac ) ) ; ac -> ac_read_fd = read_fd ; ac -> ac_write_fd = write_fd ; ac -> ac_buflen = buflen ; srandomdev ( ) ; ac -> ac_seed = random ( ) ; aio_fill_buffer ( ac -> ac_buffer , buflen , ac -> ac_seed ) ; ATF_REQUIRE_MSG ( aio_test_buffer ( ac -> ac_buffer , buflen , ac -> ac_seed ) != 0 , " " ) ; ac -> ac_seconds = seconds ; ac -> ac_cleanup = cleanup ; ac -> ac_cleanup_arg = cleanup_arg ; }
Initialize a testing context given the file descriptors provided by the
 test setup.
Initialize a testing context given the file descriptors provided by the test setup .