Changeset eebecdc in mainline for uspace/lib


Ignore:
Timestamp:
2025-03-13T18:30:36Z (7 months ago)
Author:
Miroslav Cimerman <mc@…>
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.
Message:

merge upstream/master into helenraid

Location:
uspace/lib
Files:
3 added
24 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ata/include/ata/ata.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    201201extern errno_t ata_channel_initialize(ata_channel_t *);
    202202extern errno_t ata_channel_destroy(ata_channel_t *);
     203extern void ata_channel_quiesce(ata_channel_t *);
    203204extern void ata_channel_irq(ata_channel_t *, uint8_t);
    204205extern void ata_connection(ipc_call_t *, ata_device_t *);
  • uspace/lib/ata/include/ata/ata_hw.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    106106#define REG_COMMAND offsetof(ata_cmd_t, command)
    107107#define REG_FEATURES offsetof(ata_cmd_t, features)
     108#define REG_DEVCTL offsetof(ata_ctl_t, device_control)
    108109
    109110enum devctl_bits {
  • uspace/lib/ata/src/ata.c

    re494d7b reebecdc  
    8484static uint8_t ata_read_cmd_8(ata_channel_t *, uint16_t);
    8585static void ata_write_cmd_8(ata_channel_t *, uint16_t, uint8_t);
     86static void ata_write_ctl_8(ata_channel_t *, uint16_t, uint8_t);
    8687
    8788static errno_t ata_bd_init_irq(ata_channel_t *);
     
    279280}
    280281
     282/** Quiesce ATA channel. */
     283void ata_channel_quiesce(ata_channel_t *chan)
     284{
     285        ata_msg_debug(chan, ": ata_channel_quiesce()");
     286
     287        fibril_mutex_lock(&chan->lock);
     288        ata_write_ctl_8(chan, REG_DEVCTL, DCR_SRST | DCR_nIEN);
     289        fibril_mutex_unlock(&chan->lock);
     290}
     291
    281292/** Add ATA device.
    282293 *
     
    348359{
    349360        return chan->params.write_cmd_8(chan->params.arg, port, value);
     361}
     362
     363/** Write 8 bits to 8-bit control port.
     364 *
     365 * @param chan ATA channel
     366 * @param port Port number
     367 * @param value Register value
     368 */
     369static void ata_write_ctl_8(ata_channel_t *chan, uint16_t port, uint8_t value)
     370{
     371        return chan->params.write_ctl_8(chan->params.arg, port, value);
    350372}
    351373
  • uspace/lib/c/generic/rtld/module.c

    re494d7b reebecdc  
    9999
    100100        DPRINTF("prog tdata at %p size %zu, tbss size %zu\n",
    101         module->tdata, module->tdata_size, module->tbss_size);
     101            module->tdata, module->tdata_size, module->tbss_size);
    102102
    103103        list_append(&module->modules_link, &rtld->modules);
  • uspace/lib/c/generic/rtld/symbol.c

    re494d7b reebecdc  
    6565static elf_symbol_t *def_find_in_module(const char *name, module_t *m)
    6666{
     67        if (m->dyn.hash == NULL) {
     68                /* No hash table */
     69                return NULL;
     70        }
     71
    6772        elf_symbol_t *sym_table;
    6873        elf_symbol_t *s, *sym;
  • uspace/lib/c/meson.build

    re494d7b reebecdc  
    11#
    2 # Copyright (c) 2024 Jiri Svoboda
     2# Copyright (c) 2025 Jiri Svoboda
    33# Copyright (c) 2005 Martin Decky
    44# Copyright (c) 2007 Jakub Jermar
     
    122122        'generic/malloc.c',
    123123        'generic/rndgen.c',
     124        'generic/shutdown.c',
    124125        'generic/stdio/scanf.c',
    125126        'generic/stdio/sprintf.c',
  • uspace/lib/device/include/devman.h

    re494d7b reebecdc  
    5252extern errno_t devman_drv_fun_online(devman_handle_t);
    5353extern errno_t devman_drv_fun_offline(devman_handle_t);
     54extern errno_t devman_drv_fun_quiesce(devman_handle_t);
    5455extern errno_t devman_drv_fun_wait_stable(devman_handle_t);
    5556
     
    7172extern errno_t devman_fun_online(devman_handle_t);
    7273extern errno_t devman_fun_offline(devman_handle_t);
     74extern errno_t devman_fun_quiesce(devman_handle_t);
    7375
    7476extern errno_t devman_add_device_to_category(devman_handle_t, const char *);
    7577extern errno_t devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
     78extern errno_t devman_quiesce_devices(const char *);
    7679extern errno_t devman_get_drivers(devman_handle_t **, size_t *);
    7780extern errno_t devman_driver_get_devices(devman_handle_t, devman_handle_t **,
  • uspace/lib/device/include/ipc/devman.h

    re494d7b reebecdc  
    148148        DEVMAN_DRV_FUN_ONLINE,
    149149        DEVMAN_DRV_FUN_OFFLINE,
     150        DEVMAN_DRV_FUN_QUIESCE,
    150151        DEVMAN_DRV_FUN_WAIT_STABLE,
    151152        DEVMAN_REMOVE_FUNCTION
     
    156157        DRIVER_DEV_REMOVE,
    157158        DRIVER_DEV_GONE,
     159        DRIVER_DEV_QUIESCE,
    158160        DRIVER_FUN_ONLINE,
    159161        DRIVER_FUN_OFFLINE,
     
    171173        DEVMAN_FUN_ONLINE,
    172174        DEVMAN_FUN_OFFLINE,
     175        DEVMAN_FUN_QUIESCE,
    173176        DEVMAN_FUN_GET_PATH,
    174177        DEVMAN_FUN_SID_TO_HANDLE,
  • uspace/lib/device/src/devman.c

    re494d7b reebecdc  
    343343}
    344344
     345errno_t devman_drv_fun_quiesce(devman_handle_t funh)
     346{
     347        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
     348        if (exch == NULL)
     349                return ENOMEM;
     350
     351        errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_QUIESCE, funh);
     352
     353        devman_exchange_end(exch);
     354        return retval;
     355}
     356
    345357errno_t devman_drv_fun_wait_stable(devman_handle_t funh)
    346358{
     
    506518}
    507519
     520errno_t devman_fun_quiesce(devman_handle_t funh)
     521{
     522        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     523        if (exch == NULL)
     524                return ENOMEM;
     525
     526        errno_t retval = async_req_1_0(exch, DEVMAN_FUN_QUIESCE, funh);
     527
     528        devman_exchange_end(exch);
     529        return retval;
     530}
     531
    508532static errno_t devman_get_handles_once(sysarg_t method, sysarg_t arg1,
    509533    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
     
    632656}
    633657
     658errno_t devman_quiesce_devices(const char *path)
     659{
     660        devman_handle_t funh;
     661        errno_t rc;
     662
     663        funh = 0;
     664        rc = devman_fun_get_handle(path, &funh, 0);
     665        if (rc != EOK)
     666                return rc;
     667
     668        return devman_fun_quiesce(funh);
     669}
     670
    634671errno_t devman_get_drivers(devman_handle_t **drvs,
    635672    size_t *count)
  • uspace/lib/drv/generic/driver.c

    re494d7b reebecdc  
    237237}
    238238
     239static void driver_dev_quiesce(ipc_call_t *icall)
     240{
     241        devman_handle_t devh = ipc_get_arg1(icall);
     242        ddf_fun_t *fun;
     243        link_t *link;
     244
     245        fibril_mutex_lock(&devices_mutex);
     246        ddf_dev_t *dev = driver_get_device(devh);
     247        if (dev != NULL)
     248                dev_add_ref(dev);
     249        fibril_mutex_unlock(&devices_mutex);
     250
     251        if (dev == NULL) {
     252                async_answer_0(icall, ENOENT);
     253                return;
     254        }
     255
     256        errno_t rc;
     257
     258        if (driver->driver_ops->dev_quiesce != NULL) {
     259                rc = driver->driver_ops->dev_quiesce(dev);
     260        } else {
     261                /*
     262                 * If the driver does not implement quiesce, we will
     263                 * simply request all subordinate functions to quiesce.
     264                 */
     265                fibril_mutex_lock(&functions_mutex);
     266                link = list_first(&functions);
     267                while (link != NULL) {
     268                        fun = list_get_instance(link, ddf_fun_t, link);
     269                        if (fun->dev == dev)
     270                                ddf_fun_quiesce(fun);
     271                        link = list_next(link, &functions);
     272                }
     273                fibril_mutex_unlock(&functions_mutex);
     274                rc = EOK;
     275        }
     276
     277        dev_del_ref(dev);
     278        async_answer_0(icall, rc);
     279}
     280
    239281static void driver_fun_online(ipc_call_t *icall)
    240282{
     
    357399                case DRIVER_DEV_GONE:
    358400                        driver_dev_gone(&call);
     401                        break;
     402                case DRIVER_DEV_QUIESCE:
     403                        driver_dev_quiesce(&call);
    359404                        break;
    360405                case DRIVER_FUN_ONLINE:
     
    903948}
    904949
     950/** Quiesce function.
     951 *
     952 * @param fun Function to quiesce
     953 *
     954 * @return EOK on success or an error code
     955 *
     956 */
     957errno_t ddf_fun_quiesce(ddf_fun_t *fun)
     958{
     959        assert(fun->bound == true);
     960
     961        errno_t res = devman_drv_fun_quiesce(fun->handle);
     962        if (res != EOK)
     963                return res;
     964
     965        return EOK;
     966}
     967
    905968/** Add single match ID to inner function.
    906969 *
  • uspace/lib/drv/include/ddf/driver.h

    re494d7b reebecdc  
    8686/** Generic device driver operations */
    8787typedef struct driver_ops {
    88         /** Callback method for passing a new device to the device driver */
     88        /** Ask driver to add a new device */
    8989        errno_t (*dev_add)(ddf_dev_t *);
    9090
     
    9494        /** Inform driver a device disappeared */
    9595        errno_t (*dev_gone)(ddf_dev_t *);
     96
     97        /** Ask driver to quiesce device (disable interrupts and DMA) */
     98        errno_t (*dev_quiesce)(ddf_dev_t *);
    9699
    97100        /** Ask driver to online a specific function */
     
    129132extern errno_t ddf_fun_online(ddf_fun_t *);
    130133extern errno_t ddf_fun_offline(ddf_fun_t *);
     134extern errno_t ddf_fun_quiesce(ddf_fun_t *);
    131135extern errno_t ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
    132136extern void ddf_fun_set_ops(ddf_fun_t *, const ddf_dev_ops_t *);
  • uspace/lib/posix/meson.build

    re494d7b reebecdc  
    6161        'test/stdlib.c',
    6262        'test/unistd.c',
     63        'test/pthread/keys.c',
    6364)
    6465
  • uspace/lib/posix/src/pthread/keys.c

    re494d7b reebecdc  
    3636#include <pthread.h>
    3737#include <errno.h>
     38#include <fibril.h>
     39#include <stdatomic.h>
    3840#include "../internal/common.h"
     41
     42#include <stdio.h>
     43#define DPRINTF(format, ...) ((void) 0);
     44
     45static atomic_ushort next_key = 1; // skip the key 'zero'
     46
     47/*
     48 * For now, we just support maximum of 100 keys. This can be improved
     49 * in the future by implementing a dynamically growing array with
     50 * reallocations, but that will require more synchronization.
     51 */
     52#define PTHREAD_KEYS_MAX 100
     53
     54static fibril_local void *key_data[PTHREAD_KEYS_MAX];
    3955
    4056void *pthread_getspecific(pthread_key_t key)
    4157{
    42         not_implemented();
    43         return NULL;
     58        assert(key < PTHREAD_KEYS_MAX);
     59        assert(key < next_key);
     60        assert(key > 0);
     61
     62        DPRINTF("pthread_getspecific(%d) = %p\n", key, key_data[key]);
     63        return key_data[key];
    4464}
    4565
    4666int pthread_setspecific(pthread_key_t key, const void *data)
    4767{
    48         not_implemented();
    49         return ENOTSUP;
     68        DPRINTF("pthread_setspecific(%d, %p)\n", key, data);
     69        assert(key < PTHREAD_KEYS_MAX);
     70        assert(key < next_key);
     71        assert(key > 0);
     72
     73        key_data[key] = (void *) data;
     74        return EOK;
    5075}
    5176
    5277int pthread_key_delete(pthread_key_t key)
    5378{
     79        /* see https://github.com/HelenOS/helenos/pull/245#issuecomment-2706795848 */
    5480        not_implemented();
    55         return ENOTSUP;
     81        return EOK;
    5682}
    5783
    5884int pthread_key_create(pthread_key_t *key, void (*destructor)(void *))
    5985{
    60         not_implemented();
    61         return ENOTSUP;
     86        unsigned short k = atomic_fetch_add(&next_key, 1);
     87        DPRINTF("pthread_key_create(%p, %p) = %d\n", key, destructor, k);
     88        if (k >= PTHREAD_KEYS_MAX) {
     89                atomic_store(&next_key, PTHREAD_KEYS_MAX + 1);
     90                return ELIMIT;
     91        }
     92        if (destructor != NULL) {
     93                /* Inlined not_implemented() macro to add custom message */
     94                static int __not_implemented_counter = 0;
     95                if (__not_implemented_counter == 0) {
     96                        fprintf(stderr, "pthread_key_create: destructors not supported\n");
     97                }
     98                __not_implemented_counter++;
     99        }
     100
     101        *key = k;
     102        return EOK;
    62103}
    63104
  • uspace/lib/posix/test/main.c

    re494d7b reebecdc  
    3434PCUT_IMPORT(stdlib);
    3535PCUT_IMPORT(unistd);
     36PCUT_IMPORT(pthread_keys);
    3637
    3738PCUT_MAIN();
  • uspace/lib/system/include/ipc/system.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4545typedef enum {
    4646        SYSTEM_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
    47         SYSTEM_SHUTDOWN
     47        SYSTEM_POWEROFF,
     48        SYSTEM_RESTART
    4849} system_request_t;
    4950
  • uspace/lib/system/include/system.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4343extern errno_t system_open(const char *, system_cb_t *, void *, system_t **);
    4444extern void system_close(system_t *);
    45 extern errno_t system_shutdown(system_t *);
     45extern errno_t system_poweroff(system_t *);
     46extern errno_t system_restart(system_t *);
    4647
    4748#endif
  • uspace/lib/system/include/system_srv.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4949
    5050struct system_ops {
    51         errno_t (*shutdown)(void *);
     51        errno_t (*poweroff)(void *);
     52        errno_t (*restart)(void *);
    5253};
    5354
  • uspace/lib/system/src/system.c

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    141141}
    142142
    143 /** Shut the system down.
     143/** Shut down and power the system off.
    144144 *
    145145 * This function is asynchronous. It returns immediately with success
     
    151151 * @return EOK on succes or an error code
    152152 */
    153 errno_t system_shutdown(system_t *system)
     153errno_t system_poweroff(system_t *system)
    154154{
    155155        async_exch_t *exch = async_exchange_begin(system->sess);
    156         errno_t rc = async_req_0_0(exch, SYSTEM_SHUTDOWN);
     156        errno_t rc = async_req_0_0(exch, SYSTEM_POWEROFF);
     157        async_exchange_end(exch);
     158
     159        return rc;
     160}
     161
     162/** Shut down and restart the system.
     163 *
     164 * This function is asynchronous. It returns immediately with success
     165 * if the system started shutting down. Once shutdown is completed,
     166 * the @c shutdown_complete callback is executed. If the shutdown fails,
     167 * the @c shutdown_fail callback is executed.
     168 *
     169 * @param system System control service
     170 * @return EOK on succes or an error code
     171 */
     172errno_t system_restart(system_t *system)
     173{
     174        async_exch_t *exch = async_exchange_begin(system->sess);
     175        errno_t rc = async_req_0_0(exch, SYSTEM_RESTART);
    157176        async_exchange_end(exch);
    158177
  • uspace/lib/system/src/system_srv.c

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5555}
    5656
    57 static void system_shutdown_srv(system_srv_t *srv, ipc_call_t *icall)
     57static void system_poweroff_srv(system_srv_t *srv, ipc_call_t *icall)
    5858{
    5959        errno_t rc;
    6060
    61         if (srv->ops->shutdown == NULL) {
     61        if (srv->ops->poweroff == NULL) {
    6262                async_answer_0(icall, ENOTSUP);
    6363                return;
    6464        }
    6565
    66         rc = srv->ops->shutdown(srv->arg);
     66        rc = srv->ops->poweroff(srv->arg);
     67        async_answer_0(icall, rc);
     68}
     69
     70static void system_restart_srv(system_srv_t *srv, ipc_call_t *icall)
     71{
     72        errno_t rc;
     73
     74        if (srv->ops->restart == NULL) {
     75                async_answer_0(icall, ENOTSUP);
     76                return;
     77        }
     78
     79        rc = srv->ops->restart(srv->arg);
    6780        async_answer_0(icall, rc);
    6881}
     
    89102                        system_callback_create_srv(srv, &call);
    90103                        break;
    91                 case SYSTEM_SHUTDOWN:
    92                         system_shutdown_srv(srv, &call);
     104                case SYSTEM_POWEROFF:
     105                        system_poweroff_srv(srv, &call);
     106                        break;
     107                case SYSTEM_RESTART:
     108                        system_restart_srv(srv, &call);
    93109                        break;
    94110                default:
  • uspace/lib/system/test/system.c

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4646void test_system_conn(ipc_call_t *, void *);
    4747
    48 static errno_t test_shutdown(void *);
     48static errno_t test_poweroff(void *);
     49static errno_t test_restart(void *);
    4950
    5051static void test_sys_shutdown_complete(void *);
     
    5253
    5354static system_ops_t test_system_srv_ops = {
    54         .shutdown = test_shutdown
     55        .poweroff = test_poweroff,
     56        .restart = test_restart
    5557};
    5658
     
    6668        errno_t rc;
    6769
    68         bool shutdown_called;
     70        bool poweroff_called;
     71        bool restart_called;
    6972        bool shutdown_complete_called;
    7073        bool shutdown_failed_called;
     
    103106}
    104107
    105 /** system_shutdown() with server returning error response works */
    106 PCUT_TEST(shutdown_failure)
     108/** system_poweroff() with server returning error response works */
     109PCUT_TEST(poweroff_failure)
    107110{
    108111        errno_t rc;
     
    126129
    127130        resp.rc = ENOMEM;
    128         resp.shutdown_called = false;
    129 
    130         rc = system_shutdown(system);
    131         PCUT_ASSERT_TRUE(resp.shutdown_called);
     131        resp.poweroff_called = false;
     132
     133        rc = system_poweroff(system);
     134        PCUT_ASSERT_TRUE(resp.poweroff_called);
    132135        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
    133136
     
    138141}
    139142
    140 /** system_shutdown() with server returning success response works */
    141 PCUT_TEST(shutdown_success)
     143/** system_poweroff() with server returning success response works */
     144PCUT_TEST(poweroff_success)
    142145{
    143146        errno_t rc;
     
    161164
    162165        resp.rc = EOK;
    163         resp.shutdown_called = false;
    164 
    165         rc = system_shutdown(system);
    166         PCUT_ASSERT_TRUE(resp.shutdown_called);
     166        resp.poweroff_called = false;
     167
     168        rc = system_poweroff(system);
     169        PCUT_ASSERT_TRUE(resp.poweroff_called);
     170        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     171
     172        system_close(system);
     173        rc = loc_service_unregister(srv, sid);
     174        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     175        loc_server_unregister(srv);
     176}
     177
     178/** system_restart() with server returning error response works */
     179PCUT_TEST(restart_failure)
     180{
     181        errno_t rc;
     182        service_id_t sid;
     183        system_t *system = NULL;
     184        test_response_t resp;
     185        loc_srv_t *srv;
     186
     187        async_set_fallback_port_handler(test_system_conn, &resp);
     188
     189        // FIXME This causes this test to be non-reentrant!
     190        rc = loc_server_register(test_system_server, &srv);
     191        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     192
     193        rc = loc_service_register(srv, test_system_svc, &sid);
     194        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     195
     196        rc = system_open(test_system_svc, NULL, NULL, &system);
     197        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     198        PCUT_ASSERT_NOT_NULL(system);
     199
     200        resp.rc = ENOMEM;
     201        resp.restart_called = false;
     202
     203        rc = system_restart(system);
     204        PCUT_ASSERT_TRUE(resp.restart_called);
     205        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     206
     207        system_close(system);
     208        rc = loc_service_unregister(srv, sid);
     209        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     210        loc_server_unregister(srv);
     211}
     212
     213/** system_restart() with server returning success response works */
     214PCUT_TEST(restart_success)
     215{
     216        errno_t rc;
     217        service_id_t sid;
     218        system_t *system = NULL;
     219        test_response_t resp;
     220        loc_srv_t *srv;
     221
     222        async_set_fallback_port_handler(test_system_conn, &resp);
     223
     224        // FIXME This causes this test to be non-reentrant!
     225        rc = loc_server_register(test_system_server, &srv);
     226        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     227
     228        rc = loc_service_register(srv, test_system_svc, &sid);
     229        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     230
     231        rc = system_open(test_system_svc, NULL, NULL, &system);
     232        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     233        PCUT_ASSERT_NOT_NULL(system);
     234
     235        resp.rc = EOK;
     236        resp.restart_called = false;
     237
     238        rc = system_restart(system);
     239        PCUT_ASSERT_TRUE(resp.restart_called);
    167240        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
    168241
     
    279352}
    280353
    281 /** Test system shutdown.
     354/** Test system poweroff.
    282355 *
    283356 * @param arg Argument (test_response_t *)
    284357 */
    285 static errno_t test_shutdown(void *arg)
     358static errno_t test_poweroff(void *arg)
    286359{
    287360        test_response_t *resp = (test_response_t *)arg;
    288361
    289         resp->shutdown_called = true;
     362        resp->poweroff_called = true;
     363        return resp->rc;
     364}
     365
     366/** Test system restart.
     367 *
     368 * @param arg Argument (test_response_t *)
     369 */
     370static errno_t test_restart(void *arg)
     371{
     372        test_response_t *resp = (test_response_t *)arg;
     373
     374        resp->restart_called = true;
    290375        return resp->rc;
    291376}
  • uspace/lib/ui/include/types/ui/selectdialog.h

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4444typedef struct ui_select_dialog ui_select_dialog_t;
    4545
     46/** Select dialog flags */
     47typedef enum {
     48        /** Topmost window */
     49        usdf_topmost = 0x1,
     50        /** Place to the center of the screen */
     51        usdf_center = 0x2
     52} ui_select_dialog_flags_t;
     53
    4654/** Select dialog parameters */
    4755typedef struct {
     
    5058        /** Prompt text */
    5159        const char *prompt;
     60        /** Flags */
     61        ui_select_dialog_flags_t flags;
    5262} ui_select_dialog_params_t;
    5363
  • uspace/lib/ui/src/selectdialog.c

    re494d7b reebecdc  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    114114        ui_wnd_params_init(&wparams);
    115115        wparams.caption = params->caption;
     116
     117        if ((params->flags & usdf_topmost) != 0)
     118                wparams.flags |= wndf_topmost;
     119        if ((params->flags & usdf_center) != 0)
     120                wparams.placement = ui_wnd_place_center;
    116121
    117122        /* FIXME: Auto layout */
  • uspace/lib/usbhost/include/usb/host/hcd.h

    re494d7b reebecdc  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * Copyright (c) 2018 Ondrej Hlavaty
     
    101102        /** HC is gone. */
    102103        int (*hc_gone)(hc_device_t *);
     104
     105        /** Quiesce HC. */
     106        int (*hc_quiesce)(hc_device_t *);
    103107} hc_driver_t;
    104108
  • uspace/lib/usbhost/src/hcd.c

    re494d7b reebecdc  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * Copyright (c) 2018 Ondrej Hlavaty
     
    5859int hc_dev_remove(ddf_dev_t *);
    5960int hc_dev_gone(ddf_dev_t *);
     61int hc_dev_quiesce(ddf_dev_t *);
    6062int hc_fun_online(ddf_fun_t *);
    6163int hc_fun_offline(ddf_fun_t *);
     
    6567        .dev_remove = hc_dev_remove,
    6668        .dev_gone = hc_dev_gone,
     69        .dev_quiesce = hc_dev_quiesce,
    6770        .fun_online = hc_fun_online,
    6871        .fun_offline = hc_fun_offline,
     
    358361}
    359362
     363errno_t hc_dev_quiesce(ddf_dev_t *dev)
     364{
     365        errno_t err = ENOTSUP;
     366        hc_device_t *hcd = dev_to_hcd(dev);
     367
     368        if (hc_driver->hc_quiesce)
     369                err = hc_driver->hc_quiesce(hcd);
     370
     371        return err;
     372}
     373
    360374errno_t hc_fun_online(ddf_fun_t *fun)
    361375{
Note: See TracChangeset for help on using the changeset viewer.