[REFACTOR] sspt_file_set_mapping() 63/39863/1
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 7 Nov 2014 18:52:16 +0000 (22:52 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 18 May 2015 09:43:37 +0000 (12:43 +0300)
Change-Id: Ie84147095b39856942840be2f50d8264f97022c8
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
us_manager/sspt/sspt_file.c
us_manager/sspt/sspt_file.h
us_manager/sspt/sspt_proc.c

index 5b626b9..f0355cd 100644 (file)
@@ -308,6 +308,9 @@ int sspt_file_uninstall(struct sspt_file *file,
 
        if (flag != US_DISARM)
                file->loaded = 0;
+               file->vm_start = 0;
+               file->vm_end = 0;
+       }
 
        return err;
 }
@@ -321,6 +324,9 @@ int sspt_file_uninstall(struct sspt_file *file,
  */
 void sspt_file_set_mapping(struct sspt_file *file, struct vm_area_struct *vma)
 {
-       file->vm_start = vma->vm_start;
-       file->vm_end = vma->vm_end;
+       if (file->loaded == 0) {
+               file->loaded = 1;
+               file->vm_start = vma->vm_start;
+               file->vm_end = vma->vm_end;
+       }
 }
index e0730d5..11e8f42 100644 (file)
@@ -38,12 +38,13 @@ struct sspt_file {
        struct list_head list;          /**< For sspt_proc */
        struct sspt_proc *proc;         /**< Pointer to the proc (parent) */
        struct dentry *dentry;          /**< Dentry of file */
-       int loaded;                     /**< Flag of loading */
        unsigned long vm_start;         /**< VM start */
        unsigned long vm_end;           /**< VM end */
 
        unsigned long page_probes_hash_bits;    /**< Hash-table size */
        struct hlist_head *page_probes_table;   /**< Hash-table for pages */
+
+       unsigned loaded:1;                      /**< Flag of loading */
 };
 
 
index cde887e..c573e4d 100644 (file)
@@ -286,10 +286,8 @@ void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr)
                struct sspt_file *file = sspt_proc_find_file(proc, dentry);
                if (file) {
                        struct sspt_page *page;
-                       if (!file->loaded) {
-                               sspt_file_set_mapping(file, vma);
-                               file->loaded = 1;
-                       }
+
+                       sspt_file_set_mapping(file, vma);
 
                        page = sspt_find_page_mapped(file, page_addr);
                        if (page)
@@ -317,11 +315,7 @@ void sspt_proc_install(struct sspt_proc *proc)
                        struct sspt_file *file =
                                sspt_proc_find_file(proc, dentry);
                        if (file) {
-                               if (!file->loaded) {
-                                       file->loaded = 1;
-                                       sspt_file_set_mapping(file, vma);
-                               }
-
+                               sspt_file_set_mapping(file, vma);
                                sspt_file_install(file);
                        }
                }