Use a typedef, instead.
static void process_abft(void);
static void STDCALL unload(IN PDRIVER_OBJECT DriverObject);
static struct aoe_disk_type * create_aoe_disk(void);
-static device__free_decl(free_aoe_disk);
+static device__free_func free_aoe_disk;
/** Tag types. */
enum _tag_type
winvblock__uint32 MaxSectorsPerPacket;
winvblock__uint32 Timeout;
search_state search_state;
- device__free_routine prev_free;
+ device__free_func * prev_free;
LIST_ENTRY tracking;
};
*
* @v dev_ptr Points to the AoE disk device to delete.
*/
-static device__free_decl(free_aoe_disk )
+static void STDCALL free_aoe_disk(IN device__type_ptr dev_ptr)
{
disk__type_ptr disk_ptr = disk__get_ptr ( dev_ptr );
struct aoe_disk_type * aoe_disk_ptr = get_aoe_disk_ptr ( dev_ptr );
/**
* @file
*
- * Bus specifics
- *
+ * Bus specifics.
*/
winvblock__def_struct ( bus__type )
KSPIN_LOCK SpinLock;
LIST_ENTRY tracking;
winvblock__any_ptr ext;
- device__free_routine prev_free;
+ device__free_func * prev_free;
UNICODE_STRING dev_name;
UNICODE_STRING dos_dev_name;
winvblock__bool named;
/**
* @file
*
- * Device specifics
- *
+ * Device specifics.
*/
# include "portable.h"
);
/**
- * Device deletion routine
+ * Device deletion routine.
*
- * @v dev_ptr Points to the device to delete
+ * @v dev_ptr Points to the device to delete.
*/
-# define device__free_decl( x ) \
-\
-void STDCALL \
-x ( \
- IN device__type_ptr dev_ptr \
- )
-/*
- * Function pointer for a device deletion routine.
- * 'indent' mangles this, so it looks weird
- */
-typedef device__free_decl (
- ( *device__free_routine )
- );
+typedef void STDCALL device__free_func(IN device__type_ptr);
/**
- * Delete a device
+ * Delete a device.
*
- * @v dev_ptr Points to the device to delete
+ * @v dev_ptr Points to the device to delete.
*/
-extern winvblock__lib_func device__free_decl (
- device__free
- );
+extern winvblock__lib_func device__free_func device__free;
/**
* Initialize the global, device-common environment
device__create_pdo_routine create_pdo;
device__init_routine init;
device__close_routine close;
- device__free_routine free;
+ device__free_func * free;
};
typedef void STDCALL (device__thread_func)(IN void *);
/**
* @file
*
- * Disk device specifics
- *
+ * Disk device specifics.
*/
enum _disk__media
winvblock__uint32 Sectors;
winvblock__uint32 SectorSize;
winvblock__uint32 SpecialFileCount;
- device__free_routine prev_free;
+ device__free_func * prev_free;
LIST_ENTRY tracking;
winvblock__any_ptr ext;
};
disk__type_ptr disk;
HANDLE file;
winvblock__uint32 hash;
- device__free_routine prev_free;
+ device__free_func * prev_free;
LIST_ENTRY tracking;
LARGE_INTEGER offset;
/*
/**
* @file
*
- * RAM disk specifics
- *
+ * RAM disk specifics.
*/
winvblock__def_struct ( ramdisk__type )
disk__type_ptr disk;
winvblock__uint32 DiskBuf;
winvblock__uint32 DiskSize;
- device__free_routine prev_free;
+ device__free_func * prev_free;
LIST_ENTRY tracking;
};
#include "bus_dev_ctl.h"
#include "debug.h"
+/* Globals. */
static PDEVICE_OBJECT boot_bus_fdo = NULL;
static LIST_ENTRY bus_list;
static KSPIN_LOCK bus_list_lock;
-/* Forward declarations */
-static device__free_decl (
- free_bus
- );
+
+/* Forward declarations. */
+static device__free_func free_bus;
static device__create_pdo_decl (
create_pdo
);
}
/**
- * Default bus deletion operation
+ * Default bus deletion operation.
*
- * @v dev_ptr Points to the bus device to delete
+ * @v dev_ptr Points to the bus device to delete.
*/
-static
-device__free_decl (
- free_bus
- )
-{
- bus__type_ptr bus_ptr = bus__get_ptr ( dev_ptr );
- /*
- * Free the "inherited class"
- */
- bus_ptr->prev_free ( dev_ptr );
- /*
- * Track the bus deletion in our global list. Unfortunately,
- * for now we have faith that a bus won't be deleted twice and
- * result in a race condition. Something to keep in mind...
- */
- ExInterlockedRemoveHeadList ( bus_ptr->tracking.Blink, &bus_list_lock );
-
- wv_free(bus_ptr);
-}
+static void STDCALL free_bus(IN device__type_ptr dev_ptr)
+ {
+ bus__type_ptr bus_ptr = bus__get_ptr ( dev_ptr );
+ /*
+ * Free the "inherited class"
+ */
+ bus_ptr->prev_free ( dev_ptr );
+ /*
+ * Track the bus deletion in our global list. Unfortunately,
+ * for now we have faith that a bus won't be deleted twice and
+ * result in a race condition. Something to keep in mind...
+ */
+ ExInterlockedRemoveHeadList ( bus_ptr->tracking.Blink, &bus_list_lock );
+
+ wv_free(bus_ptr);
+ }
/**
* Get a pointer to the boot bus device
/**
* @file
*
- * Device specifics
- *
+ * Device specifics.
*/
#include <ntddk.h>
static LIST_ENTRY dev_list;
static KSPIN_LOCK dev_list_lock;
/* Forward declarations */
-static device__free_decl (
- free_dev
- );
+static device__free_func free_dev;
static device__create_pdo_decl (
make_dev_pdo
);
}
/**
- * Delete a device
+ * Delete a device.
*
- * @v dev_ptr Points to the device to delete
+ * @v dev_ptr Points to the device to delete.
*/
-winvblock__lib_func
-device__free_decl (
- device__free
- )
-{
- /*
- * Call the device's free routine
- */
- dev_ptr->ops.free ( dev_ptr );
-}
+winvblock__lib_func void STDCALL device__free(IN device__type_ptr dev_ptr)
+ {
+ /* Call the device's free routine. */
+ dev_ptr->ops.free(dev_ptr);
+ }
/**
- * Default device deletion operation
+ * Default device deletion operation.
*
- * @v dev_ptr Points to the device to delete
+ * @v dev_ptr Points to the device to delete.
*/
-static
-device__free_decl (
- free_dev
- )
-{
- /*
- * Track the device deletion in our global list. Unfortunately,
- * for now we have faith that a device won't be deleted twice and
- * result in a race condition. Something to keep in mind...
- */
- ExInterlockedRemoveHeadList ( dev_ptr->tracking.Blink, &dev_list_lock );
-
- wv_free(dev_ptr);
-}
+static void STDCALL free_dev(IN device__type_ptr dev_ptr)
+ {
+ /*
+ * Track the device deletion in our global list. Unfortunately,
+ * for now we have faith that a device won't be deleted twice and
+ * result in a race condition. Something to keep in mind...
+ */
+ ExInterlockedRemoveHeadList(dev_ptr->tracking.Blink, &dev_list_lock);
+
+ wv_free(dev_ptr);
+ }
}
#endif
+/* Globals. */
static winvblock__uint32 next_disk = 0;
static LIST_ENTRY disk_list;
static KSPIN_LOCK disk_list_lock;
winvblock__bool disk__removable[disk__media_count] = { TRUE, FALSE, TRUE };
PWCHAR disk__compat_ids[disk__media_count] =
{ L"GenSFloppy", L"GenDisk", L"GenCdRom" };
-/* Forward declaration */
-static device__free_decl (
- free_disk
- );
+
+/* Forward declarations. */
+static device__free_func free_disk;
static
disk__max_xfer_len_decl (
}
/**
- * Default disk deletion operation
+ * Default disk deletion operation.
*
- * @v dev_ptr Points to the disk device to delete
+ * @v dev_ptr Points to the disk device to delete.
*/
-static
-device__free_decl (
- free_disk
- )
-{
- disk__type_ptr disk_ptr = disk__get_ptr ( dev_ptr );
- /*
- * Free the "inherited class"
- */
- disk_ptr->prev_free ( dev_ptr );
- /*
- * Track the disk deletion in our global list. Unfortunately,
- * for now we have faith that a disk won't be deleted twice and
- * result in a race condition. Something to keep in mind...
- */
- ExInterlockedRemoveHeadList ( disk_ptr->tracking.Blink, &disk_list_lock );
-
- wv_free(disk_ptr);
-}
+static void STDCALL free_disk(IN device__type_ptr dev_ptr)
+ {
+ disk__type_ptr disk_ptr = disk__get_ptr(dev_ptr);
+ /* Free the "inherited class". */
+ disk_ptr->prev_free(dev_ptr);
+ /*
+ * Track the disk deletion in our global list. Unfortunately,
+ * for now we have faith that a disk won't be deleted twice and
+ * result in a race condition. Something to keep in mind...
+ */
+ ExInterlockedRemoveHeadList(disk_ptr->tracking.Blink, &disk_list_lock);
+
+ wv_free(disk_ptr);
+ }
/* See header for details */
disk__io_decl ( disk__io )
#include "filedisk.h"
#include "debug.h"
+/* Globals. */
static LIST_ENTRY filedisk_list;
static KSPIN_LOCK filedisk_list_lock;
-/* Forward declaration */
-static device__free_decl (
- free_filedisk
- );
+
+/* Forward declarations. */
+static device__free_func free_filedisk;
static
disk__io_decl (
}
/**
- * Default file-backed disk deletion operation
+ * Default file-backed disk deletion operation.
*
- * @v dev_ptr Points to the file-backed disk device to delete
+ * @v dev_ptr Points to the file-backed disk device to delete.
*/
-static
-device__free_decl (
- free_filedisk
- )
-{
- disk__type_ptr disk_ptr = disk__get_ptr ( dev_ptr );
- filedisk__type_ptr filedisk_ptr = filedisk__get_ptr ( dev_ptr );
- /*
- * Free the "inherited class"
- */
- filedisk_ptr->prev_free ( dev_ptr );
- /*
- * Track the file-backed disk deletion in our global list. Unfortunately,
- * for now we have faith that a file-backed disk won't be deleted twice and
- * result in a race condition. Something to keep in mind...
- */
- ExInterlockedRemoveHeadList ( filedisk_ptr->tracking.Blink,
- &filedisk_list_lock );
-
- wv_free(filedisk_ptr);
-}
+static void STDCALL free_filedisk(IN device__type_ptr dev_ptr)
+ {
+ disk__type_ptr disk_ptr = disk__get_ptr(dev_ptr);
+ filedisk__type_ptr filedisk_ptr = filedisk__get_ptr(dev_ptr);
+ /*
+ * Free the "inherited class".
+ */
+ filedisk_ptr->prev_free(dev_ptr);
+ /*
+ * Track the file-backed disk deletion in our global list. Unfortunately,
+ * for now we have faith that a file-backed disk won't be deleted twice and
+ * result in a race condition. Something to keep in mind...
+ */
+ ExInterlockedRemoveHeadList(
+ filedisk_ptr->tracking.Blink,
+ &filedisk_list_lock
+ );
+
+ wv_free(filedisk_ptr);
+ }
/* Threaded read/write request */
winvblock__def_struct ( thread_req )
}
/**
- * Threaded, file-backed disk deletion operation
+ * Threaded, file-backed disk deletion operation.
*
- * @v dev_ptr Points to the file-backed disk device to delete
+ * @v dev_ptr Points to the file-backed disk device to delete.
*/
-static
-device__free_decl (
- free_threaded_filedisk
- )
-{
- /*
- * Queue the tear-down and return. The thread will catch this on timeout
- */
- dev_ptr->ops.free = NULL;
-}
+static void STDCALL free_threaded_filedisk(IN device__type_ptr dev_ptr)
+ {
+ /*
+ * Queue the tear-down and return. The thread will catch this on timeout.
+ */
+ dev_ptr->ops.free = NULL;
+ }
/**
* Create a new threaded, file-backed disk
/**
* @file
*
- * RAM disk specifics
- *
+ * RAM disk specifics.
*/
#include <stdio.h>
#define ramdisk_get_ptr( dev_ptr ) \
( ( ramdisk__type_ptr ) ( disk__get_ptr ( dev_ptr ) )->ext )
+/* Globals. */
static LIST_ENTRY ramdisk_list;
static KSPIN_LOCK ramdisk_list_lock;
-/* Forward declaration */
-static device__free_decl (
- free_ramdisk
- );
+
+/* Forward declarations. */
+static device__free_func free_ramdisk;
/* With thanks to karyonix, who makes FiraDisk */
static __inline void STDCALL
}
/**
- * Default RAM disk deletion operation
+ * Default RAM disk deletion operation.
*
- * @v dev_ptr Points to the RAM disk device to delete
+ * @v dev_ptr Points to the RAM disk device to delete.
*/
-static
-device__free_decl (
- free_ramdisk
- )
-{
- disk__type_ptr disk_ptr = disk__get_ptr ( dev_ptr );
- ramdisk__type_ptr ramdisk_ptr = ramdisk_get_ptr ( dev_ptr );
- /*
- * Free the "inherited class"
- */
- ramdisk_ptr->prev_free ( dev_ptr );
- /*
- * Track the RAM disk deletion in our global list. Unfortunately,
- * for now we have faith that a RAM disk won't be deleted twice and
- * result in a race condition. Something to keep in mind...
- */
- ExInterlockedRemoveHeadList ( ramdisk_ptr->tracking.Blink,
- &ramdisk_list_lock );
-
- wv_free(ramdisk_ptr);
-}
+static void STDCALL free_ramdisk(IN device__type_ptr dev_ptr)
+ {
+ disk__type_ptr disk_ptr = disk__get_ptr(dev_ptr);
+ ramdisk__type_ptr ramdisk_ptr = ramdisk_get_ptr(dev_ptr);
+ /* Free the "inherited class". */
+ ramdisk_ptr->prev_free(dev_ptr);
+ /*
+ * Track the RAM disk deletion in our global list. Unfortunately,
+ * for now we have faith that a RAM disk won't be deleted twice and
+ * result in a race condition. Something to keep in mind...
+ */
+ ExInterlockedRemoveHeadList(
+ ramdisk_ptr->tracking.Blink,
+ &ramdisk_list_lock
+ );
+
+ wv_free(ramdisk_ptr);
+ }