Changeset eebecdc in mainline for uspace/srv/system/system.c
- Timestamp:
- 2025-03-13T18:30:36Z (5 months ago)
- Children:
- e3e53cc
- Parents:
- e494d7b (diff), da54714 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/system/system.c
re494d7b reebecdc 35 35 */ 36 36 37 #include <devman.h> 37 38 #include <fibril.h> 38 39 #include <futil.h> … … 48 49 #include <str.h> 49 50 #include <loc.h> 51 #include <shutdown.h> 50 52 #include <str_error.h> 51 53 #include <config.h> … … 84 86 85 87 static void system_srv_conn(ipc_call_t *, void *); 86 static errno_t system_srv_shutdown(void *); 88 static errno_t system_srv_poweroff(void *); 89 static errno_t system_srv_restart(void *); 87 90 88 91 system_ops_t system_srv_ops = { 89 .shutdown = system_srv_shutdown 92 .poweroff = system_srv_poweroff, 93 .restart = system_srv_restart 90 94 }; 91 95 … … 520 524 /* Eject all volumes. */ 521 525 526 log_msg(LOG_DEFAULT, LVL_NOTE, "Ejecting volumes."); 527 522 528 rc = vol_create(&vol); 523 529 if (rc != EOK) { … … 544 550 free(part_ids); 545 551 vol_destroy(vol); 552 546 553 return EOK; 547 554 error: … … 610 617 } 611 618 612 /** System shutdownrequest.619 /** System poweroff request. 613 620 * 614 621 * @param arg Argument (sys_srv_t *) 615 622 */ 616 static errno_t system_srv_ shutdown(void *arg)623 static errno_t system_srv_poweroff(void *arg) 617 624 { 618 625 sys_srv_t *syssrv = (sys_srv_t *)arg; 619 626 errno_t rc; 620 627 621 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_ shutdown");628 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff"); 622 629 623 630 rc = system_sys_shutdown(); 624 631 if (rc != EOK) { 625 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_ shutdownfailed");632 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff failed"); 626 633 system_srv_shutdown_failed(&syssrv->srv); 627 634 } 628 635 629 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_shutdown complete"); 636 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff complete"); 637 system_srv_shutdown_complete(&syssrv->srv); 638 return EOK; 639 } 640 641 /** System restart request. 642 * 643 * @param arg Argument (sys_srv_t *) 644 */ 645 static errno_t system_srv_restart(void *arg) 646 { 647 sys_srv_t *syssrv = (sys_srv_t *)arg; 648 errno_t rc; 649 650 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart"); 651 652 rc = system_sys_shutdown(); 653 if (rc != EOK) { 654 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart failed"); 655 system_srv_shutdown_failed(&syssrv->srv); 656 } 657 658 /* Quiesce the device tree. */ 659 660 log_msg(LOG_DEFAULT, LVL_NOTE, "Quiescing devices."); 661 662 rc = devman_quiesce_devices("/hw"); 663 if (rc != EOK) { 664 log_msg(LOG_DEFAULT, LVL_ERROR, 665 "Failed to quiesce device tree."); 666 return rc; 667 } 668 669 sys_reboot(); 670 671 log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart complete"); 630 672 system_srv_shutdown_complete(&syssrv->srv); 631 673 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.