[ltt-dev] [PATCH 7/6] api: adjust license

Paolo Bonzini pbonzini at redhat.com
Sun Aug 14 13:21:55 EDT 2011

On 08/13/2011 12:30 AM, Mathieu Desnoyers wrote:
>> The Linux kernel code is probably not copyrightable anymore.
> What do you mean ? If there is still code taken from the Linux kernel in
> this api.h test file, we need to keep the licensing comment as-is.

The only part that has some similarity with Linux kernel code is
the per-thread variables:

#define DEFINE_PER_THREAD(type, name) \
        struct { \
                __typeof__(type) v \
                        __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))); \
        } __per_thread_##name[NR_THREADS];
#define DECLARE_PER_THREAD(type, name) extern DEFINE_PER_THREAD(type, name)

#define per_thread(name, thread) __per_thread_##name[thread].v
#define __get_thread_var(name) per_thread(name, smp_thread_id())

#define init_per_thread(name, v) \
        do { \
                int __i_p_t_i; \
                for (__i_p_t_i = 0; __i_p_t_i < NR_THREADS; __i_p_t_i++) \
                        per_thread(name, __i_p_t_i) = v; \
        } while (0)

DEFINE_PER_THREAD(int, smp_processor_id);

This is very similar to the per-cpu code.  But there is really just one
way to write this code.


More information about the lttng-dev mailing list