From: Cristiano Giuffrida Date: Sat, 20 Dec 2014 10:45:05 +0000 (+0100) Subject: services: Selectively enable stateful restart. X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=3f82ac6a4e188419336747098d0d6616cd2f3d3d;p=minix.git services: Selectively enable stateful restart. Change-Id: Ibf6afa3041013ca714e28b673abb1329cd72d2d5 --- diff --git a/lib/libpuffs/puffs.c b/lib/libpuffs/puffs.c index d419631f9..5e645536f 100644 --- a/lib/libpuffs/puffs.c +++ b/lib/libpuffs/puffs.c @@ -638,9 +638,6 @@ static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_restart(sef_cb_init_fail); - - /* No live update support for now. */ /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/drivers/bus/i2c/i2c.c b/minix/drivers/bus/i2c/i2c.c index 4e753890e..3714d8a42 100644 --- a/minix/drivers/bus/i2c/i2c.c +++ b/minix/drivers/bus/i2c/i2c.c @@ -474,11 +474,6 @@ sef_local_startup() sef_setcb_init_restart(sef_cb_init); /* Register live update callbacks */ - /* Agree to update immediately when LU is requested in a valid state */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* - Support live update starting from any standard state */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* - Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/bus/pci/main.c b/minix/drivers/bus/pci/main.c index ddc8505ce..7c6dfe101 100644 --- a/minix/drivers/bus/pci/main.c +++ b/minix/drivers/bus/pci/main.c @@ -718,21 +718,6 @@ sef_local_startup(void) sef_setcb_init_lu(sef_cb_init); sef_setcb_init_restart(sef_cb_init); - /* - * Register live update callbacks. - */ - - /* - Agree to update immediately when LU is requested in a valid - * state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* - Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - -#if 0 - /* - Register a custom routine to save the state. */ - sef_setcb_lu_state_save(sef_cb_lu_state_save); -#endif - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/bus/ti1225/ti1225.c b/minix/drivers/bus/ti1225/ti1225.c index 7dd8ec4c0..fb7b68849 100644 --- a/minix/drivers/bus/ti1225/ti1225.c +++ b/minix/drivers/bus/ti1225/ti1225.c @@ -74,10 +74,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/clock/readclock/readclock.c b/minix/drivers/clock/readclock/readclock.c index 2435f2742..b3c0990ef 100644 --- a/minix/drivers/clock/readclock/readclock.c +++ b/minix/drivers/clock/readclock/readclock.c @@ -160,14 +160,6 @@ sef_local_startup() sef_setcb_init_lu(sef_cb_init); sef_setcb_init_restart(sef_cb_init); - /* - * Register live update callbacks. - */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/eeprom/cat24c256/cat24c256.c b/minix/drivers/eeprom/cat24c256/cat24c256.c index 94fd45f72..4b02a32c4 100644 --- a/minix/drivers/eeprom/cat24c256/cat24c256.c +++ b/minix/drivers/eeprom/cat24c256/cat24c256.c @@ -472,11 +472,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/examples/hello/hello.c b/minix/drivers/examples/hello/hello.c index 6683a0e5e..5b9e63b4c 100644 --- a/minix/drivers/examples/hello/hello.c +++ b/minix/drivers/examples/hello/hello.c @@ -103,11 +103,6 @@ static void sef_local_startup() /* * Register live update callbacks. */ - /* - Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* - Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* - Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/iommu/amddev/amddev.c b/minix/drivers/iommu/amddev/amddev.c index c84c8b3f6..b5d61927f 100644 --- a/minix/drivers/iommu/amddev/amddev.c +++ b/minix/drivers/iommu/amddev/amddev.c @@ -102,10 +102,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - #if 0 /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/drivers/power/acpi/acpi.c b/minix/drivers/power/acpi/acpi.c index 6732b5529..5b839cdf9 100644 --- a/minix/drivers/power/acpi/acpi.c +++ b/minix/drivers/power/acpi/acpi.c @@ -126,10 +126,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/power/tps65217/tps65217.c b/minix/drivers/power/tps65217/tps65217.c index 16428c1d4..c7d37b8ad 100644 --- a/minix/drivers/power/tps65217/tps65217.c +++ b/minix/drivers/power/tps65217/tps65217.c @@ -334,11 +334,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/power/tps65950/tps65950.c b/minix/drivers/power/tps65950/tps65950.c index db508d633..29358f7eb 100644 --- a/minix/drivers/power/tps65950/tps65950.c +++ b/minix/drivers/power/tps65950/tps65950.c @@ -233,11 +233,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/sensors/bmp085/bmp085.c b/minix/drivers/sensors/bmp085/bmp085.c index 25cf17cb6..5c62df8f0 100644 --- a/minix/drivers/sensors/bmp085/bmp085.c +++ b/minix/drivers/sensors/bmp085/bmp085.c @@ -551,11 +551,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/sensors/sht21/sht21.c b/minix/drivers/sensors/sht21/sht21.c index 2ce2dd5f5..29348bcac 100644 --- a/minix/drivers/sensors/sht21/sht21.c +++ b/minix/drivers/sensors/sht21/sht21.c @@ -454,11 +454,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/sensors/tsl2550/tsl2550.c b/minix/drivers/sensors/tsl2550/tsl2550.c index cfd58c8e8..2819e144f 100644 --- a/minix/drivers/sensors/tsl2550/tsl2550.c +++ b/minix/drivers/sensors/tsl2550/tsl2550.c @@ -403,11 +403,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/storage/ahci/ahci.c b/minix/drivers/storage/ahci/ahci.c index e169ef429..26cc85841 100644 --- a/minix/drivers/storage/ahci/ahci.c +++ b/minix/drivers/storage/ahci/ahci.c @@ -2374,7 +2374,6 @@ static void sef_local_startup(void) /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_lu(sef_cb_init_fresh); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/drivers/storage/at_wini/at_wini.c b/minix/drivers/storage/at_wini/at_wini.c index c8490e0a8..6b1295d0d 100644 --- a/minix/drivers/storage/at_wini/at_wini.c +++ b/minix/drivers/storage/at_wini/at_wini.c @@ -182,7 +182,6 @@ static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_lu(sef_cb_init_fresh); /* Register live update callbacks. */ sef_setcb_lu_prepare(sef_cb_lu_prepare); diff --git a/minix/drivers/storage/filter/main.c b/minix/drivers/storage/filter/main.c index bc15aedcb..ca1a5a0e0 100644 --- a/minix/drivers/storage/filter/main.c +++ b/minix/drivers/storage/filter/main.c @@ -352,8 +352,7 @@ static void sef_local_startup(void) /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_lu(sef_cb_init_fresh); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/drivers/storage/floppy/floppy.c b/minix/drivers/storage/floppy/floppy.c index a5b352048..d55427bcc 100644 --- a/minix/drivers/storage/floppy/floppy.c +++ b/minix/drivers/storage/floppy/floppy.c @@ -308,7 +308,6 @@ static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_lu(sef_cb_init_fresh); /* Register live update callbacks. */ sef_setcb_lu_prepare(sef_cb_lu_prepare); diff --git a/minix/drivers/storage/memory/memory.c b/minix/drivers/storage/memory/memory.c index 8702c63b7..5c4c7f138 100644 --- a/minix/drivers/storage/memory/memory.c +++ b/minix/drivers/storage/memory/memory.c @@ -117,10 +117,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/storage/mmc/mmcblk.c b/minix/drivers/storage/mmc/mmcblk.c index 4d429ac4d..7e5446f29 100644 --- a/minix/drivers/storage/mmc/mmcblk.c +++ b/minix/drivers/storage/mmc/mmcblk.c @@ -544,7 +544,6 @@ sef_local_startup() * Use the same function for all event types */ sef_setcb_init_fresh(block_system_event_cb); - sef_setcb_init_lu(block_system_event_cb); /* Register a signal handler */ sef_setcb_signal_handler(block_signal_handler_cb); diff --git a/minix/drivers/storage/virtio_blk/virtio_blk.c b/minix/drivers/storage/virtio_blk/virtio_blk.c index d7a3c7338..bc4e1d7da 100644 --- a/minix/drivers/storage/virtio_blk/virtio_blk.c +++ b/minix/drivers/storage/virtio_blk/virtio_blk.c @@ -731,7 +731,6 @@ static void sef_local_startup(void) { sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_signal_handler(sef_cb_signal_handler); sef_startup(); diff --git a/minix/drivers/system/random/main.c b/minix/drivers/system/random/main.c index 619a20d56..ffe46982e 100644 --- a/minix/drivers/system/random/main.c +++ b/minix/drivers/system/random/main.c @@ -74,10 +74,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/drivers/tty/pty/tty.c b/minix/drivers/tty/pty/tty.c index a513f8482..a2a5924f2 100644 --- a/minix/drivers/tty/pty/tty.c +++ b/minix/drivers/tty/pty/tty.c @@ -214,8 +214,6 @@ static void tty_startup(void) sef_setcb_init_fresh(tty_init); sef_setcb_init_restart(tty_init); - /* No live update support for now. */ - /* No signal support for now. */ /* Let SEF perform startup. */ diff --git a/minix/drivers/tty/tty/tty.c b/minix/drivers/tty/tty/tty.c index edfc3ad74..c964d1709 100644 --- a/minix/drivers/tty/tty/tty.c +++ b/minix/drivers/tty/tty/tty.c @@ -296,8 +296,7 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/drivers/video/fb/fb.c b/minix/drivers/video/fb/fb.c index b80456261..d7a00eb8f 100644 --- a/minix/drivers/video/fb/fb.c +++ b/minix/drivers/video/fb/fb.c @@ -298,11 +298,6 @@ sef_local_startup() sef_setcb_init_restart(sef_cb_init); /* Register live update callbacks */ - /* - Agree to update immediately when LU is requested in a valid state*/ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* - Support live update starting from any standard state */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* - Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/drivers/video/tda19988/tda19988.c b/minix/drivers/video/tda19988/tda19988.c index 1beb932f7..7e0afa5d7 100644 --- a/minix/drivers/video/tda19988/tda19988.c +++ b/minix/drivers/video/tda19988/tda19988.c @@ -942,11 +942,6 @@ sef_local_startup(void) /* * Register live update callbacks. */ - /* Agree to update immediately when LU is requested in a valid state. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - /* Support live update starting from any standard state. */ - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register a custom routine to save the state. */ sef_setcb_lu_state_save(sef_cb_lu_state_save); /* Let SEF perform startup. */ diff --git a/minix/fs/ext2/main.c b/minix/fs/ext2/main.c index 86e4360c7..b6acfae66 100644 --- a/minix/fs/ext2/main.c +++ b/minix/fs/ext2/main.c @@ -53,9 +53,6 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - sef_setcb_init_restart(sef_cb_init_fail); - - /* No live update support for now. */ /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/fs/isofs/main.c b/minix/fs/isofs/main.c index f301ac51e..39d40362e 100644 --- a/minix/fs/isofs/main.c +++ b/minix/fs/isofs/main.c @@ -44,8 +44,7 @@ static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/fs/mfs/main.c b/minix/fs/mfs/main.c index d6cda6ae4..2033edb83 100644 --- a/minix/fs/mfs/main.c +++ b/minix/fs/mfs/main.c @@ -32,8 +32,7 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/fs/pfs/pfs.c b/minix/fs/pfs/pfs.c index b9d751e33..1ff8977cd 100644 --- a/minix/fs/pfs/pfs.c +++ b/minix/fs/pfs/pfs.c @@ -408,8 +408,7 @@ pfs_startup(void) /* Register initialization callbacks. */ sef_setcb_init_fresh(pfs_init); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register signal callbacks. */ sef_setcb_signal_handler(pfs_signal); diff --git a/minix/fs/procfs/main.c b/minix/fs/procfs/main.c index 3f39382f7..4c279ddd6 100644 --- a/minix/fs/procfs/main.c +++ b/minix/fs/procfs/main.c @@ -51,8 +51,16 @@ init_hook(void) { static int first_time = TRUE; struct inode *root; + int r; if (first_time) { + /* + * Initialize some state. If we are incompatible with the kernel, + * exit immediately. + */ + if ((r = init_tree()) != OK) + panic("init_tree failed!"); + root = get_root_inode(); construct_tree(root, root_files); @@ -69,14 +77,6 @@ init_hook(void) int main(void) { static struct inode_stat stat; - int r; - - /* - * Initialize some state. If we are incompatible with the kernel, exit - * immediately. - */ - if ((r = init_tree()) != OK) - return r; /* Properties of the root directory. */ stat.mode = DIR_ALL_MODE; diff --git a/minix/include/minix/sef.h b/minix/include/minix/sef.h index 4613610ce..5f9920eb4 100644 --- a/minix/include/minix/sef.h +++ b/minix/include/minix/sef.h @@ -80,9 +80,10 @@ int sef_cb_init_response_rs_asyn_once(message *m_ptr); #define SEF_CB_INIT_LU_NULL sef_cb_init_null #define SEF_CB_INIT_RESTART_NULL sef_cb_init_null #define SEF_CB_INIT_RESPONSE_NULL sef_cb_init_response_null +#define SEF_CB_INIT_RESTART_STATEFUL sef_cb_init_identity_state_transfer #define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null -#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_null +#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_lu_generic #define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_reset #define SEF_CB_INIT_RESPONSE_DEFAULT sef_cb_init_response_rs_reply @@ -200,9 +201,9 @@ int sef_cb_lu_response_rs_reply(message *m_ptr); #define SEF_CB_LU_RESPONSE_NULL sef_cb_lu_response_null #define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null -#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null +#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_generic #define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null -#define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null +#define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_eval #define SEF_CB_LU_STATE_SAVE_DEFAULT sef_cb_lu_state_save_null #define SEF_CB_LU_RESPONSE_DEFAULT sef_cb_lu_response_rs_reply diff --git a/minix/lib/libnetdriver/netdriver.c b/minix/lib/libnetdriver/netdriver.c index bdea11df6..a5274c14a 100644 --- a/minix/lib/libnetdriver/netdriver.c +++ b/minix/lib/libnetdriver/netdriver.c @@ -595,7 +595,6 @@ netdriver_task(const struct netdriver * ndp) /* Perform SEF initialization. */ sef_setcb_init_fresh(do_init); - sef_setcb_init_restart(do_init); /* TODO: revisit this */ sef_setcb_signal_handler(got_signal); netdriver_table = ndp; diff --git a/minix/lib/libsys/sef_init.c b/minix/lib/libsys/sef_init.c index 7b229717b..41ec8e68b 100644 --- a/minix/lib/libsys/sef_init.c +++ b/minix/lib/libsys/sef_init.c @@ -346,7 +346,7 @@ int sef_cb_init_identity_state_transfer(int type, sef_init_info_t *info) new_brksize = _brksize; /* Transfer heap if necessary. */ - if(old_brksize != new_brksize) { + if(sef_self_endpoint != VM_PROC_NR && old_brksize != new_brksize) { #if SEF_ST_DEBUG printf("sef_cb_init_identity_state_transfer: brk() for new_brksize = 0x%08x\n", @@ -391,9 +391,10 @@ int sef_cb_init_lu_identity_as_restart(int type, sef_init_info_t *info) /* Resort to restart callback only for identity updates, ignore other cases. */ if(SEF_LU_IS_IDENTITY_UPDATE(info->flags)) { - if(info->flags & (SEF_INIT_DEFCB|SEF_INIT_SCRIPT_RESTART)) { - /* Use default callback when requested or when using a script.*/ - return SEF_CB_INIT_RESTART_DEFAULT(type, info); + if((info->flags & (SEF_INIT_DEFCB|SEF_INIT_SCRIPT_RESTART)) + || sef_init_cbs.sef_cb_init_restart == sef_cb_init_reset) { + /* Use stateful restart callback when necessary. */ + return SEF_CB_INIT_RESTART_STATEFUL(type, info); } return sef_init_cbs.sef_cb_init_restart(type, info); } diff --git a/minix/lib/libvtreefs/vtreefs.c b/minix/lib/libvtreefs/vtreefs.c index 36064439c..db6026523 100644 --- a/minix/lib/libvtreefs/vtreefs.c +++ b/minix/lib/libvtreefs/vtreefs.c @@ -51,13 +51,11 @@ got_signal(int signal) static void sef_local_startup(void) { - sef_setcb_init_fresh(init_server); + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); sef_setcb_signal_handler(got_signal); - /* No support for live update yet. */ - sef_startup(); } diff --git a/minix/net/inet/inet.c b/minix/net/inet/inet.c index 09ce1bfe4..76df5b5b4 100644 --- a/minix/net/inet/inet.c +++ b/minix/net/inet/inet.c @@ -145,8 +145,6 @@ static void sef_local_startup() sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* No live update support for now. */ - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/net/lwip/lwip.c b/minix/net/lwip/lwip.c index 39e760712..9724d291a 100644 --- a/minix/net/lwip/lwip.c +++ b/minix/net/lwip/lwip.c @@ -141,8 +141,6 @@ static void sef_local_startup(void) sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* No live update support for now. */ - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/net/uds/uds.c b/minix/net/uds/uds.c index d805b6ef8..49929548a 100644 --- a/minix/net/uds/uds.c +++ b/minix/net/uds/uds.c @@ -732,8 +732,6 @@ uds_startup(void) /* Register init callbacks. */ sef_setcb_init_fresh(uds_init); - /* No live update support for now. */ - /* Register signal callbacks. */ sef_setcb_signal_handler(uds_signal); diff --git a/minix/servers/ds/main.c b/minix/servers/ds/main.c index b61f2c8b6..2fbdc609f 100644 --- a/minix/servers/ds/main.c +++ b/minix/servers/ds/main.c @@ -94,12 +94,11 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register state transfer callbacks. */ sef_llvm_ds_st_init(); - /* No live update support for now. */ - /* Let SEF perform startup. */ sef_startup(); } diff --git a/minix/servers/ipc/main.c b/minix/servers/ipc/main.c index 02d39d595..3e143158a 100644 --- a/minix/servers/ipc/main.c +++ b/minix/servers/ipc/main.c @@ -123,8 +123,6 @@ static void sef_local_startup() sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* No live update support for now. */ - /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/servers/is/main.c b/minix/servers/is/main.c index aae548e63..759a4822d 100644 --- a/minix/servers/is/main.c +++ b/minix/servers/is/main.c @@ -80,10 +80,6 @@ static void sef_local_startup() sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); - /* Register live update callbacks. */ - sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); - sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); - /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); diff --git a/minix/servers/pm/main.c b/minix/servers/pm/main.c index 82bc1b951..af86de54a 100644 --- a/minix/servers/pm/main.c +++ b/minix/servers/pm/main.c @@ -114,8 +114,7 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Register signal callbacks. */ sef_setcb_signal_manager(process_ksig); diff --git a/minix/servers/rs/main.c b/minix/servers/rs/main.c index 2ef2ba612..28e491b8d 100644 --- a/minix/servers/rs/main.c +++ b/minix/servers/rs/main.c @@ -147,8 +147,6 @@ static void sef_local_startup() sef_setcb_init_response(sef_cb_init_response); sef_setcb_lu_response(sef_cb_lu_response); - /* No live update support for now. */ - /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); sef_setcb_signal_manager(sef_cb_signal_manager); @@ -507,9 +505,9 @@ static int sef_cb_init_restart(int type, sef_init_info_t *info) assert(info->endpoint == RS_PROC_NR); /* Perform default state transfer first. */ - r = SEF_CB_INIT_RESTART_DEFAULT(type, info); + r = SEF_CB_INIT_RESTART_STATEFUL(type, info); if(r != OK) { - printf("SEF_CB_INIT_RESTART_DEFAULT failed: %d\n", r); + printf("SEF_CB_INIT_RESTART_STATEFUL failed: %d\n", r); return r; } @@ -557,7 +555,7 @@ static int sef_cb_init_lu(int type, sef_init_info_t *info) assert(info->endpoint == RS_PROC_NR); /* Perform default state transfer first. */ - sef_setcb_init_restart(SEF_CB_INIT_RESTART_DEFAULT); + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); r = SEF_CB_INIT_LU_DEFAULT(type, info); if(r != OK) { printf("SEF_CB_INIT_LU_DEFAULT failed: %d\n", r); diff --git a/minix/servers/sched/main.c b/minix/servers/sched/main.c index 1b87bb4b9..83d0b283b 100644 --- a/minix/servers/sched/main.c +++ b/minix/servers/sched/main.c @@ -12,6 +12,7 @@ /* Declare some local functions. */ static void reply(endpoint_t whom, message *m_ptr); static void sef_local_startup(void); +static int sef_cb_init_fresh(int type, sef_init_info_t *info); struct machine machine; /* machine info */ @@ -26,16 +27,10 @@ int main(void) int who_e; /* caller's endpoint */ int result; /* result to system call */ int rv; - int s; /* SEF local startup. */ sef_local_startup(); - if (OK != (s=sys_getmachine(&machine))) - panic("couldn't get machine info: %d", s); - /* Initialize scheduling timers, used for running balance_queues */ - init_scheduling(); - /* This is SCHED's main loop - get work and do it, forever and forever. */ while (TRUE) { int ipc_status; @@ -115,10 +110,28 @@ static void reply(endpoint_t who_e, message *m_ptr) *===========================================================================*/ static void sef_local_startup(void) { - /* No init callbacks for now. */ - /* No live update support for now. */ + /* Register init callbacks. */ + sef_setcb_init_fresh(sef_cb_init_fresh); + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); + /* No signal callbacks for now. */ /* Let SEF perform startup. */ sef_startup(); } + +/*===========================================================================* + * sef_cb_init_fresh * + *===========================================================================*/ +static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) +{ + int s; + + if (OK != (s=sys_getmachine(&machine))) + panic("couldn't get machine info: %d", s); + /* Initialize scheduling timers, used for running balance_queues */ + init_scheduling(); + + return(OK); +} + diff --git a/minix/servers/vfs/main.c b/minix/servers/vfs/main.c index 354565ce3..c8036c830 100644 --- a/minix/servers/vfs/main.c +++ b/minix/servers/vfs/main.c @@ -290,8 +290,7 @@ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); - - /* No live update support for now. */ + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); /* Let SEF perform startup. */ sef_startup(); diff --git a/minix/servers/vm/main.c b/minix/servers/vm/main.c index 38800f498..0ccd6159e 100644 --- a/minix/servers/vm/main.c +++ b/minix/servers/vm/main.c @@ -661,13 +661,13 @@ static int sef_cb_init_lu_restart(int type, sef_init_info_t *info) int old_p; struct vmproc *old_vmp, *new_vmp; - /* Perform default state transfer first. Assume VM doesn't brk(). */ + /* Perform default state transfer first. */ if(type == SEF_INIT_LU) { - sef_setcb_init_restart(SEF_CB_INIT_RESTART_DEFAULT); + sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); r = SEF_CB_INIT_LU_DEFAULT(type, info); } else { - r = SEF_CB_INIT_RESTART_DEFAULT(type, info); + r = SEF_CB_INIT_RESTART_STATEFUL(type, info); } if(r != OK) { return r;