Peter A. Bigot | 312f05e | 2019-07-21 17:06:54 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019 Peter Bigot Consulting, LLC |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | |
Gerard Marull-Paretas | 79e6b0e | 2022-08-25 09:58:46 +0200 | [diff] [blame] | 7 | #include <zephyr/kernel.h> |
Gerard Marull-Paretas | 5113c14 | 2022-05-06 11:12:04 +0200 | [diff] [blame] | 8 | #include <zephyr/fs/fs.h> |
Peter A. Bigot | 312f05e | 2019-07-21 17:06:54 -0500 | [diff] [blame] | 9 | #include "fs_impl.h" |
| 10 | |
| 11 | const char *fs_impl_strip_prefix(const char *path, |
| 12 | const struct fs_mount_t *mp) |
| 13 | { |
| 14 | static const char *const root = "/"; |
| 15 | |
| 16 | if ((path == NULL) || (mp == NULL)) { |
| 17 | return path; |
| 18 | } |
| 19 | |
| 20 | path += mp->mountp_len; |
| 21 | return *path ? path : root; |
| 22 | } |