struct assignment?

Javier Martinez Canillas martinez.javier at gmail.com
Sat Feb 19 17:08:28 EST 2011


> I found there seems no declaring about "struct ftrace_entry".
>
> usually we use a struct we will declare its elements such as:
>
> struct usb_host_endpoint {
>        struct usb_endpoint_descriptor  desc;
>        struct list_head                urb_list;
>        void                            *hcpriv;
> ......................
> };
>

There is not an "explicit" declaration but if you look at
kernel/trace/trace.h you will find this macro:

#define FTRACE_ENTRY(name, struct_name, id, tstruct, print)     \
        struct struct_name {                                    \
                struct trace_entry      ent;                    \
                tstruct                                         \
        }

> I guess the secret should be "if_assign", but how does compiler interpret it?
>
> --

Actually in kernel/trace/trace_entries.h the macro is used to declare
the ftrace_entry

FTRACE_ENTRY(function, ftrace_entry,

        TRACE_FN,

        F_STRUCT(
                __field(        unsigned long,  ip              )
                __field(        unsigned long,  parent_ip       )
        ),

        F_printk(" %lx <-- %lx", __entry->ip, __entry->parent_ip)
);

Also in this header other structures are declared in the same way for
example ftrace_graph_ent_entry and and ftrace_graph_ret_entry. If you
search for "struct ftrace_graph_ret_entry" declaration you won't find
anything either.

Best regards,

-- 
-----------------------------------------
Javier Martínez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat Autònoma de Barcelona
Barcelona, Spain



More information about the Kernelnewbies mailing list