#include <linux/module.h>
#include <linux/version.h>
#include <linux/errno.h>
-#include <linux/namei.h>
#include <us_manager/pf/pf_group.h>
#include <us_manager/probes/probes.h>
#include "msg_parser.h"
#include "us_inst.h"
-/* FIXME: create get_dentry() and put_dentry() */
-static struct dentry *dentry_by_path(const char *path)
-{
- struct dentry *dentry;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
- struct path st_path;
- if (kern_path(path, LOOKUP_FOLLOW, &st_path) != 0) {
-#else /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
- struct nameidata nd;
- if (path_lookup(path, LOOKUP_FOLLOW, &nd) != 0) {
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
- printk(KERN_INFO "failed to lookup dentry for path %s!\n",
- path);
- return NULL;
- }
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
- dentry = nd.dentry;
- path_release(&nd);
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 38)
- dentry = nd.path.dentry;
- path_put(&nd.path);
-#else /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
- dentry = st_path.dentry;
- path_put(&st_path);
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) */
- return dentry;
-}
-
static int mod_func_inst(struct func_inst_data *func, struct pf_group *pfg,
struct dentry *dentry, enum MOD_TYPE mt)
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/list.h>
+#include <linux/namei.h>
+
#include "proc_filters.h"
#include <us_manager/usm_msg.h>
#include <us_manager/img/img_proc.h>
}
/**
+ * @brief Get dentry struct by path
+ *
+ * @param path Path to file
+ * @return Pointer on dentry struct on NULL
+ */
+struct dentry *dentry_by_path(const char *path)
+{
+ struct dentry *dentry;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
+ struct path st_path;
+ if (kern_path(path, LOOKUP_FOLLOW, &st_path) != 0) {
+#else /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
+ struct nameidata nd;
+ if (path_lookup(path, LOOKUP_FOLLOW, &nd) != 0) {
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
+ printk("failed to lookup dentry for path %s!\n", path);
+ return NULL;
+ }
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
+ dentry = nd.dentry;
+ path_release(&nd);
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 38)
+ dentry = nd.path.dentry;
+ path_put(&nd.path);
+#else /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38) */
+ dentry = st_path.dentry;
+ path_put(&st_path);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) */
+ return dentry;
+}
+EXPORT_SYMBOL_GPL(dentry_by_path);
+
+/**
* @brief Get pf_group struct by dentry
*
* @param dentry Dentry of file
struct sspt_proc;
struct probe_info;
+/* FIXME: create and use get_dentry() and put_dentry() */
+struct dentry *dentry_by_path(const char *path);
+
struct pf_group *get_pf_group_by_dentry(struct dentry *dentry, void *priv);
struct pf_group *get_pf_group_by_tgid(pid_t tgid, void *priv);
struct pf_group *get_pf_group_by_comm(char *comm, void *priv);
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/version.h>
-#include <linux/namei.h>
#include <us_manager/pf/pf_group.h>
#include <us_manager/probes/probes.h>
static const char *LIBEWEBKIT2_PATH = "/usr/lib/libewebkit2.so.0";
static struct web_prof_data *web_data;
-static struct dentry *dentry_by_path(const char *path)
-{
- struct dentry *dentry;
- struct path st_path;
- if (kern_path(path, LOOKUP_FOLLOW, &st_path) != 0) {
- pr_err("failed to lookup dentry for path %s!\n", path);
- return NULL;
- }
- dentry = st_path.dentry;
- path_put(&st_path);
-
- return dentry;
-}
u64 *web_prof_addr_ptr(enum web_prof_addr_t type)
{