mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-27 06:05:21 +00:00
File system API functions that operate on paths are passed both the absolute path including the mount point prefix, and the mount point within which the path lies. Unfortunately it's not entirely trivial to convert an arbitrary path within the file system space to an absolute path within its mount point, because the path may be to the mount point itself and not end with a directory separator. The effect is that a file system implementation like nffs may be given an empty path when "/" is required. Add an implementation module that does this transformation and use it to transform paths within each filesystem wrapper. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
37 lines
789 B
C
37 lines
789 B
C
/*
|
|
* Copyright (c) 2019 Peter Bigot Consulting, LLC
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/* Utility functions for use by filesystem implementations. */
|
|
|
|
#ifndef ZEPHYR_SUBSYS_FS_FS_IMPL_H_
|
|
#define ZEPHYR_SUBSYS_FS_FS_IMPL_H_
|
|
|
|
#include <fs.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Strip the mount point prefix from a path.
|
|
*
|
|
* @param path an absolute path beginning with a mount point.
|
|
*
|
|
* @param mp a pointer to the mount point within which @p path is found
|
|
*
|
|
* @return the absolute path within the mount point. Behavior is
|
|
* undefined if @p path does not start with the mount point prefix.
|
|
*/
|
|
const char *fs_impl_strip_prefix(const char *path,
|
|
const struct fs_mount_t *mp);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZEPHYR_SUBSYS_FS_FS_IMPL_H_ */
|