]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - mm/prfile.c
2 * Mainly for aufs which mmap(2) different file and wants to print different
3 * path in /proc/PID/maps.
4 * Call these functions via macros defined in linux/mm.h.
6 * See Documentation/filesystems/aufs/design/06mmap.txt
8 * Copyright (c) 2014-2017 Junjro R. Okajima
9 * Copyright (c) 2014 Ian Campbell
13 #include <linux/file.h>
16 /* #define PRFILE_TRACE */
17 static inline void prfile_trace(struct file
*f
, struct file
*pr
,
18 const char func
[], int line
, const char func2
[])
22 pr_info("%s:%d: %s, %pD2\n", func
, line
, func2
, f
);
26 void vma_do_file_update_time(struct vm_area_struct
*vma
, const char func
[],
29 struct file
*f
= vma
->vm_file
, *pr
= vma
->vm_prfile
;
31 prfile_trace(f
, pr
, func
, line
, __func__
);
37 struct file
*vma_do_pr_or_file(struct vm_area_struct
*vma
, const char func
[],
40 struct file
*f
= vma
->vm_file
, *pr
= vma
->vm_prfile
;
42 prfile_trace(f
, pr
, func
, line
, __func__
);
43 return (f
&& pr
) ? pr
: f
;
46 void vma_do_get_file(struct vm_area_struct
*vma
, const char func
[], int line
)
48 struct file
*f
= vma
->vm_file
, *pr
= vma
->vm_prfile
;
50 prfile_trace(f
, pr
, func
, line
, __func__
);
56 void vma_do_fput(struct vm_area_struct
*vma
, const char func
[], int line
)
58 struct file
*f
= vma
->vm_file
, *pr
= vma
->vm_prfile
;
60 prfile_trace(f
, pr
, func
, line
, __func__
);
67 struct file
*vmr_do_pr_or_file(struct vm_region
*region
, const char func
[],
70 struct file
*f
= region
->vm_file
, *pr
= region
->vm_prfile
;
72 prfile_trace(f
, pr
, func
, line
, __func__
);
73 return (f
&& pr
) ? pr
: f
;
76 void vmr_do_fput(struct vm_region
*region
, const char func
[], int line
)
78 struct file
*f
= region
->vm_file
, *pr
= region
->vm_prfile
;
80 prfile_trace(f
, pr
, func
, line
, __func__
);
85 #endif /* !CONFIG_MMU */