menu "SPIFFS Configuration"

    config SPIFFS_MAX_PARTITIONS
        int "Maximum Number of Partitions"
        default 3
        range 1 10
        help
            Define maximum number of partitions that can be mounted.

    menu "SPIFFS Cache Configuration"
        config SPIFFS_CACHE
            bool "Enable SPIFFS Cache"
            default "y"
            help
                Enables/disable memory read caching of nucleus file system
                operations.

        config SPIFFS_CACHE_WR
            bool "Enable SPIFFS Write Caching"
            default "y"
            depends on SPIFFS_CACHE
            help
                Enables memory write caching for file descriptors in hydrogen.

        config SPIFFS_CACHE_STATS
            bool "Enable SPIFFS Cache Statistics"
            default "n"
            depends on SPIFFS_CACHE
            help
                Enable/disable statistics on caching. Debug/test purpose only.

    endmenu

    config SPIFFS_PAGE_CHECK
        bool "Enable SPIFFS Page Check"
        default "y"
        help
            Always check header of each accessed page to ensure consistent state.
            If enabled it will increase number of reads from flash, especially
            if cache is disabled.

    config SPIFFS_GC_MAX_RUNS
        int "Set Maximum GC Runs"
        default 10
        range 1 255
        help
            Define maximum number of GC runs to perform to reach desired free pages.

    config SPIFFS_GC_STATS
        bool "Enable SPIFFS GC Statistics"
        default "n"
        help
            Enable/disable statistics on gc. Debug/test purpose only.

    config SPIFFS_PAGE_SIZE
        int "SPIFFS logical page size"
        default 256
        range 256 1024
        help
            Logical page size of SPIFFS partition, in bytes. Must be multiple
            of flash page size (which is usually 256 bytes).
            Larger page sizes reduce overhead when storing large files, and
            improve filesystem performance when reading large files.
            Smaller page sizes reduce overhead when storing small (< page size)
            files.

    config SPIFFS_OBJ_NAME_LEN
        int "Set SPIFFS Maximum Name Length"
        default 32
        range 1 256
        help
            Object name maximum length. Note that this length include the
            zero-termination character, meaning maximum string of characters
            can at most be SPIFFS_OBJ_NAME_LEN - 1.

            SPIFFS_OBJ_NAME_LEN + SPIFFS_META_LENGTH should not exceed
            SPIFFS_PAGE_SIZE - 64.

    config SPIFFS_FOLLOW_SYMLINKS
        bool "Enable symbolic links for image creation"
        default "n"
        help
            If this option is enabled, symbolic links are taken into account
            during partition image creation.

    config SPIFFS_USE_MAGIC
        bool "Enable SPIFFS Filesystem Magic"
        default "y"
        help
            Enable this to have an identifiable spiffs filesystem.
            This will look for a magic in all sectors to determine if this
            is a valid spiffs system or not at mount time.

    config SPIFFS_USE_MAGIC_LENGTH
        bool "Enable SPIFFS Filesystem Length Magic"
        default "y"
        depends on SPIFFS_USE_MAGIC
        help
            If this option is enabled, the magic will also be dependent
            on the length of the filesystem. For example, a filesystem
            configured and formatted for 4 megabytes will not be accepted
            for mounting with a configuration defining the filesystem as 2 megabytes.

    config SPIFFS_META_LENGTH
        int "Size of per-file metadata field"
        default 4
        help
            This option sets the number of extra bytes stored in the file header.
            These bytes can be used in an application-specific manner.
            Set this to at least 4 bytes to enable support for saving file
            modification time.

            SPIFFS_OBJ_NAME_LEN + SPIFFS_META_LENGTH should not exceed
            SPIFFS_PAGE_SIZE - 64.

    config SPIFFS_USE_MTIME
        bool "Save file modification time"
        default "y"
        depends on SPIFFS_META_LENGTH >= 4
        help
            If enabled, then the first 4 bytes of per-file metadata will be used
            to store file modification time (mtime), accessible through
            stat/fstat functions.
            Modification time is updated when the file is opened.

    config SPIFFS_MTIME_WIDE_64_BITS
        bool "The time field occupies 64 bits in the image instead of 32 bits"
        default n
        depends on SPIFFS_META_LENGTH >= 8
        help
            If this option is not set, the time field is 32 bits (up to 2106 year),
            otherwise it is 64 bits and make sure it matches SPIFFS_META_LENGTH.
            If the chip already has the spiffs image with the time field = 32 bits
            then this option cannot be applied in this case.
            Erase it first before using this option.
            To resolve the Y2K38 problem for the spiffs, use a toolchain with support
            time_t 64 bits (see SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS).

    menu "Debug Configuration"

        config SPIFFS_DBG
            bool "Enable general SPIFFS debug"
            default "n"
            help
                Enabling this option will print general debug mesages to the console.

        config SPIFFS_API_DBG
            bool "Enable SPIFFS API debug"
            default "n"
            help
                Enabling this option will print API debug mesages to the console.

        config SPIFFS_GC_DBG
            bool "Enable SPIFFS Garbage Cleaner debug"
            default "n"
            help
                Enabling this option will print GC debug mesages to the console.

        config SPIFFS_CACHE_DBG
            bool "Enable SPIFFS Cache debug"
            default "n"
            depends on SPIFFS_CACHE
            help
                Enabling this option will print cache debug mesages to the console.

        config SPIFFS_CHECK_DBG
            bool "Enable SPIFFS Filesystem Check debug"
            default "n"
            help
                Enabling this option will print Filesystem Check debug mesages
                to the console.

        config SPIFFS_TEST_VISUALISATION
            bool "Enable SPIFFS Filesystem Visualization"
            default "n"
            help
                Enable this option to enable SPIFFS_vis function in the API.

    endmenu

endmenu
