/* Functions defined by libblockdriver. These can be used for both
* singlethreaded and multithreaded drivers.
*/
-_PROTOTYPE( void blockdriver_announce, (void) );
+_PROTOTYPE( void blockdriver_announce, (int type) );
#ifndef _BLOCKDRIVER_MT_API
/* Additional functions for the singlethreaded version. These allow the driver
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the driver.
*/
ahci_set_mapping();
/* Announce that we are up. */
- blockdriver_announce();
+ blockdriver_announce(type);
return OK;
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the at_wini driver. */
system_hz = sys_hz();
init_params();
/* Announce we are up! */
- blockdriver_announce();
+ blockdriver_announce(type);
return(OK);
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the bios_wini driver. */
long v;
remap_first = v;
/* Announce we are up! */
- blockdriver_announce();
+ blockdriver_announce(type);
return(OK);
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
-/* Initialize the filter driver. */
+ /* Initialize the filter driver. */
int r;
r = parse_arguments(env_argc, env_argv);
}
/* Announce we are up! */
- blockdriver_announce();
+ blockdriver_announce(type);
return(OK);
}
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
-PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
+PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{
/* Initialize the floppy driver. */
struct floppy *fp;
panic("Couldn't enable IRQs: %d", s);
/* Announce we are up! */
- blockdriver_announce();
+ blockdriver_announce(type);
return(OK);
}
/*===========================================================================*
* blockdriver_announce *
*===========================================================================*/
-PUBLIC void blockdriver_announce(void)
+PUBLIC void blockdriver_announce(int type)
{
/* Announce we are up after a fresh start or a restart. */
int r;
/* Callers are allowed to use sendrec to communicate with drivers.
* For this reason, there may blocked callers when a driver restarts.
- * Ask the kernel to unblock them (if any).
+ * Ask the kernel to unblock them (if any). Note that most block drivers
+ * will not restart statefully, and thus will skip this code.
*/
+ if (type == SEF_INIT_RESTART) {
#if USE_STATECTL
- if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK)
- panic("blockdriver_init: sys_statectl failed: %d", r);
+ if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK)
+ panic("blockdriver_init: sys_statectl failed: %d", r);
#endif
+ }
/* Publish a driver up event. */
if ((r = ds_retrieve_label_name(label, getprocnr())) != OK)