Ejemplo n.º 1
0
static int test_init_module(void)
{

	int rc;

	printk("starting module\n");

	ltp_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, ltp_pm_callback);
	rc = register_blkdev(INCLUDEMAJOR, DEVICE_NAME);

	printk("BLK INC - result =%d major %d\n", rc, INCLUDEMAJOR);

	if (rc < 0) {
		printk("Failed to register device.\n");
		return rc;
	}

	gd_ptr = kmalloc(sizeof(struct gendisk *), GFP_KERNEL);
	if (!gd_ptr) {
		printk(KERN_ALERT "ERROR getting memory !!!\n");
		return 0;
	}

	printk("major = %d\n", Major);
	gd_ptr = alloc_disk(1);
	printk(KERN_ALERT "gd_ptr after alloc = %p \n", gd_ptr);
	gd_ptr->major = INCLUDEMAJOR;
	gd_ptr->first_minor = 0;
	gd_ptr->fops = &bdops;
//      gd_ptr->minor_shift= MINOR_SHIFT_BITS;
	gd_ptr->driverfs_dev = NULL;
	gd_ptr->capacity = MAX_NUM_DISKS;
//      gd_ptr->disk_de = NULL;
	gd_ptr->flags = genhd_flags;

	sprintf(gd_ptr->disk_name, DEVICE_NAME);
	add_disk(gd_ptr);

	printk("major = %d\n", Major);

	test_acpi();
	test_vga();
	test_lockd();
	test_sunrpc_auth();
	test_nfsfh();
	test_sunrpc_cache();
	test_sunrpc_svc();
	test_sunrpc_timer();
	printk("finished module\n");

	return 0;
}
Ejemplo n.º 2
0
static int test_draw(int x, int y, adv_mode* mode)
{
	if (0) ;
#ifdef USE_VIDEO_VGA
	else if (video_current_driver() == &video_vga_driver)
		y = test_vga(x, y, (vga_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_VGALINE
	else if (video_current_driver() == &video_vgaline_driver)
		y = test_vgaline(x, y, (vgaline_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_SVGALINE
	else if (video_current_driver() == &video_svgaline_driver)
		y = test_svgaline(x, y, (svgaline_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_SVGAWIN
	else if (video_current_driver() == &video_svgawin_driver)
		y = test_svgawin(x, y, (svgawin_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_VBE
	else if (video_current_driver() == &video_vbe_driver)
		y = test_vbe(x, y, (vbe_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_VBELINE
	else if (video_current_driver() == &video_vbeline_driver)
		y = test_vbeline(x, y, (vbeline_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_SVGALIB
	else if (video_current_driver() == &video_svgalib_driver)
		y = test_svgalib(x, y, (svgalib_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_FB
	else if (video_current_driver() == &video_fb_driver)
		y = test_fb(x, y, (fb_video_mode*)mode->driver_mode);
#endif
#ifdef USE_VIDEO_SDL
	else if (video_current_driver() == &video_sdl_driver)
		y = test_sdl(x, y, (sdl_video_mode*)mode->driver_mode);
#endif
	return y;
}