@@ -169,6 +169,7 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops)
169
169
#endif
170
170
}
171
171
172
+ /* Call this function for when a callback filters on set_ftrace_pid */
172
173
static void ftrace_pid_func (unsigned long ip , unsigned long parent_ip ,
173
174
struct ftrace_ops * op , struct ftrace_regs * fregs )
174
175
{
@@ -1318,7 +1319,7 @@ static struct ftrace_hash *alloc_ftrace_hash(int size_bits)
1318
1319
return hash ;
1319
1320
}
1320
1321
1321
-
1322
+ /* Used to save filters on functions for modules not loaded yet */
1322
1323
static int ftrace_add_mod (struct trace_array * tr ,
1323
1324
const char * func , const char * module ,
1324
1325
int enable )
@@ -1430,6 +1431,7 @@ static struct ftrace_hash *__move_hash(struct ftrace_hash *src, int size)
1430
1431
return new_hash ;
1431
1432
}
1432
1433
1434
+ /* Move the @src entries to a newly allocated hash */
1433
1435
static struct ftrace_hash *
1434
1436
__ftrace_hash_move (struct ftrace_hash * src )
1435
1437
{
@@ -1444,6 +1446,26 @@ __ftrace_hash_move(struct ftrace_hash *src)
1444
1446
return __move_hash (src , size );
1445
1447
}
1446
1448
1449
+ /**
1450
+ * ftrace_hash_move - move a new hash to a filter and do updates
1451
+ * @ops: The ops with the hash that @dst points to
1452
+ * @enable: True if for the filter hash, false for the notrace hash
1453
+ * @dst: Points to the @ops hash that should be updated
1454
+ * @src: The hash to update @dst with
1455
+ *
1456
+ * This is called when an ftrace_ops hash is being updated and the
1457
+ * the kernel needs to reflect this. Note, this only updates the kernel
1458
+ * function callbacks if the @ops is enabled (not to be confused with
1459
+ * @enable above). If the @ops is enabled, its hash determines what
1460
+ * callbacks get called. This function gets called when the @ops hash
1461
+ * is updated and it requires new callbacks.
1462
+ *
1463
+ * On success the elements of @src is moved to @dst, and @dst is updated
1464
+ * properly, as well as the functions determined by the @ops hashes
1465
+ * are now calling the @ops callback function.
1466
+ *
1467
+ * Regardless of return type, @src should be freed with free_ftrace_hash().
1468
+ */
1447
1469
static int
1448
1470
ftrace_hash_move (struct ftrace_ops * ops , int enable ,
1449
1471
struct ftrace_hash * * dst , struct ftrace_hash * src )
0 commit comments