bdev/gpt: dump partition name
Change-Id: I1899a47fa9d9821c16ea648bbe3290f6306d0e3d Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/368626 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
429672d31b
commit
cb29ce869f
@ -135,7 +135,7 @@ struct spdk_gpt_partition_entry {
|
|||||||
uint64_t reserved_uefi : 45;
|
uint64_t reserved_uefi : 45;
|
||||||
uint64_t guid_specific : 16;
|
uint64_t guid_specific : 16;
|
||||||
} attr;
|
} attr;
|
||||||
uint8_t partition_name[72];
|
uint16_t partition_name[36];
|
||||||
};
|
};
|
||||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_gpt_partition_entry) == 128, "size incorrect");
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_gpt_partition_entry) == 128, "size incorrect");
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "spdk/io_channel.h"
|
#include "spdk/io_channel.h"
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
#include "spdk/util.h"
|
||||||
|
|
||||||
#include "spdk_internal/bdev.h"
|
#include "spdk_internal/bdev.h"
|
||||||
#include "spdk_internal/log.h"
|
#include "spdk_internal/log.h"
|
||||||
@ -293,6 +294,19 @@ write_guid(struct spdk_json_write_ctx *w, const struct spdk_gpt_guid *guid)
|
|||||||
from_be32(&guid->raw[12]));
|
from_be32(&guid->raw[12]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_string_utf16le(struct spdk_json_write_ctx *w, const uint16_t *str, size_t max_len)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
const uint16_t *p;
|
||||||
|
|
||||||
|
for (len = 0, p = str; len < max_len && *p; p++) {
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
|
||||||
|
spdk_json_write_string_utf16le_raw(w, str, len);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vbdev_gpt_dump_config_json(void *ctx, struct spdk_json_write_ctx *w)
|
vbdev_gpt_dump_config_json(void *ctx, struct spdk_json_write_ctx *w)
|
||||||
{
|
{
|
||||||
@ -315,6 +329,9 @@ vbdev_gpt_dump_config_json(void *ctx, struct spdk_json_write_ctx *w)
|
|||||||
spdk_json_write_name(w, "unique_partition_guid");
|
spdk_json_write_name(w, "unique_partition_guid");
|
||||||
write_guid(w, &gpt_entry->unique_partition_guid);
|
write_guid(w, &gpt_entry->unique_partition_guid);
|
||||||
|
|
||||||
|
spdk_json_write_name(w, "partition_name");
|
||||||
|
write_string_utf16le(w, gpt_entry->partition_name, SPDK_COUNTOF(gpt_entry->partition_name));
|
||||||
|
|
||||||
spdk_json_write_object_end(w);
|
spdk_json_write_object_end(w);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -31,7 +31,7 @@ if [ $(uname -s) = Linux ] && [ -f /usr/sbin/sgdisk ]; then
|
|||||||
waitforbdev Nvme0n1 $rootdir/scripts/rpc.py
|
waitforbdev Nvme0n1 $rootdir/scripts/rpc.py
|
||||||
|
|
||||||
if [ -e /dev/nbd0 ]; then
|
if [ -e /dev/nbd0 ]; then
|
||||||
parted -s /dev/nbd0 mklabel gpt mkpart primary '0%' '50%' mkpart primary '50%' '100%'
|
parted -s /dev/nbd0 mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%'
|
||||||
# change the partition type GUID to SPDK GUID value
|
# change the partition type GUID to SPDK GUID value
|
||||||
/usr/sbin/sgdisk -t 1:$SPDK_GPT_GUID /dev/nbd0
|
/usr/sbin/sgdisk -t 1:$SPDK_GPT_GUID /dev/nbd0
|
||||||
/usr/sbin/sgdisk -t 2:$SPDK_GPT_GUID /dev/nbd0
|
/usr/sbin/sgdisk -t 2:$SPDK_GPT_GUID /dev/nbd0
|
||||||
|
Loading…
Reference in New Issue
Block a user