mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
util: seclabel: Add deep copy function for device labels
This commit is contained in:
parent
756b46ddd2
commit
89939e1301
@ -80,3 +80,26 @@ virSecurityDeviceLabelDefNew(const char *model)
|
||||
|
||||
return seclabel;
|
||||
}
|
||||
|
||||
|
||||
virSecurityDeviceLabelDefPtr
|
||||
virSecurityDeviceLabelDefCopy(const virSecurityDeviceLabelDef *src)
|
||||
{
|
||||
virSecurityDeviceLabelDefPtr ret;
|
||||
|
||||
if (VIR_ALLOC(ret) < 0)
|
||||
return NULL;
|
||||
|
||||
ret->norelabel = src->norelabel;
|
||||
ret->labelskip = src->labelskip;
|
||||
|
||||
if (VIR_STRDUP(ret->model, src->model) < 0 ||
|
||||
VIR_STRDUP(ret->label, src->label) < 0)
|
||||
goto error;
|
||||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
virSecurityDeviceLabelDefFree(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ struct _virSecurityLabelDef {
|
||||
};
|
||||
|
||||
|
||||
/* Security configuration for domain */
|
||||
/* Security configuration for device */
|
||||
typedef struct _virSecurityDeviceLabelDef virSecurityDeviceLabelDef;
|
||||
typedef virSecurityDeviceLabelDef *virSecurityDeviceLabelDefPtr;
|
||||
struct _virSecurityDeviceLabelDef {
|
||||
@ -61,6 +61,10 @@ virSecurityLabelDefNew(const char *model);
|
||||
virSecurityDeviceLabelDefPtr
|
||||
virSecurityDeviceLabelDefNew(const char *model);
|
||||
|
||||
virSecurityDeviceLabelDefPtr
|
||||
virSecurityDeviceLabelDefCopy(const virSecurityDeviceLabelDef *src)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void virSecurityLabelDefFree(virSecurityLabelDefPtr def);
|
||||
void virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user