Changeset d858a660 in mainline


Ignore:
Timestamp:
2017-07-04T15:05:43Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c2c7d2
Parents:
2456fd0
Message:

Fdisk should print volume labels.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/fdisk/fdisk.c

    r2456fd0 rd858a660  
    677677        char *svcname = NULL;
    678678        char *spkind;
     679        const char *label;
    679680        int rc;
    680681        int npart;
     
    717718        fdisk_dev_get_flags(dev, &dflags);
    718719
    719         printf("Device: %s, %s\n", sdcap, svcname);
     720        printf("Device: %s (%s)\n", svcname, sdcap);
    720721        free(sdcap);
    721722        sdcap = NULL;
     
    769770                }
    770771
     772                if (str_size(pinfo.label) > 0)
     773                        label = pinfo.label;
     774                else
     775                        label = "(No label)";
     776
    771777                if (linfo.ltype == lt_none)
    772                         printf("Entire disk: %s", scap);
     778                        printf("Entire disk: %s %s", label, scap);
    773779                else
    774                         printf("Partition %d: %s", npart, scap);
     780                        printf("Partition %d: %s %s", npart, label, scap);
    775781
    776782                if ((linfo.flags & lf_ext_supp) != 0) {
  • uspace/lib/c/include/ipc/vol.h

    r2456fd0 rd858a660  
    3636#include <ipc/common.h>
    3737
     38#define VOL_LABEL_MAXLEN 63
     39
    3840typedef enum {
    3941        VOL_GET_PARTS = IPC_FIRST_USER_METHOD,
  • uspace/lib/c/include/types/vol.h

    r2456fd0 rd858a660  
    3737
    3838#include <async.h>
     39#include <ipc/vol.h>
    3940
    4041typedef enum {
     
    7172        /** Filesystem type */
    7273        vol_fstype_t fstype;
     74        /** Volume label */
     75        char label[VOL_LABEL_MAXLEN + 1];
    7376} vol_part_info_t;
    7477
  • uspace/lib/fdisk/include/types/fdisk.h

    r2456fd0 rd858a660  
    187187        /** Service ID */
    188188        service_id_t svc_id;
     189        /** Volume label */
     190        char *label;
    189191} fdisk_part_t;
    190192
     
    209211        /** File system type */
    210212        vol_fstype_t fstype;
     213        /** Volume label */
     214        char *label;
    211215} fdisk_part_info_t;
    212216
  • uspace/lib/fdisk/src/fdisk.c

    r2456fd0 rd858a660  
    269269                part->pcnt = vpinfo.pcnt;
    270270                part->fstype = vpinfo.fstype;
     271                part->label = str_dup(vpinfo.label);
    271272        }
    272273
     
    301302        return EOK;
    302303error:
     304        if (part != NULL)
     305                free(part->label);
    303306        free(part);
    304307        return rc;
     
    315318        if (link_used(&part->llog_ba))
    316319                list_remove(&part->llog_ba);
     320
     321        free(part->label);
    317322        free(part);
    318323}
     
    667672        info->fstype = part->fstype;
    668673        info->pkind = part->pkind;
     674        info->label = part->label;
    669675        return EOK;
    670676}
  • uspace/srv/volsrv/part.c

    r2456fd0 rd858a660  
    186186                part->pcnt = vpc_fs;
    187187                part->fstype = fst->fstype;
     188                part->label = str_dup(info.label);
     189                if (part->label == NULL)
     190                        goto error;
    188191        } else {
    189192                log_msg(LOG_DEFAULT, LVL_NOTE, "Partition does not contain "
     
    198201
    199202                part->pcnt = empty ? vpc_empty : vpc_unknown;
     203                part->label = str_dup("");
     204                if (part->label == NULL)
     205                        goto error;
    200206        }
    201207
     
    327333        pinfo->pcnt = part->pcnt;
    328334        pinfo->fstype = part->fstype;
     335        str_cpy(pinfo->label, sizeof(pinfo->label), part->label);
    329336        return EOK;
    330337}
  • uspace/srv/volsrv/types/part.h

    r2456fd0 rd858a660  
    5252        /** Filesystem type */
    5353        vol_fstype_t fstype;
     54        /** Volume label */
     55        char *label;
    5456} vol_part_t;
    5557
Note: See TracChangeset for help on using the changeset viewer.