@@ -1798,7 +1798,6 @@ struct event_trigger_data {
17981798 unsigned long count ;
17991799 int ref ;
18001800 int flags ;
1801- const struct event_trigger_ops * ops ;
18021801 struct event_command * cmd_ops ;
18031802 struct event_filter __rcu * filter ;
18041803 char * filter_str ;
@@ -1889,73 +1888,6 @@ extern void event_trigger_unregister(struct event_command *cmd_ops,
18891888extern void event_file_get (struct trace_event_file * file );
18901889extern void event_file_put (struct trace_event_file * file );
18911890
1892- /**
1893- * struct event_trigger_ops - callbacks for trace event triggers
1894- *
1895- * The methods in this structure provide per-event trigger hooks for
1896- * various trigger operations.
1897- *
1898- * The @init and @free methods are used during trigger setup and
1899- * teardown, typically called from an event_command's @parse()
1900- * function implementation.
1901- *
1902- * The @print method is used to print the trigger spec.
1903- *
1904- * The @trigger method is the function that actually implements the
1905- * trigger and is called in the context of the triggering event
1906- * whenever that event occurs.
1907- *
1908- * All the methods below, except for @init() and @free(), must be
1909- * implemented.
1910- *
1911- * @trigger: The trigger 'probe' function called when the triggering
1912- * event occurs. The data passed into this callback is the data
1913- * that was supplied to the event_command @reg() function that
1914- * registered the trigger (see struct event_command) along with
1915- * the trace record, rec.
1916- *
1917- * @count_func: If defined and a numeric parameter is passed to the
1918- * trigger, then this function will be called before @trigger
1919- * is called. If this function returns false, then @trigger is not
1920- * executed.
1921- *
1922- * @init: An optional initialization function called for the trigger
1923- * when the trigger is registered (via the event_command reg()
1924- * function). This can be used to perform per-trigger
1925- * initialization such as incrementing a per-trigger reference
1926- * count, for instance. This is usually implemented by the
1927- * generic utility function @event_trigger_init() (see
1928- * trace_event_triggers.c).
1929- *
1930- * @free: An optional de-initialization function called for the
1931- * trigger when the trigger is unregistered (via the
1932- * event_command @reg() function). This can be used to perform
1933- * per-trigger de-initialization such as decrementing a
1934- * per-trigger reference count and freeing corresponding trigger
1935- * data, for instance. This is usually implemented by the
1936- * generic utility function @event_trigger_free() (see
1937- * trace_event_triggers.c).
1938- *
1939- * @print: The callback function invoked to have the trigger print
1940- * itself. This is usually implemented by a wrapper function
1941- * that calls the generic utility function @event_trigger_print()
1942- * (see trace_event_triggers.c).
1943- */
1944- struct event_trigger_ops {
1945- void (* trigger )(struct event_trigger_data * data ,
1946- struct trace_buffer * buffer ,
1947- void * rec ,
1948- struct ring_buffer_event * rbe );
1949- bool (* count_func )(struct event_trigger_data * data ,
1950- struct trace_buffer * buffer ,
1951- void * rec ,
1952- struct ring_buffer_event * rbe );
1953- int (* init )(struct event_trigger_data * data );
1954- void (* free )(struct event_trigger_data * data );
1955- int (* print )(struct seq_file * m ,
1956- struct event_trigger_data * data );
1957- };
1958-
19591891/**
19601892 * struct event_command - callbacks and data members for event commands
19611893 *
@@ -1976,9 +1908,6 @@ struct event_trigger_ops {
19761908 * @name: The unique name that identifies the event command. This is
19771909 * the name used when setting triggers via trigger files.
19781910 *
1979- * @trigger_ops: The event_trigger_ops implementation associated with
1980- * the command.
1981- *
19821911 * @trigger_type: A unique id that identifies the event command
19831912 * 'type'. This value has two purposes, the first to ensure that
19841913 * only one trigger of the same type can be set at a given time
@@ -2008,7 +1937,7 @@ struct event_trigger_ops {
20081937 *
20091938 * @reg: Adds the trigger to the list of triggers associated with the
20101939 * event, and enables the event trigger itself, after
2011- * initializing it (via the event_trigger_ops @init() function).
1940+ * initializing it (via the event_command @init() function).
20121941 * This is also where commands can use the @trigger_type value to
20131942 * make the decision as to whether or not multiple instances of
20141943 * the trigger should be allowed. This is usually implemented by
@@ -2017,7 +1946,7 @@ struct event_trigger_ops {
20171946 *
20181947 * @unreg: Removes the trigger from the list of triggers associated
20191948 * with the event, and disables the event trigger itself, after
2020- * initializing it (via the event_trigger_ops @free() function).
1949+ * initializing it (via the event_command @free() function).
20211950 * This is usually implemented by the generic utility function
20221951 * @unregister_trigger() (see trace_event_triggers.c).
20231952 *
@@ -2030,11 +1959,46 @@ struct event_trigger_ops {
20301959 * event command, filters set by the user for the command will be
20311960 * ignored. This is usually implemented by the generic utility
20321961 * function @set_trigger_filter() (see trace_event_triggers.c).
1962+ *
1963+ * All the methods below, except for @init() and @free(), must be
1964+ * implemented.
1965+ *
1966+ * @trigger: The trigger 'probe' function called when the triggering
1967+ * event occurs. The data passed into this callback is the data
1968+ * that was supplied to the event_command @reg() function that
1969+ * registered the trigger (see struct event_command) along with
1970+ * the trace record, rec.
1971+ *
1972+ * @count_func: If defined and a numeric parameter is passed to the
1973+ * trigger, then this function will be called before @trigger
1974+ * is called. If this function returns false, then @trigger is not
1975+ * executed.
1976+ *
1977+ * @init: An optional initialization function called for the trigger
1978+ * when the trigger is registered (via the event_command reg()
1979+ * function). This can be used to perform per-trigger
1980+ * initialization such as incrementing a per-trigger reference
1981+ * count, for instance. This is usually implemented by the
1982+ * generic utility function @event_trigger_init() (see
1983+ * trace_event_triggers.c).
1984+ *
1985+ * @free: An optional de-initialization function called for the
1986+ * trigger when the trigger is unregistered (via the
1987+ * event_command @reg() function). This can be used to perform
1988+ * per-trigger de-initialization such as decrementing a
1989+ * per-trigger reference count and freeing corresponding trigger
1990+ * data, for instance. This is usually implemented by the
1991+ * generic utility function @event_trigger_free() (see
1992+ * trace_event_triggers.c).
1993+ *
1994+ * @print: The callback function invoked to have the trigger print
1995+ * itself. This is usually implemented by a wrapper function
1996+ * that calls the generic utility function @event_trigger_print()
1997+ * (see trace_event_triggers.c).
20331998 */
20341999struct event_command {
20352000 struct list_head list ;
20362001 char * name ;
2037- const struct event_trigger_ops * trigger_ops ;
20382002 enum event_trigger_type trigger_type ;
20392003 int flags ;
20402004 int (* parse )(struct event_command * cmd_ops ,
@@ -2051,6 +2015,18 @@ struct event_command {
20512015 int (* set_filter )(char * filter_str ,
20522016 struct event_trigger_data * data ,
20532017 struct trace_event_file * file );
2018+ void (* trigger )(struct event_trigger_data * data ,
2019+ struct trace_buffer * buffer ,
2020+ void * rec ,
2021+ struct ring_buffer_event * rbe );
2022+ bool (* count_func )(struct event_trigger_data * data ,
2023+ struct trace_buffer * buffer ,
2024+ void * rec ,
2025+ struct ring_buffer_event * rbe );
2026+ int (* init )(struct event_trigger_data * data );
2027+ void (* free )(struct event_trigger_data * data );
2028+ int (* print )(struct seq_file * m ,
2029+ struct event_trigger_data * data );
20542030};
20552031
20562032/**
@@ -2071,7 +2047,7 @@ struct event_command {
20712047 * either committed or discarded. At that point, if any commands
20722048 * have deferred their triggers, those commands are finally
20732049 * invoked following the close of the current event. In other
2074- * words, if the event_trigger_ops @func() probe implementation
2050+ * words, if the event_command @func() probe implementation
20752051 * itself logs to the trace buffer, this flag should be set,
20762052 * otherwise it can be left unspecified.
20772053 *
0 commit comments