[ovs-dev] [threads 23/23] vlog: Mark vlog_module_ptr_* as const.

Alex Wang alexw at nicira.com
Tue Jul 23 15:07:55 UTC 2013


Looks good to me,

Want to ask, the "section" attribute specifies that the pointer is placed
in "vlog_modules"" section. And this section is automatically created by
compiler, right?

Thanks,


On Thu, Jul 18, 2013 at 4:15 PM, Ben Pfaff <blp at nicira.com> wrote:

> This makes them more obviously thread-safe.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/vlog.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vlog.h b/lib/vlog.h
> index 9576687..c111ff6 100644
> --- a/lib/vlog.h
> +++ b/lib/vlog.h
> @@ -88,8 +88,8 @@ struct vlog_module {
>  #if USE_LINKER_SECTIONS
>  #define VLOG_DEFINE_MODULE(MODULE)                                      \
>          VLOG_DEFINE_MODULE__(MODULE)                                    \
> -        extern struct vlog_module *vlog_module_ptr_##MODULE;            \
> -        struct vlog_module *vlog_module_ptr_##MODULE                    \
> +        extern struct vlog_module *const vlog_module_ptr_##MODULE;      \
> +        struct vlog_module *const vlog_module_ptr_##MODULE              \
>              __attribute__((section("vlog_modules"))) = &VLM_##MODULE
>  #else
>  #define VLOG_DEFINE_MODULE(MODULE) extern struct vlog_module VLM_##MODULE
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130723/b9ef8b3f/attachment-0003.html>


More information about the dev mailing list