preload: use new dentry manipulation interface 30/191030/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 28 Sep 2018 15:07:18 +0000 (18:07 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 11 Oct 2018 18:51:56 +0000 (21:51 +0300)
Change-Id: I4a4eeba66390421cc6a0d94b2373e2b877730059
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
modules/preload/preload_control.c
modules/preload/preload_module.c
modules/preload/preload_process.c

index 7d6567ed165f6eae19e82e3239e6982fce77017f..37f25fa864622a73d3edbb24213e8ac44233cbac 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/mm.h>
 
 #include <us_manager/sspt/sspt_ip.h>
-#include <us_manager/us_common_file.h>
+#include <us_manager/swap_dcache.h>
 
 #include "preload.h"
 #include "preload_module.h"
@@ -87,7 +87,7 @@ static void __free_binaries(struct list_desc *tl)
 
        list_for_each_entry_safe(p, n, &rm_head, list) {
                list_del(&p->list);
-               swap_put_dentry(p->dentry);
+               swap_dput(p->dentry);
                __free_binary(p);
        }
 }
@@ -228,7 +228,7 @@ enum preload_call_type pc_call_type(struct sspt_ip *ip, void *caller)
 
 int pc_add_instrumented_binary(char *filename)
 {
-       struct dentry *dentry = swap_get_dentry(filename);
+       struct dentry *dentry = swap_dget_by_path(filename);
        int res = 0;
 
        if (dentry == NULL)
@@ -236,7 +236,7 @@ int pc_add_instrumented_binary(char *filename)
 
        res = __add_binary(dentry, filename, &target);
        if (res != 0)
-               swap_put_dentry(dentry);
+               swap_dput(dentry);
 
        return res > 0 ? 0 : res;
 }
@@ -250,7 +250,7 @@ int pc_clean_instrumented_bins(void)
 
 int pc_add_ignored_binary(char *filename)
 {
-       struct dentry *dentry = swap_get_dentry(filename);
+       struct dentry *dentry = swap_dget_by_path(filename);
        int res = 0;
 
        if (dentry == NULL)
@@ -258,7 +258,7 @@ int pc_add_ignored_binary(char *filename)
 
        res = __add_binary(dentry, filename, &ignored);
        if (res != 0)
-               swap_put_dentry(dentry);
+               swap_dput(dentry);
 
        return res > 0 ? 0 : res;
 }
index fd63bdf9455af5f8487f05ab6905486d74e33201..41a7d4a5b8148a846a758ee7eaad02aaff8c588d 100644 (file)
@@ -9,7 +9,7 @@
 #include <us_manager/sspt/sspt_ip.h>
 #include <us_manager/sspt/sspt_page.h>
 #include <us_manager/sspt/sspt_file.h>
-#include <us_manager/us_common_file.h>
+#include <us_manager/swap_dcache.h>
 #include <loader/loader.h>
 #include <master/swap_initializer.h>
 #include "preload.h"
@@ -485,7 +485,7 @@ int pm_uprobe_init(struct sspt_ip *ip)
        rp->handler = preload_us_ret;
 
        /* Get dentry and set it in probe info struct */
-       dentry = swap_get_dentry(path);
+       dentry = swap_dget_by_path(path);
        if (dentry == NULL) {
                pr_warn(PRELOAD_PREFIX "Error! Cannot get handler %s\n", path);
                return -EINVAL;
@@ -507,9 +507,7 @@ void pm_uprobe_exit(struct sspt_ip *ip)
        struct dentry *dentry = ip->desc->info.pl_i.dentry;
 
        WARN_ON(!dentry);
-
-       if (dentry)
-               swap_put_dentry(dentry);
+       swap_dput(dentry);
 }
 
 int pm_switch(enum preload_status stat)
index 1b777b1f867eeb84b9f44d4aead2182aaa3a62b2..54ecbf5f79d029c3986dc36d3dde133885f58d6b 100644 (file)
@@ -3,7 +3,7 @@
 #include <linux/mutex.h>
 #include <linux/namei.h>
 #include <linux/slab.h>
-#include <us_manager/us_common_file.h>
+#include <us_manager/swap_dcache.h>
 #include <us_manager/pf/pf_group.h>
 #include <us_manager/sspt/sspt_page.h>
 #include <us_manager/sspt/sspt_file.h>
@@ -157,7 +157,7 @@ static void _proc_destroy(struct process_t *proc)
                put_pf_group(proc->pfg);
 
        if (proc->idt == SET_BY_PATH)
-               swap_put_dentry(proc->dentry);
+               swap_dput(proc->dentry);
 
        if (proc->idt == SET_BY_ID)
                kfree(proc->id);
@@ -224,7 +224,7 @@ int pp_add_by_path(const char *path)
        struct process_t *proc;
        int ret;
 
-       dentry = swap_get_dentry(path);
+       dentry = swap_dget_by_path(path);
        if (!dentry) {
                pr_warn(PRELOAD_PREFIX "Can't get dentry for <%s>\n", path);
                return -EINVAL;
@@ -258,7 +258,7 @@ by_path_put_pfg:
        put_pf_group(pfg);
 
 by_path_put_dentry:
-       swap_put_dentry(dentry);
+       swap_dput(dentry);
 
        return ret;
 }
@@ -345,7 +345,7 @@ int pp_del_by_path(const char *path)
 {
        struct dentry *dentry;
 
-       dentry = swap_get_dentry(path);
+       dentry = swap_dget_by_path(path);
        if (!dentry) {
                pr_warn(PRELOAD_PREFIX "No dentry for <%s>\n", path);
                return -EINVAL;
@@ -353,7 +353,7 @@ int pp_del_by_path(const char *path)
 
        _delete_from_list(_check_by_dentry, dentry);
 
-       swap_put_dentry(dentry);
+       swap_dput(dentry);
 
        return 0;
 }
@@ -441,13 +441,11 @@ int pp_set_pthread_path(const char *path)
 {
        struct dentry *dentry;
 
-       dentry = swap_get_dentry(path);
+       dentry = swap_dget_by_path(path);
        if (dentry == NULL)
                return -EINVAL;
 
-       if (_pthread_init.dentry != NULL)
-               swap_put_dentry(_pthread_init.dentry);
-
+       swap_dput(_pthread_init.dentry);
        _pthread_init.dentry = dentry;
 
        return 0;