Changeset 63c1dd5 in mainline for uspace/lib/c


Ignore:
Timestamp:
2018-10-09T08:40:53Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63a045c
Parents:
ee9c703
git-author:
Jiri Svoboda <jiri@…> (2018-10-08 18:38:16)
git-committer:
Jiri Svoboda <jiri@…> (2018-10-09 08:40:53)
Message:

Persistence of Tetris highscore table. Detect live mode and create directory structure in init task. Reading volume configuration, vol -c.

Location:
uspace/lib/c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vol.c

    ree9c703 r63c1dd5  
    528528}
    529529
     530/** Get list of volumes as array of volume IDs.
     531 *
     532 * @param vol Volume service
     533 * @param data Place to store pointer to array
     534 * @param count Place to store length of array (number of entries)
     535 *
     536 * @return EOK on success or an error code
     537 */
     538errno_t vol_get_volumes(vol_t *vol, volume_id_t **data, size_t *count)
     539{
     540        return vol_get_ids_internal(vol, VOL_GET_VOLUMES, 0,
     541            (sysarg_t **) data, count);
     542}
     543
     544/** Get volume configuration information.
     545 *
     546 * @param vol Volume service
     547 * @param vid Volume ID
     548 * @param vinfo Place to sore volume configuration information
     549 * @return EOK on success or an error code
     550 */
     551errno_t vol_info(vol_t *vol, volume_id_t vid, vol_info_t *vinfo)
     552{
     553        async_exch_t *exch;
     554        errno_t retval;
     555        ipc_call_t answer;
     556
     557        exch = async_exchange_begin(vol->sess);
     558        aid_t req = async_send_1(exch, VOL_INFO, vid.id, &answer);
     559
     560        errno_t rc = async_data_read_start(exch, vinfo, sizeof(vol_info_t));
     561        async_exchange_end(exch);
     562        if (rc != EOK) {
     563                async_forget(req);
     564                return EIO;
     565        }
     566
     567        async_wait_for(req, &retval);
     568        if (retval != EOK)
     569                return EIO;
     570
     571        return EOK;
     572}
     573
    530574/** @}
    531575 */
  • uspace/lib/c/include/ipc/vol.h

    ree9c703 r63c1dd5  
    4848        VOL_PART_LSUPP,
    4949        VOL_PART_MKFS,
    50         VOL_PART_SET_MOUNTP
     50        VOL_PART_SET_MOUNTP,
     51        VOL_GET_VOLUMES,
     52        VOL_INFO
    5153} vol_request_t;
    5254
  • uspace/lib/c/include/types/vol.h

    ree9c703 r63c1dd5  
    4141#include <stdbool.h>
    4242
     43typedef struct {
     44        sysarg_t id;
     45} volume_id_t;
     46
    4347typedef enum {
    4448        /** Partition is empty */
     
    8286} vol_part_info_t;
    8387
     88/** Volume configuration information */
     89typedef struct {
     90        /** Volume identifier */
     91        volume_id_t id;
     92        /** Volume label */
     93        char label[VOL_LABEL_MAXLEN + 1];
     94        /** Mount path */
     95        char path[MAX_PATH_LEN + 1]; /* XXX too big */
     96} vol_info_t;
     97
    8498/** Volume label support */
    8599typedef struct {
  • uspace/lib/c/include/vol.h

    ree9c703 r63c1dd5  
    5555    const char *);
    5656extern errno_t vol_part_set_mountp(vol_t *, service_id_t, const char *);
    57 
     57extern errno_t vol_get_volumes(vol_t *, volume_id_t **, size_t *);
     58extern errno_t vol_info(vol_t *, volume_id_t, vol_info_t *);
    5859extern errno_t vol_fstype_format(vol_fstype_t, char **);
    5960extern errno_t vol_pcnt_fs_format(vol_part_cnt_t, vol_fstype_t, char **);
Note: See TracChangeset for help on using the changeset viewer.