Lines Matching refs:fp

29 	struct fprobe *fp;
33 fp = container_of(ops, struct fprobe, ops);
35 if (fp->exit_handler) {
36 rh = rethook_try_get(fp->rethook);
38 fp->nmissed++;
44 if (fp->entry_data_size)
48 if (fp->entry_handler)
49 ret = fp->entry_handler(fp, ip, parent_ip, ftrace_get_regs(fregs), entry_data);
63 struct fprobe *fp;
66 fp = container_of(ops, struct fprobe, ops);
67 if (fprobe_disabled(fp))
75 fp->nmissed++;
87 struct fprobe *fp;
90 fp = container_of(ops, struct fprobe, ops);
91 if (fprobe_disabled(fp))
99 fp->nmissed++;
110 fp->nmissed++;
125 struct fprobe *fp = (struct fprobe *)data;
129 if (!fp || fprobe_disabled(fp))
140 fp->nmissed++;
144 fp->exit_handler(fp, fpr->entry_ip, ret_ip, regs,
145 fp->entry_data_size ? (void *)fpr->data : NULL);
178 static void fprobe_init(struct fprobe *fp)
180 fp->nmissed = 0;
181 if (fprobe_shared_with_kprobes(fp))
182 fp->ops.func = fprobe_kprobe_handler;
184 fp->ops.func = fprobe_handler;
185 fp->ops.flags |= FTRACE_OPS_FL_SAVE_REGS;
188 static int fprobe_init_rethook(struct fprobe *fp, int num)
192 if (!fp->exit_handler) {
193 fp->rethook = NULL;
198 if (fp->nr_maxactive)
199 num = fp->nr_maxactive;
205 size = sizeof(struct fprobe_rethook_node) + fp->entry_data_size;
208 fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler, size, num);
209 if (IS_ERR(fp->rethook))
210 return PTR_ERR(fp->rethook);
215 static void fprobe_fail_cleanup(struct fprobe *fp)
217 if (!IS_ERR_OR_NULL(fp->rethook)) {
219 rethook_free(fp->rethook);
220 fp->rethook = NULL;
222 ftrace_free_filter(&fp->ops);
227 * @fp: A fprobe data structure to be registered.
231 * Register @fp to ftrace for enabling the probe on the symbols matched to @filter.
234 * Return 0 if @fp is registered successfully, -errno if not.
236 int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter)
242 if (!fp || !filter)
245 fprobe_init(fp);
249 ret = ftrace_set_filter(&fp->ops, str, len, 0);
257 ret = ftrace_set_notrace(&fp->ops, str, len, 0);
267 hash = rcu_access_pointer(fp->ops.local_hash.filter_hash);
271 ret = fprobe_init_rethook(fp, (int)hash->count);
273 ret = register_ftrace_function(&fp->ops);
277 fprobe_fail_cleanup(fp);
284 * @fp: A fprobe data structure to be registered.
288 * Register @fp to ftrace for enabling the probe on the address given by @addrs.
293 * Return 0 if @fp is registered successfully, -errno if not.
295 int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num)
299 if (!fp || !addrs || num <= 0)
302 fprobe_init(fp);
304 ret = ftrace_set_filter_ips(&fp->ops, addrs, num, 0, 0);
308 ret = fprobe_init_rethook(fp, num);
310 ret = register_ftrace_function(&fp->ops);
313 fprobe_fail_cleanup(fp);
320 * @fp: A fprobe data structure to be registered.
324 * Register @fp to the symbols given by @syms array. This will be useful if
327 * Return 0 if @fp is registered successfully, -errno if not.
329 int register_fprobe_syms(struct fprobe *fp, const char **syms, int num)
334 if (!fp || !syms || num <= 0)
341 ret = register_fprobe_ips(fp, addrs, num);
349 bool fprobe_is_registered(struct fprobe *fp)
351 if (!fp || (fp->ops.saved_func != fprobe_handler &&
352 fp->ops.saved_func != fprobe_kprobe_handler))
359 * @fp: A fprobe data structure to be unregistered.
363 * Return 0 if @fp is unregistered successfully, -errno if not.
365 int unregister_fprobe(struct fprobe *fp)
369 if (!fprobe_is_registered(fp))
372 if (!IS_ERR_OR_NULL(fp->rethook))
373 rethook_stop(fp->rethook);
375 ret = unregister_ftrace_function(&fp->ops);
379 if (!IS_ERR_OR_NULL(fp->rethook))
380 rethook_free(fp->rethook);
382 ftrace_free_filter(&fp->ops);