* [PATCH] arch: tile: re-use kbasename() helper
@ 2013-09-27 8:26 Andy Shevchenko
2013-09-27 20:47 ` Chris Metcalf
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2013-09-27 8:26 UTC (permalink / raw)
To: Chris Metcalf, linux-kernel; +Cc: Andy Shevchenko
kbasename() returns the filename part of a pathname.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/tile/kernel/stack.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index 362284a..c93977a 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -23,6 +23,7 @@
#include <linux/mmzone.h>
#include <linux/dcache.h>
#include <linux/fs.h>
+#include <linux/string.h>
#include <asm/backtrace.h>
#include <asm/page.h>
#include <asm/ucontext.h>
@@ -332,21 +333,18 @@ static void describe_addr(struct KBacktraceIterator *kbt,
}
if (vma->vm_file) {
- char *s;
p = d_path(&vma->vm_file->f_path, buf, bufsize);
if (IS_ERR(p))
p = "?";
- s = strrchr(p, '/');
- if (s)
- p = s+1;
+ name = kbasename(p);
} else {
- p = "anon";
+ name = "anon";
}
/* Generate a string description of the vma info. */
- namelen = strlen(p);
+ namelen = strlen(name);
remaining = (bufsize - 1) - namelen;
- memmove(buf, p, namelen);
+ memmove(buf, name, namelen);
snprintf(buf + namelen, remaining, "[%lx+%lx] ",
vma->vm_start, vma->vm_end - vma->vm_start);
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arch: tile: re-use kbasename() helper
2013-09-27 8:26 [PATCH] arch: tile: re-use kbasename() helper Andy Shevchenko
@ 2013-09-27 20:47 ` Chris Metcalf
0 siblings, 0 replies; 2+ messages in thread
From: Chris Metcalf @ 2013-09-27 20:47 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-kernel
On 9/27/2013 4:26 AM, Andy Shevchenko wrote:
> kbasename() returns the filename part of a pathname.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> arch/tile/kernel/stack.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
Thanks! Taken into the tile tree.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-27 20:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 8:26 [PATCH] arch: tile: re-use kbasename() helper Andy Shevchenko
2013-09-27 20:47 ` Chris Metcalf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox