Message ID | 20200420114650.19093-1-cgzones@googlemail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libselinux: mark security_context_t typedef as deprecated | expand |
On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche <cgzones@googlemail.com> wrote: > > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.") > > Use a wrapper macro, because swig does not accept typedef attributes. > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org> If nobody raises an objection, I will merge the patch tomorrow. Thanks, Nicolas > --- > libselinux/include/selinux/selinux.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h > index 6a512b38..f88a0363 100644 > --- a/libselinux/include/selinux/selinux.h > +++ b/libselinux/include/selinux/selinux.h > @@ -8,13 +8,21 @@ > extern "C" { > #endif > > +#ifndef _selinux_deprecated > +#ifdef __GNUC__ > +#define _selinux_deprecated __attribute__ ((deprecated)) > +#else > +#define _selinux_deprecated > +#endif > +#endif > + > /* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */ > extern int is_selinux_enabled(void); > /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ > extern int is_selinux_mls_enabled(void); > > /* No longer used; here for compatibility with legacy callers. */ > -typedef char *security_context_t; > +typedef char *security_context_t _selinux_deprecated; > > /* Free the memory allocated for a context by any of the below get* calls. */ > extern void freecon(char * con); > -- > 2.26.1 >
Am So., 26. Apr. 2020 um 20:14 Uhr schrieb Nicolas Iooss <nicolas.iooss@m4x.org>: > > On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche > <cgzones@googlemail.com> wrote: > > > > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.") > > > > Use a wrapper macro, because swig does not accept typedef attributes. > > > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> > > Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org> > > If nobody raises an objection, I will merge the patch tomorrow. Maybe this should be delayed after the deprecation patch series from William Roberts to match the same style; e.g. this patch uses a helper macro. I'll prepare an updated patch.
On Mon, Apr 27, 2020 at 3:10 PM Christian Göttsche <cgzones@googlemail.com> wrote: > > Am So., 26. Apr. 2020 um 20:14 Uhr schrieb Nicolas Iooss > <nicolas.iooss@m4x.org>: > > > > On Mon, Apr 20, 2020 at 1:47 PM Christian Göttsche > > <cgzones@googlemail.com> wrote: > > > > > > Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.") > > > > > > Use a wrapper macro, because swig does not accept typedef attributes. > > > > > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> > > > > Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org> > > > > If nobody raises an objection, I will merge the patch tomorrow. > > Maybe this should be delayed after the deprecation patch series from > William Roberts to match the same style; > e.g. this patch uses a helper macro. > > I'll prepare an updated patch. I was just about to look at this and suggest the same thing. I didn't put a macro like this in selinux.h for the simple reason that I didn't want to make it something considered public API. I avoided if SWIG, since its really a gnuc extension that most compilers support, and its inline with the other extensions that get buy the SWIG build. I would nack it for those two reasons. I just sent V4 of the series, so hopefully that one sticks. If you wan't you can update the style now and resubmit. As we can merge it in parallel to my series (there is no hard dependency), so you don't have to wait for my series to land.
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h index 6a512b38..f88a0363 100644 --- a/libselinux/include/selinux/selinux.h +++ b/libselinux/include/selinux/selinux.h @@ -8,13 +8,21 @@ extern "C" { #endif +#ifndef _selinux_deprecated +#ifdef __GNUC__ +#define _selinux_deprecated __attribute__ ((deprecated)) +#else +#define _selinux_deprecated +#endif +#endif + /* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */ extern int is_selinux_enabled(void); /* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ extern int is_selinux_mls_enabled(void); /* No longer used; here for compatibility with legacy callers. */ -typedef char *security_context_t; +typedef char *security_context_t _selinux_deprecated; /* Free the memory allocated for a context by any of the below get* calls. */ extern void freecon(char * con);
Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.") Use a wrapper macro, because swig does not accept typedef attributes. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- libselinux/include/selinux/selinux.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)