Changeset 70815a24 in mainline


Ignore:
Timestamp:
2015-07-09T22:00:34Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b7a4d06
Parents:
bf7ddde
Message:

Generate GUIDs for new GPT labels and partitions.

Location:
uspace/lib
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    rbf7ddde r70815a24  
    154154        generic/assert.c \
    155155        generic/pio_trace.c \
     156        generic/uuid.c \
    156157        generic/vbd.c \
    157158        generic/vol.c
  • uspace/lib/label/include/types/liblabel.h

    rbf7ddde r70815a24  
    4141#include <sys/types.h>
    4242#include <vol.h>
     43#include <uuid.h>
    4344
    4445typedef struct label label_t;
     
    9697        /** Partition type */
    9798        uint64_t ptype;
     99        /** Partition UUID */
     100        uuid_t part_uuid;
    98101};
    99102
  • uspace/lib/label/src/gpt.c

    rbf7ddde r70815a24  
    4040#include <mem.h>
    4141#include <stdlib.h>
     42#include <uuid.h>
    4243
    4344#include "std/gpt.h"
     
    335336        uint64_t resv_blocks;
    336337        uint32_t pt_crc;
     338        uuid_t disk_uuid;
    337339        int i, j;
    338340        int rc;
     
    399401                        goto error;
    400402                }
     403
     404                uuid_generate(&disk_uuid);
    401405
    402406                for (j = 0; j < 8; ++j)
     
    409413                gpt_hdr->first_usable_lba = host2uint64_t_le(ba_min);
    410414                gpt_hdr->last_usable_lba = host2uint64_t_le(ba_max);
    411                 //gpt_hdr->disk_guid XXX
     415                uuid_encode(&disk_uuid, gpt_hdr->disk_guid);
    412416                gpt_hdr->entry_lba = host2uint64_t_le(ptba[i]);
    413417                gpt_hdr->num_entries = host2uint32_t_le(num_entries);
     
    594598        part->nblocks = pspec->nblocks;
    595599        part->ptype = pspec->ptype;
     600        uuid_generate(&part->part_uuid);
    596601
    597602        /* Prepare partition table entry */
     
    651656        memset(pte, 0, sizeof(gpt_entry_t));
    652657        pte->part_type[0] = 0x12;
    653         pte->part_id[0] = 0x34;
     658        uuid_encode(&part->part_uuid, pte->part_id);
    654659        pte->start_lba = host2uint64_t_le(part->block0);
    655660        pte->end_lba = host2uint64_t_le(eblock);
     
    686691        part->block0 = b0;
    687692        part->nblocks = b1 - b0 + 1;
     693        uuid_decode(pte->part_id, &part->part_uuid);
    688694
    689695        part->label = label;
Note: See TracChangeset for help on using the changeset viewer.