示例#1
0
文件: tbio.c 项目: ystk/debian-ltp
static int test_bio_alloc(void)
{
	int res = 0;
	res = test_do_bio_alloc(2);
	if(res < 0){
		printk("can not alloc bio for %d\n",2);
		return -1;
	}

	res = test_do_bio_alloc(8);
	if(res < 0){
		printk("can not alloc bio for %d\n",8);
		return -1;
	}
	res = test_do_bio_alloc(32);
	if(res < 0){
		printk("can not alloc bio for %d\n",32);
		return -1;
	}
	res = test_do_bio_alloc(96);
	if(res < 0){
		printk("can not alloc bio for %d\n",96);
		return -1;
	}
	res = test_do_bio_alloc(BIO_MAX_PAGES);
	if(res < 0){
		printk("can not alloc bio for %d\n",BIO_MAX_PAGES);
		return -1;
	}


	tbiop = bio_alloc(GFP_KERNEL , BIO_MAX_PAGES);
	if(tbiop == NULL ) {
		printk("tbio: bio_alloc failed\n");
		return -1;
	}

	return 0;
}
示例#2
0
文件: ltp_tbio.c 项目: ArnoldWu/ltp
static int test_bio_alloc(void)
{
	if (test_do_bio_alloc(2) < 0) {
		prk_err("can not alloc bio for %d", 2);
		return -1;
	}

	if (test_do_bio_alloc(8) < 0) {
		prk_err("can not alloc bio for %d", 8);
		return -1;
	}

	if (test_do_bio_alloc(32) < 0) {
		prk_err("can not alloc bio for %d", 32);
		return -1;
	}

	if (test_do_bio_alloc(96) < 0) {
		prk_err("can not alloc bio for %d", 96);
		return -1;
	}

	if (test_do_bio_alloc(BIO_MAX_PAGES) < 0) {
		prk_err("can not alloc bio for %d", BIO_MAX_PAGES);
		return -1;
	}

	tbiop = bio_alloc(GFP_KERNEL, BIO_MAX_PAGES);
	if (tbiop == NULL) {
		prk_err("bio_alloc failed");
		return -1;
	}

	tbiop->bi_bdev = tbio_dev.bdev;
	tbiop->bi_sector = 0;

	return 0;
}