File itrace.d_path.patch of Package itrace
---
src/driver/btrace.h | 14 ++++++++++++++
src/driver/pi_btrace.c | 2 +-
src/driver/pi_entries.c | 6 +++---
3 files changed, 18 insertions(+), 4 deletions(-)
--- a/src/driver/btrace.h
+++ b/src/driver/btrace.h
@@ -37,6 +37,8 @@
#ifndef _PI_BTRACE_H
#define _PI_BTRACE_H
+#include <linux/version.h>
+#include <linux/dcache.h>
#include <linux/types.h>
#include <perfutilbase.h>
@@ -111,4 +113,16 @@ extern unsigned int perf_mask;
*/
#define PI_LINUX 0x2000
+static inline char *itrace_d_path(struct dentry *de, struct vfsmount *mnt, char *buf, int len)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)
+#include <linux/path.h>
+ struct path path;
+ path.mnt = mnt;
+ path.dentry = de;
+ return d_path(&path, buf, len);
+#else
+ return d_path(de, mnt, buf, len);
+#endif
+}
#endif
--- a/src/driver/pi_btrace.c
+++ b/src/driver/pi_btrace.c
@@ -1987,7 +1987,7 @@ char * set_segment_name(MTE_HOOK * hook,
char * seg_name;
if (vma->vm_file != NULL) {
- seg_name = d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, name_buffer, 256);
+ seg_name = itrace_d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, name_buffer, 256);
if (strstr(seg_name, "(deleted)") != NULL)
seg_name = NULL;
else
--- a/src/driver/pi_entries.c
+++ b/src/driver/pi_entries.c
@@ -364,7 +364,7 @@ void PITRACE_Fork(unsigned long clone_fl
/* Ignore length of zero */
if (pmdata->code_size != 0) {
if (vma->vm_file != NULL) {
- line = d_path(vma->vm_file->f_dentry,
+ line = itrace_d_path(vma->vm_file->f_dentry,
vma->vm_file->f_vfsmnt,
buffer, 256);
if ( line == 0 )
@@ -438,7 +438,7 @@ void PITRACE_Mmap(struct vm_area_struct
pmdata->code_size = (uint32_t)(vmp->vm_end - vmp->vm_start);
if (vmp->vm_file != NULL )
- line = d_path(vmp->vm_file->f_dentry,
+ line = itrace_d_path(vmp->vm_file->f_dentry,
vmp->vm_file->f_vfsmnt,buffer,
256);
else
@@ -513,7 +513,7 @@ void PITRACE_Exec(char * filename, struc
/* Ignore length of zero */
if (pmdata->code_size != 0) {
if (vma->vm_file != NULL) {
- line = d_path(vma->vm_file->f_dentry,
+ line = itrace_d_path(vma->vm_file->f_dentry,
vma->vm_file->f_vfsmnt,
buffer, 256);
if ( line == 0 )