/*
 * Copyright (c) 2016 Intel Corporation.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
#define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_

#ifdef __cplusplus
extern "C" {
#endif

#if defined(CONFIG_FILE_SYSTEM_LITTLEFS)
#define MAX_FILE_NAME 256
#elif defined(CONFIG_FAT_FILESYSTEM_ELM)
#if defined(CONFIG_FS_FATFS_LFN)
#define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN
#else /* CONFIG_FS_FATFS_LFN */
#define MAX_FILE_NAME 12 /* Uses 8.3 SFN */
#endif /* CONFIG_FS_FATFS_LFN */
#else /* filesystem selection */
/* Use standard 8.3 when no filesystem is explicitly selected */
#define MAX_FILE_NAME 12
#endif /* filesystem selection */

struct fs_mount_t;

/**
 * @brief File object representing an open file
 *
 * @param Pointer to FATFS file object structure
 * @param mp Pointer to mount point structure
 */
struct fs_file_t {
	void *filep;
	const struct fs_mount_t *mp;
};

/**
 * @brief Directory object representing an open directory
 *
 * @param dirp Pointer to directory object structure
 * @param mp Pointer to mount point structure
 */
struct fs_dir_t {
	void *dirp;
	const struct fs_mount_t *mp;
};

#ifdef __cplusplus
}
#endif

#endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */

/*
 * Copyright (c) 2016 Intel Corporation.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
#define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_

#ifdef __cplusplus
extern "C" {
#endif

#if defined(CONFIG_FILE_SYSTEM_LITTLEFS)
#define MAX_FILE_NAME 256
#else /* FAT_FS */
#define MAX_FILE_NAME 12 /* Uses 8.3 SFN */
#endif

struct fs_mount_t;

/**
 * @brief File object representing an open file
 *
 * @param Pointer to FATFS file object structure
 * @param mp Pointer to mount point structure
 */
struct fs_file_t {
	void *filep;
	const struct fs_mount_t *mp;
};

/**
 * @brief Directory object representing an open directory
 *
 * @param dirp Pointer to directory object structure
 * @param mp Pointer to mount point structure
 */
struct fs_dir_t {
	void *dirp;
	const struct fs_mount_t *mp;
};

#ifdef __cplusplus
}
#endif

#endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */

--- 
+++ 
@@ -13,9 +13,16 @@
 
 #if defined(CONFIG_FILE_SYSTEM_LITTLEFS)
 #define MAX_FILE_NAME 256
-#else /* FAT_FS */
+#elif defined(CONFIG_FAT_FILESYSTEM_ELM)
+#if defined(CONFIG_FS_FATFS_LFN)
+#define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN
+#else /* CONFIG_FS_FATFS_LFN */
 #define MAX_FILE_NAME 12 /* Uses 8.3 SFN */
-#endif
+#endif /* CONFIG_FS_FATFS_LFN */
+#else /* filesystem selection */
+/* Use standard 8.3 when no filesystem is explicitly selected */
+#define MAX_FILE_NAME 12
+#endif /* filesystem selection */
 
 struct fs_mount_t;
 
fs: Set MAX_FILE_NAME appropiately with LFN and FATFS

Try to define MAX_FILE_NAME to the appropriate max length based on the
selected filesystm. Otherwise fallback to a standard filename of 12
(made up of 8.3 : <filename>.<extension>)

Signed-off-by: Roman Vaughan <1620c2a00a7840d4515361aacd4b41348f2a8a7d@gmail.com>
