winvblock__def_struct(device__type);
/**
- * Device PDO creation routine
+ * Device PDO creation routine.
*
- * @v dev_ptr The device whose PDO should be created
- * @ret pdo_ptr Points to the new PDO, or is NULL upon failure
+ * @v dev The device whose PDO should be created.
+ * @ret pdo Points to the new PDO, or is NULL upon failure.
*/
typedef PDEVICE_OBJECT STDCALL device__create_pdo_func(IN device__type_ptr);
extern winvblock__lib_func device__create_pdo_func device__create_pdo;
/**
- * Device initialization routine
+ * Device initialization routine.
*
- * @v dev_ptr The device being initialized
+ * @v dev The device being initialized.
*/
-# define device__init_decl( x ) \
-\
-winvblock__bool STDCALL \
-x ( \
- IN device__type_ptr dev_ptr \
- )
-/*
- * Function pointer for a device initialization routine.
- * 'indent' mangles this, so it looks weird
- */
-typedef device__init_decl (
- ( *device__init_routine )
- );
+typedef winvblock__bool STDCALL device__init_func(IN device__type_ptr);
/**
* Device close routine
winvblock__def_struct(device__ops) {
device__create_pdo_func * create_pdo;
- device__init_routine init;
+ device__init_func * init;
device__close_routine close;
device__free_func * free;
};
return 1024 * 1024;
}
-static
-device__init_decl (
- init
- )
-{
- disk__type_ptr disk_ptr = disk__get_ptr ( dev_ptr );
- return disk_ptr->disk_ops.init ( disk_ptr );
-}
+/* Initialize a disk. */
+static winvblock__bool STDCALL disk__init_(IN device__type_ptr dev) {
+ disk__type_ptr disk_ptr = disk__get_ptr(dev);
+ return disk_ptr->disk_ops.init(disk_ptr);
+ }
disk__init_decl ( default_init )
{
dev_ptr->ops.close = close;
dev_ptr->ops.create_pdo = create_pdo;
dev_ptr->ops.free = free_disk;
- dev_ptr->ops.init = init;
+ dev_ptr->ops.init = disk__init_;
dev_ptr->ext = disk_ptr;
KeInitializeSpinLock ( &disk_ptr->SpinLock );