'const fooPtr' is the same as 'foo * const' (the pointer won't
change, but it's contents can). But in general, if an interface
is trying to be const-correct, it should be using 'const foo *'
(the pointer is to data that can't be changed).
Fix up offenders in src/security.
* src/security/security_apparmor.c (reload_profile)
(AppArmorSetSecurityHostdevLabelHelper)
(AppArmorReleaseSecurityLabel, AppArmorRestoreSecurityAllLabel)
(AppArmorSetSecurityProcessLabel)
(AppArmorSetSecurityChildProcessLabel)
(AppArmorSetSecurityImageLabel, AppArmorSecurityVerify)
(AppArmorSetSecurityHostdevLabel)
(AppArmorRestoreSecurityHostdevLabel, AppArmorSetFDLabel): Drop
needless const.
* src/security/security_selinux.c
(virSecuritySELinuxSetSecurityFileLabel): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/security/security_apparmor.c | 22 +++++++++++-----------
src/security/security_selinux.c | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index adc9918..30e4c3f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -267,7 +267,7 @@ reload_profile(virSecurityManagerPtr mgr,
{
int rc = -1;
char *profile_name = NULL;
- const virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(
+ virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(
def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -304,7 +304,7 @@ AppArmorSetSecurityHostdevLabelHelper(const char *file, void *opaque)
virDomainDefPtr def = ptr->def;
if (reload_profile(ptr->mgr, def, file, true) < 0) {
- const virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(
+ virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(
def, SECURITY_APPARMOR_NAME);
if (!secdef) {
virReportOOMError();
@@ -528,7 +528,7 @@ static int
AppArmorReleaseSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
virDomainDefPtr def)
{
- const virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(def,
+ virSecurityLabelDefPtr secdef = virDomainDefGetSecurityLabelDef(def,
SECURITY_APPARMOR_NAME);
if (!secdef)
return -1;
@@ -547,7 +547,7 @@ AppArmorRestoreSecurityAllLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
int migrated ATTRIBUTE_UNUSED)
{
int rc = 0;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -572,7 +572,7 @@ AppArmorSetSecurityProcessLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
{
int rc = -1;
char *profile_name = NULL;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -616,7 +616,7 @@ AppArmorSetSecurityChildProcessLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
{
int rc = -1;
char *profile_name = NULL;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -684,7 +684,7 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
{
int rc = -1;
char *profile_name = NULL;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -731,7 +731,7 @@ static int
AppArmorSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
virDomainDefPtr def)
{
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -765,7 +765,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
{
struct SDPDOP *ptr;
int ret = -1;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -862,7 +862,7 @@ AppArmorRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
const char *vroot ATTRIBUTE_UNUSED)
{
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
@@ -900,7 +900,7 @@ AppArmorSetFDLabel(virSecurityManagerPtr mgr,
char *proc = NULL;
char *fd_path = NULL;
- const virSecurityLabelDefPtr secdef =
+ virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
if (!secdef)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index c408fa8..6c0b0bb 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1198,7 +1198,7 @@ virSecuritySELinuxSetSecurityFileLabel(virDomainDiskDefPtr disk,
int ret;
virSecurityDeviceLabelDefPtr disk_seclabel;
virSecuritySELinuxCallbackDataPtr cbdata = opaque;
- const virSecurityLabelDefPtr secdef = cbdata->secdef;
+ virSecurityLabelDefPtr secdef = cbdata->secdef;
virSecuritySELinuxDataPtr data =
virSecurityManagerGetPrivateData(cbdata->manager);
disk_seclabel = virDomainDiskDefGetSecurityLabelDef(disk,
--
1.8.3.1