blob: d2466f5b214886f824585d36c5eb51a496c454fc [file] [log] [blame]
Peter A. Bigot312f05e2019-07-21 17:06:54 -05001/*
2 * Copyright (c) 2019 Peter Bigot Consulting, LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
Gerard Marull-Paretas79e6b0e2022-08-25 09:58:46 +02007#include <zephyr/kernel.h>
Gerard Marull-Paretas5113c142022-05-06 11:12:04 +02008#include <zephyr/fs/fs.h>
Peter A. Bigot312f05e2019-07-21 17:06:54 -05009#include "fs_impl.h"
10
11const 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}