Merge branch 'tizen_2.4_dev' into tizen 62/70162/1
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 17 May 2016 14:58:39 +0000 (17:58 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 17 May 2016 14:58:39 +0000 (17:58 +0300)
Change-Id: Ia6a12395c6f82ee2131de1edf9d3e8990238f0f5

21 files changed:
driver/device_driver.c
driver/driver_to_buffer.c
driver/us_interaction.c
driver/us_interaction.h
energy/energy.c
energy/lcd/lcd_base.c
fbiprobe/fbiprobe.c
kprobe/swap_kprobes.h
kprobe/swap_kprobes_deps.c
kprobe/swap_kprobes_deps.h
ks_features/file_ops.c
ks_features/file_ops.h
loader/loader_pd.c
packaging/swap-modules.spec
parser/usm_msg.c
preload/preload_control.c
sampler/sampler_hrtimer.c
us_manager/pf/proc_filters.c
us_manager/sspt/sspt_proc.c
webprobe/webprobe.c
writer/swap_msg.h

index 16a0085..f06b0f1 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/uaccess.h>
+#include <linux/version.h>
 
 #include <ksyms/ksyms.h>
 #include <master/swap_initializer.h>
@@ -394,8 +395,10 @@ static void swap_device_page_release(struct splice_pipe_desc *spd,
 
 static const struct pipe_buf_operations swap_device_pipe_buf_ops = {
        .can_merge = 0,
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0)
        .map = generic_pipe_buf_map,
        .unmap = generic_pipe_buf_unmap,
+#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0) */
        .confirm = generic_pipe_buf_confirm,
        .release = swap_device_pipe_buf_release,
        .steal = generic_pipe_buf_steal,
index 909b3b1..3ddd19c 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <linux/string.h>
 #include <linux/slab.h>
+#include <linux/fs.h>
 #include <linux/splice.h>
 #include <linux/uaccess.h>
 #include <linux/spinlock.h>
index b668f00..9bac1be 100644 (file)
@@ -70,7 +70,11 @@ int us_interaction_send_msg(const void *data, size_t size)
        msg->len = size;
        memcpy(msg->data, data, msg->len);
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 25)
        ret = cn_netlink_send(msg, CN_DAEMON_GROUP, GFP_ATOMIC);
+#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0) */
+       ret = cn_netlink_send(msg, 0, CN_DAEMON_GROUP, GFP_ATOMIC);
+#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0) */
        if (ret < 0)
                goto fail_send;
        kfree(msg);
index 9e9ec79..66f6343 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef __US_INTERACTION_H__
 #define __US_INTERACTION_H__
 
+#include <linux/version.h>
+
 #ifdef CONFIG_CONNECTOR
 
 int us_interaction_create(void);
index 5a44dae..91adf35 100644 (file)
@@ -332,8 +332,8 @@ static int check_file(int fd)
        file = fget(fd);
        if (file) {
                int magic = 0;
-               if (file->f_dentry && file->f_dentry->d_sb)
-                       magic = file->f_dentry->d_sb->s_magic;
+               if (file->f_path.dentry && file->f_path.dentry->d_sb)
+                       magic = file->f_path.dentry->d_sb->s_magic;
 
                fput(file);
 
index 627ccb2..018fe7b 100644 (file)
@@ -60,7 +60,7 @@ int read_val(const char *path)
 
        buf[ret >= buf_len ? buf_len - 1 : ret] = '\0';
 
-       ret = strict_strtoul(buf, 0, &val);
+       ret = kstrtoul(buf, 0, &val);
        if (ret)
                return ret;
 
index b0c443c..39e6477 100644 (file)
@@ -204,7 +204,7 @@ static struct vm_area_struct *find_vma_exe_by_dentry(struct mm_struct *mm,
        /* TODO FILTER vma */
        for (vma = mm->mmap; vma; vma = vma->vm_next) {
                if (vma->vm_file &&
-                  (vma->vm_file->f_dentry == dentry))
+                  (vma->vm_file->f_path.dentry == dentry))
                        /* found */
                        goto exit;
        }
index c69824c..621a07c 100644 (file)
 #include <swap-asm/swap_kprobes.h>
 
 
-#ifdef CONFIG_ARM
-
-#define regs_return_value(regs)     ((regs)->ARM_r0)
-
-#endif
-
-
 /* kprobe_status settings */
 /** Kprobe hit active */
 #define KPROBE_HIT_ACTIVE      0x00000001
index 7a8a008..7ef1056 100644 (file)
@@ -607,7 +607,11 @@ long __get_user_pages_uprobe(struct task_struct *tsk, struct mm_struct *mm,
                                unsigned int fault_flags = 0;
 
                                /* For mlock, just skip the stack guard page. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
+                               if (foll_flags & FOLL_POPULATE) {
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
                                if (foll_flags & FOLL_MLOCK) {
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) */
                                        if (stack_guard_page(vma, start))
                                                goto next_page;
                                }
index 913e5c2..8b05b13 100644 (file)
@@ -33,6 +33,7 @@
 #define _SWAP_KPROBES_DEPS_H
 
 #include <linux/version.h>     /* LINUX_VERSION_CODE, KERNEL_VERSION() */
+#include <linux/mm.h>
 #include <linux/hugetlb.h>
 #include <linux/mempolicy.h>
 #include <linux/highmem.h>
@@ -132,5 +133,14 @@ unsigned long swap_do_mmap_pgoff(struct file *file, unsigned long addr,
                                 unsigned long flags, unsigned long pgoff);
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) */
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0)
+#define swap_hlist_add_after(node, prev) hlist_add_behind(node, prev)
+#else /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
+#define swap_hlist_add_after(node, prev) hlist_add_after(node, prev)
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
+#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0) */
 
 #endif /* _SWAP_KPROBES_DEPS_H */
index 5769e3c..cf5a8a0 100644 (file)
@@ -331,7 +331,7 @@ static int fops_fcheck(struct task_struct *task, struct file *file)
        if (!task || !file)
                return -EINVAL;
 
-       dentry = file->f_dentry;
+       dentry = file->f_path.dentry;
 
        /* check if it is a regular file */
        if (!S_ISREG(dentry->d_inode->i_mode))
@@ -379,7 +379,7 @@ static int generic_entry_handler(struct kretprobe_instance *ri,
                        ksf_msg_file_entry(fd, fprobe->subtype,
                                           fops_fpath(file, buf, PATH_LEN));
 
-                       priv->dentry = file->f_dentry;
+                       priv->dentry = file->f_path.dentry;
                } else {
                        priv->dentry = NULL;
                }
@@ -551,7 +551,7 @@ static int lock_entry_handler(struct kretprobe_instance *ri,
                                ksf_msg_file_entry(fd, subtype, filepath);
                        }
 
-                       priv->dentry = file->f_dentry;
+                       priv->dentry = file->f_path.dentry;
                        priv->subtype = subtype;
                } else {
                        priv->dentry = NULL;
@@ -583,7 +583,7 @@ static int filp_close_entry_handler(struct kretprobe_instance *ri,
        struct file *file = fops_karg(struct file *, regs, 0);
 
        if (rp && file && file_count(file)) {
-               struct dentry *dentry = file->f_dentry;
+               struct dentry *dentry = file->f_path.dentry;
 
                /* release the file if it is going to be removed soon */
                if (dentry && fops_dcount(dentry) == 2)
index 56e113d..8be3c19 100644 (file)
@@ -2,6 +2,7 @@
 #define __FILE_OPS__
 
 #include <linux/types.h>
+#include <kprobe/swap_kprobes_deps.h>
 
 bool file_ops_is_init(void);
 int file_ops_init(void);
index 158d2f7..0ee9ebe 100644 (file)
@@ -37,7 +37,8 @@ static inline bool check_vma(struct vm_area_struct *vma, struct dentry *dentry)
 {
        struct file *file = vma->vm_file;
 
-       return (file && (vma->vm_flags & VM_EXEC) && (file->f_dentry == dentry));
+       return (file && (vma->vm_flags & VM_EXEC) &&
+               (file->f_path.dentry == dentry));
 }
 
 static inline unsigned long __get_loader_base(struct pd_t *pd)
index deb31a9..9d7a065 100755 (executable)
@@ -9,28 +9,39 @@ Source: swap-modules-3.0.tar.gz
 
 BuildRequires: perl
 BuildRequires: python
-%ifarch %{arm}
-    %if "%{?tizen_profile_name}" == "tv"
-BuildConflicts: vd_kernel-headers
+Provides: swap-modules
+
+%if "%{_repository}" == "emulator32" || "%{_repository}" == "emulator32-wayland"
+BuildRequires: emulator-kernel-devel
+  %define build_arch i386
+  %define kernel_path /usr/src/linux-kernel-build-3.14.25
+%else
+
+  %if "%{_repository}" == "target-TM1"
+BuildRequires: kernel-devel-3.10-sc7730
+    %define build_arch arm
+    %define kernel_path /boot/kernel/devel/kernel-devel-tizen_tm1
+  %else
+
+    %if "%{_repository}" == "target-circle"
+BuildRequires: kernel-devel-3.4-exynos3250
+      %define build_arch arm
+      %define kernel_path /boot/kernel/devel/kernel-devel-tizen_wc1
+    %else
+
+      %if "%{TIZEN_PRODUCT_TV}" == "1"
 BuildRequires: tztv-hawk-kmodules-devel
         %define build_arch arm
         %define kernel_path /usr/include/kernel_header/debug
-    %else
-        %if "%{?tizen_profile_name}" == "mobile"
-ExcludeArch: %{arm}
-        %else
-            %if "%{?tizen_profile_name}" == "wearable"
-ExcludeArch: %{arm}
-            %endif
-        %endif
+      %else
+
+ExclusiveArch:
+      %endif
     %endif
-%else #i386
-    %define build_arch i386
-BuildRequires: emulator-kernel-devel
-    %define kernel_path /usr/src/linux-kernel-build-3.14.25
+  %endif
 %endif
 
-Provides: swap-modules
+
 %description
 Kernel modules for SWAP
 
index 6abcaa5..958ebef 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/sched.h>
 #include <linux/dcache.h>
 #include <linux/fdtable.h>
+#include <linux/version.h>
 #include <writer/swap_msg.h>
 #include <master/swap_deps.h>
 #include <us_manager/sspt/sspt.h>      /* ... check_vma() */
@@ -65,6 +66,16 @@ static void kmem_info_fill(struct kmem_info *info, struct mm_struct *mm)
 #endif /* CONFIG_arch */
 }
 
+static inline struct timespec get_task_start_time(struct task_struct *task)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0)
+       return ns_to_timespec(task->real_start_time);
+#else /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
+       return task->real_start_time;
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
+}
+
+
 
 static int pack_path(void *data, size_t size, struct file *file)
 {
@@ -217,7 +228,7 @@ static struct vm_area_struct *find_vma_exe_by_dentry(struct mm_struct *mm,
 
        for (vma = mm->mmap; vma; vma = vma->vm_next) {
                if (vma->vm_file && (vma->vm_flags & VM_EXEC) &&
-                  (vma->vm_file->f_dentry == dentry))
+                  (vma->vm_file->f_path.dentry == dentry))
                        goto out;
        }
 
@@ -255,7 +266,7 @@ static int pack_proc_info_bottom(void *data, size_t size,
                return -ENOMEM;
 
        getboottime(&boot_time);
-       start_time = timespec_add(boot_time, task->real_start_time);
+       start_time = timespec_add(boot_time, get_task_start_time(task));
 
        pib->ppid = task->real_parent->tgid;
        pib->start_time = swap_msg_spec2time(&start_time);
index f895f81..3ce44b3 100644 (file)
@@ -147,7 +147,7 @@ static struct dentry *__get_caller_dentry(struct task_struct *task,
        if (unlikely(vma == NULL || vma->vm_file == NULL))
                goto get_caller_dentry_fail;
 
-       return vma->vm_file->f_dentry;
+       return vma->vm_file->f_path.dentry;
 
 get_caller_dentry_fail:
 
index c0e669e..b445212 100644 (file)
@@ -30,6 +30,8 @@
 
 
 #include <linux/types.h>
+#include <linux/version.h>
+#include <kprobe/swap_kprobes_deps.h>
 #include "sampler_timers.h"
 
 
index ee9cf4c..241a216 100644 (file)
@@ -40,7 +40,7 @@ static int check_dentry(struct task_struct *task, struct dentry *dentry)
                return 0;
 
        for (vma = mm->mmap; vma; vma = vma->vm_next) {
-               if (check_vma(vma) && vma->vm_file->f_dentry == dentry)
+               if (check_vma(vma) && vma->vm_file->f_path.dentry == dentry)
                        return 1;
        }
 
index 3b0b691..371712c 100644 (file)
@@ -430,7 +430,7 @@ void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr)
 
        vma = find_vma_intersection(mm, page_addr, page_addr + 1);
        if (vma && check_vma(vma)) {
-               struct dentry *dentry = vma->vm_file->f_dentry;
+               struct dentry *dentry = vma->vm_file->f_path.dentry;
                struct sspt_file *file = sspt_proc_find_file(proc, dentry);
                if (file) {
                        struct sspt_page *page;
@@ -459,7 +459,7 @@ void sspt_proc_install(struct sspt_proc *proc)
 
        for (vma = mm->mmap; vma; vma = vma->vm_next) {
                if (check_vma(vma)) {
-                       struct dentry *dentry = vma->vm_file->f_dentry;
+                       struct dentry *dentry = vma->vm_file->f_path.dentry;
                        struct sspt_file *file =
                                sspt_proc_find_file(proc, dentry);
                        if (file) {
index 3082114..e4e9e26 100644 (file)
@@ -99,7 +99,7 @@ static int web_entry_handler(struct uretprobe_instance *ri,
        vma = find_vma_intersection(current->mm, page_vaddr, page_vaddr + 1);
        if (vma && check_vma(vma)) {
                unsigned long addr = vaddr - vma->vm_start;
-               struct dentry *d = vma->vm_file->f_dentry;
+               struct dentry *d = vma->vm_file->f_path.dentry;
 
                if (addr == web_prof_addr(WILL_EXECUTE) &&
                    d == web_prof_lib_dentry()) {
@@ -133,7 +133,7 @@ static int web_ret_handler(struct uretprobe_instance *ri, struct pt_regs *regs)
        vma = find_vma_intersection(current->mm, page_vaddr, page_vaddr + 1);
        if (vma && check_vma(vma)) {
                unsigned long addr = vaddr - vma->vm_start;
-               struct dentry *d = vma->vm_file->f_dentry;
+               struct dentry *d = vma->vm_file->f_path.dentry;
 
                if (addr == web_prof_addr(INSPSERVER_START) &&
                    d == web_prof_lib_dentry()) {
index 068885d..af1b42a 100644 (file)
 #ifndef _SWAP_MSG_H
 #define _SWAP_MSG_H
 
+#include <linux/version.h>
+#include <linux/types.h>
+
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0)
+
+#include <linux/ktime.h>       /* Needed by timekeeping.h */
+#include <linux/timekeeping.h> /* Now getnstimeofday() is here */
+
+#else /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
 
 #include <linux/time.h>
-#include <linux/types.h>
 
+#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 16, 0) */
 
 enum swap_msg_id {
        MSG_PROC_INFO                   = 0x0001,