Change selabel_open and label backends to take a const struct selinux_opt argument.
diff --git a/src/label.c b/src/label.c
index 490d832..82d25d0 100644
--- a/src/label.c
+++ b/src/label.c
@@ -17,7 +17,8 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
typedef int (*selabel_initfunc)(struct selabel_handle *rec,
- struct selinux_opt *opts, unsigned nopts);
+ const struct selinux_opt *opts,
+ unsigned nopts);
static selabel_initfunc initfuncs[] = {
&selabel_file_init,
@@ -31,7 +32,8 @@
* Validation functions
*/
-static inline int selabel_is_validate_set(struct selinux_opt *opts, unsigned n)
+static inline int selabel_is_validate_set(const struct selinux_opt *opts,
+ unsigned n)
{
while (n--)
if (opts[n].type == SELABEL_OPT_VALIDATE)
@@ -62,7 +64,8 @@
*/
struct selabel_handle *selabel_open(unsigned int backend,
- struct selinux_opt *opts, unsigned nopts)
+ const struct selinux_opt *opts,
+ unsigned nopts)
{
struct selabel_handle *rec = NULL;
diff --git a/src/label_android_property.c b/src/label_android_property.c
index cf73ec1..b1837c4 100644
--- a/src/label_android_property.c
+++ b/src/label_android_property.c
@@ -132,7 +132,7 @@
return 0;
}
-static int init(struct selabel_handle *rec, struct selinux_opt *opts,
+static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned n)
{
struct saved_data *data = (struct saved_data *)rec->data;
@@ -277,8 +277,9 @@
selinux_log(SELINUX_WARNING, "'stats' functionality not implemented.\n");
}
-int selabel_property_init(struct selabel_handle *rec, struct selinux_opt *opts,
- unsigned nopts)
+int selabel_property_init(struct selabel_handle *rec,
+ const struct selinux_opt *opts,
+ unsigned nopts)
{
struct saved_data *data;
diff --git a/src/label_file.c b/src/label_file.c
index 71f1ef5..2934fdf 100644
--- a/src/label_file.c
+++ b/src/label_file.c
@@ -384,7 +384,7 @@
return 0;
}
-static int init(struct selabel_handle *rec, struct selinux_opt *opts,
+static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned n)
{
struct saved_data *data = (struct saved_data *)rec->data;
@@ -663,7 +663,7 @@
}
}
-int selabel_file_init(struct selabel_handle *rec, struct selinux_opt *opts,
+int selabel_file_init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned nopts)
{
struct saved_data *data;
diff --git a/src/label_internal.h b/src/label_internal.h
index 5192d4d..e9007a2 100644
--- a/src/label_internal.h
+++ b/src/label_internal.h
@@ -17,16 +17,16 @@
/*
* Installed backends
*/
-int selabel_file_init(struct selabel_handle *rec, struct selinux_opt *opts,
+int selabel_file_init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned nopts) hidden;
-int selabel_media_init(struct selabel_handle *rec, struct selinux_opt *opts,
+int selabel_media_init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned nopts) hidden;
-int selabel_x_init(struct selabel_handle *rec, struct selinux_opt *opts,
+int selabel_x_init(struct selabel_handle *rec, const struct selinux_opt *opts,
unsigned nopts) hidden;
int selabel_db_init(struct selabel_handle *rec,
- struct selinux_opt *opts, unsigned nopts) hidden;
+ const struct selinux_opt *opts, unsigned nopts) hidden;
int selabel_property_init(struct selabel_handle *rec,
- struct selinux_opt *opts, unsigned nopts) hidden;
+ const struct selinux_opt *opts, unsigned nopts) hidden;
/*
* Labeling internal structures