Skip to content

Commit

Permalink
arch: tile: re-use kbasename() helper
Browse files Browse the repository at this point in the history
kbasename() returns the filename part of a pathname.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Andy Shevchenko authored and Chris Metcalf committed Sep 30, 2013
1 parent f862eef commit 0cc96a7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions arch/tile/kernel/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 0cc96a7

Please sign in to comment.