summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2012-06-11 13:35:34 -0400
committerStephen Smalley <sds@tycho.nsa.gov>2012-06-11 13:35:34 -0400
commita2e47cd90d84d48cde19575d044577a3fc7a4000 (patch)
tree6f709ed47e5e7c5e40c9f47b0ce8206a7d9348fd
parent52cd377a74a710b2476c6a4c46da8b59a0dce50d (diff)
downloadlibselinux-a2e47cd90d84d48cde19575d044577a3fc7a4000.tar.gz
Change selabel_open and label backends to take a const struct selinux_opt argument.
-rw-r--r--include/selinux/label.h3
-rw-r--r--src/label.c9
-rw-r--r--src/label_android_property.c7
-rw-r--r--src/label_file.c4
-rw-r--r--src/label_internal.h10
5 files changed, 19 insertions, 14 deletions
diff --git a/include/selinux/label.h b/include/selinux/label.h
index 8263f32..d3f68e4 100644
--- a/include/selinux/label.h
+++ b/include/selinux/label.h
@@ -68,7 +68,8 @@ struct selabel_handle;
* @errno set on failure.
*/
struct selabel_handle *selabel_open(unsigned int backend,
- struct selinux_opt *opts, unsigned nopts);
+ const struct selinux_opt *opts,
+ unsigned nopts);
/**
* selabel_close - Close a labeling handle.
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 @@ static selabel_initfunc initfuncs[] = {
* 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 @@ out:
*/
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 @@ static int process_line(struct selabel_handle *rec,
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 @@ static void stats(struct selabel_handle __attribute__((unused)) *rec)
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 @@ static int process_line(struct selabel_handle *rec,
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 @@ static void stats(struct selabel_handle *rec)
}
}
-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