提交 89939e13 编写于 作者: P Peter Krempa

util: seclabel: Add deep copy function for device labels

上级 756b46dd
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册