Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- include/linux/string.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index ed4eeb551..8479a3f57 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -111,6 +111,18 @@ extern char *strim(char *); void *memchr_inv(const void *start, int c, size_t bytes); +/** + * kbasename - return the last part of a pathname. + * + * @path: path to extract the filename from. + */ +static inline const char *kbasename(const char *path) +{ + const char *tail = strrchr(path, '/'); + return tail ? tail + 1 : path; +} + + #ifdef __cplusplus } #endif -- 2.17.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox