[PATCH] Refactor sys_reboot into reusable parts