[REFACTOR] Ks_manager: module removed 38/20138/2
authorAlexander Aksenov <a.aksenov@samsung.com>
Tue, 8 Apr 2014 12:35:10 +0000 (16:35 +0400)
committerAlexander Aksenov <a.aksenov@samsung.com>
Tue, 29 Apr 2014 08:09:29 +0000 (12:09 +0400)
Change-Id: I2e06c5ec939936fdf1cc7bd96b72f270356de9b5
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
Kbuild
ks_manager/ks_manager.c [deleted file]
ks_manager/ks_manager.h [deleted file]
ks_manager/swap_ks_manager.sh [deleted file]
swap_module.c

diff --git a/Kbuild b/Kbuild
index 5b8e684..c8ffd8a 100644 (file)
--- a/Kbuild
+++ b/Kbuild
@@ -16,7 +16,6 @@ swap-y := buffer/swap_buffer_module.o \
           kprobe/dbi_insn_slots.o \
           kprobe/arch/asm/dbi_kprobes.o \
           kprobe/dbi_kprobes.o \
-          ks_manager/ks_manager.o \
           uprobe/swap_uprobes.o \
           uprobe/arch/asm/swap_uprobes.o \
           us_manager/us_manager.o \
diff --git a/ks_manager/ks_manager.c b/ks_manager/ks_manager.c
deleted file mode 100644 (file)
index 053fdea..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- *  Dynamic Binary Instrumentation Module based on KProbes
- *  modules/ks_manager/ks_manager.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright (C) Samsung Electronics, 2013
- *
- * 2013         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <kprobe/dbi_kprobes.h>
-#include <kprobe/dbi_kprobes_deps.h>
-#include "ks_manager.h"
-
-struct probe {
-       struct hlist_node hlist;
-       struct kern_probe p;
-};
-
-static HLIST_HEAD(list_probes);
-
-static struct probe *create_probe(unsigned long addr, void *pre_handler,
-                                 void *jp_handler, void *rp_handler)
-{
-       struct probe *p = kzalloc(sizeof(*p), GFP_KERNEL);
-
-       p->p.jp.kp.addr = p->p.rp.kp.addr = (void *)addr;
-       p->p.jp.pre_entry = pre_handler;
-       p->p.jp.entry = jp_handler;
-       p->p.rp.handler = rp_handler;
-       INIT_HLIST_NODE(&p->hlist);
-
-       return p;
-}
-
-static void free_probe(struct probe *p)
-{
-       kfree(p);
-}
-
-static void add_probe_to_list(struct probe *p)
-{
-       hlist_add_head(&p->hlist, &list_probes);
-}
-
-static void remove_probe_to_list(struct probe *p)
-{
-       hlist_del(&p->hlist);
-}
-
-static struct probe *find_probe(unsigned long addr)
-{
-       struct probe *p;
-       DECLARE_NODE_PTR_FOR_HLIST(node);
-
-       /* check if such probe does exist */
-       swap_hlist_for_each_entry(p, node, &list_probes, hlist)
-               if ((unsigned long)p->p.jp.kp.addr == addr)
-                       return p;
-
-       return NULL;
-}
-
-int ksm_register_probe(unsigned long addr, void *pre_handler,
-                      void *jp_handler, void *rp_handler)
-{
-       int ret;
-       struct probe *p;
-
-       p = create_probe(addr, pre_handler, jp_handler, rp_handler);
-       if (!p)
-               return -ENOMEM;
-
-       ret = dbi_register_jprobe(&p->p.jp);
-       if (ret)
-               goto free;
-
-       ret = dbi_register_kretprobe(&p->p.rp);
-       if (ret)
-               goto unregister_jprobe;
-
-       add_probe_to_list(p);
-       return 0;
-
-unregister_jprobe:
-       dbi_unregister_jprobe(&p->p.jp);
-free:
-       free_probe(p);
-       return ret;
-}
-
-static void do_ksm_unregister_probe(struct probe *p)
-{
-       remove_probe_to_list(p);
-       dbi_unregister_kretprobe(&p->p.rp);
-       dbi_unregister_jprobe(&p->p.jp);
-       free_probe(p);
-}
-
-int ksm_unregister_probe(unsigned long addr)
-{
-       struct probe *p;
-
-       p = find_probe(addr);
-       if (p == NULL)
-               return -EINVAL;
-
-       do_ksm_unregister_probe(p);
-
-       return 0;
-}
-
-int ksm_unregister_probe_all(void)
-{
-       struct probe *p;
-       struct hlist_node *n;
-       DECLARE_NODE_PTR_FOR_HLIST(node);
-
-       swap_hlist_for_each_entry_safe(p, node, n, &list_probes, hlist) {
-               do_ksm_unregister_probe(p);
-       }
-
-       return 0;
-}
-
-int init_ks_manager(void)
-{
-       return 0;
-}
-
-void exit_ks_manager(void)
-{
-       ksm_unregister_probe_all();
-}
diff --git a/ks_manager/ks_manager.h b/ks_manager/ks_manager.h
deleted file mode 100644 (file)
index f8a8e8a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _KS_MANAGER_H
-#define _KS_MANAGER_H
-
-/*
- *  Dynamic Binary Instrumentation Module based on KProbes
- *  modules/ks_manager/ks_manager.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright (C) Samsung Electronics, 2013
- *
- * 2013         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
- *
- */
-
-#include <kprobe/dbi_kprobes.h>
-
-struct kern_probe {
-       struct jprobe jp;
-       struct kretprobe rp;
-};
-
-int ksm_register_probe(unsigned long addr, void *pre_handler,
-                      void *jp_handler, void *rp_handler);
-int ksm_unregister_probe(unsigned long addr);
-
-int ksm_unregister_probe_all(void);
-
-int init_ks_manager(void);
-void exit_ks_manager(void);
-
-#endif /* _KS_MANAGER_H */
diff --git a/ks_manager/swap_ks_manager.sh b/ks_manager/swap_ks_manager.sh
deleted file mode 100755 (executable)
index cb1946d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-MODULE_NAME=swap_ks_manager
-
-# Check for running module in /proc/modules
-RUNNING=`sed "/${MODULE_NAME}/ ! d" /proc/modules`
-
-if [ "${RUNNING}" = "" ]; then
-    ./bin/insmod.sh ${MODULE_NAME}.ko
-    if [ $? -ne 0 ]; then
-            echo "Error: unable to load ${MODULE_NAME} module!"
-           exit 1
-    fi
-else
-       echo "${MODULE_NAME} module is already running!"
-       exit 1
-fi
index f2a9109..788776c 100644 (file)
@@ -5,7 +5,6 @@
 #include <energy/energy.h>
 #include <kprobe/swap_kprobe_module.h>
 #include <ks_features/ks_features.h>
-#include <ks_manager/ks_manager.h>
 #include <ksyms/ksyms_init.h>
 #include <parser/swap_parser_module.h>
 #include <sampler/swap_sampler_module.h>
@@ -20,7 +19,6 @@ typedef enum {
        DRIVER_FAIL,
        WRITER_FAIL,
        KPROBE_FAIL,
-       KS_MANAGER_FAIL,
        UPROBE_FAIL,
        US_MANAGER_FAIL,
        KS_FEATURE_FAIL,
@@ -45,8 +43,6 @@ static void uninit_modules(exit_modules_t exit_m)
        case US_MANAGER_FAIL:
                exit_uprobes();
        case UPROBE_FAIL:
-               exit_ks_manager();
-       case KS_MANAGER_FAIL:
                exit_kprobes();
        case KPROBE_FAIL:
                swap_writer_module_exit();
@@ -95,12 +91,6 @@ static int __init swap_init(void)
                return ret;
        }
 
-       ret = init_ks_manager();
-       if (ret) {
-               uninit_modules(KS_MANAGER_FAIL);
-               return ret;
-       }
-
        ret = init_uprobes();
        if (ret) {
                uninit_modules(UPROBE_FAIL);