qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V4 1/6] hw/block/nvme: introduce nvme-subsys device


From: Keith Busch
Subject: Re: [PATCH V4 1/6] hw/block/nvme: introduce nvme-subsys device
Date: Thu, 21 Jan 2021 14:52:02 -0800

On Fri, Jan 22, 2021 at 07:09:03AM +0900, Minwoo Im wrote:
> +static void nvme_subsys_setup(NvmeSubsystem *subsys)
> +{
> +    char *subnqn;
> +
> +    subnqn = g_strdup_printf("nqn.2019-08.org.qemu:%s", 
> subsys->parent_obj.id);
> +    strpadcpy((char *)subsys->subnqn, sizeof(subsys->subnqn), subnqn, '\0');
> +    g_free(subnqn);

Instead of the duplication and copy, you could format the string
directly into the destination:

    snprintf(subsys->subnqn, sizeof(subsys->subnqn), "nqn.2019-08.org.qemu:%s",
             subsys->parent_obj.id);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]