diff --git a/README.md b/README.md index e8d5c65..83d187b 100644 --- a/README.md +++ b/README.md @@ -209,8 +209,8 @@ frogfs_vfs_register(&frogfs_vfs_conf); * frogfs_dh_t *[frogfs_opendir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_opendir)(frogfs_fs_t *fs, const frogfs_entry_t *entry) * void [frogfs_closedir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_closedir)(frogfs_dh_t *dh) * const frogfs_entry_t *[frogfs_readdir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_readdir)(frogfs_dh_t *dh) - * void [frogfs_seekdir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_seekdir)(frogfs_dh_t *dh, uint16_t loc) - * uint16_t [frogfs_telldir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_telldir)(frogfs_dh_t *dh) + * void [frogfs_seekdir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_seekdir)(frogfs_dh_t *dh, long loc) + * long [frogfs_telldir](https://frogfs.readthedocs.io/en/latest/api-reference/bare.html#c.frogfs_telldir)(frogfs_dh_t *dh) # How it works diff --git a/idf_component.yml b/idf_component.yml index fb16f6c..b227bf0 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "4.0.1" +version: "4.0.2" description: A read-only file system for embedded use. url: https://github.com/jkent/frogfs dependencies: diff --git a/include/frogfs/frogfs.h b/include/frogfs/frogfs.h index 60ec65d..f92511d 100644 --- a/include/frogfs/frogfs.h +++ b/include/frogfs/frogfs.h @@ -12,7 +12,6 @@ extern "C" { #include "spi_flash_mmap.h" #endif -#include #include #include #include @@ -249,19 +248,18 @@ const frogfs_entry_t *frogfs_readdir(frogfs_dh_t *dh); /** * \brief Set dir entry index to a value returned by \a frogfs_telldir - * for the current \a frogfs_dh_t pointer; any other values are - * undefined + * for the current \a frogfs_dh_t pointer * \param[in] d \a frogfs_dh_t pointer * \param[in] loc entry index */ -void frogfs_seekdir(frogfs_dh_t *dh, uint16_t loc); +void frogfs_seekdir(frogfs_dh_t *dh, long loc); /** * \brief Return the current entry index for a directory * \param[in] d \a frogfs_dh_t pointer * \return entry index */ -uint16_t frogfs_telldir(frogfs_dh_t *dh); +long frogfs_telldir(frogfs_dh_t *dh); #ifdef __cplusplus } /* extern "C" */ diff --git a/src/frogfs.c b/src/frogfs.c index 824d718..90bf1c1 100644 --- a/src/frogfs.c +++ b/src/frogfs.c @@ -443,9 +443,10 @@ const frogfs_entry_t *frogfs_readdir(frogfs_dh_t *dh) return entry; } -void frogfs_seekdir(frogfs_dh_t *dh, uint16_t loc) +void frogfs_seekdir(frogfs_dh_t *dh, long loc) { assert(dh != NULL); + assert(loc >= 0); if (loc < dh->dir->entry.child_count) { dh->index = loc; @@ -454,7 +455,7 @@ void frogfs_seekdir(frogfs_dh_t *dh, uint16_t loc) } } -uint16_t frogfs_telldir(frogfs_dh_t *dh) +long frogfs_telldir(frogfs_dh_t *dh) { assert(dh != NULL); diff --git a/src/vfs.c b/src/vfs.c index fe1f0ae..a8f6d3f 100644 --- a/src/vfs.c +++ b/src/vfs.c @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "log.h" #include "frogfs/frogfs.h" #include "frogfs/vfs.h" @@ -11,13 +10,9 @@ #include #include -#include -#include -#include +#include #include -#include #include -#include #include #include @@ -198,7 +193,6 @@ static struct dirent *frogfs_vfs_readdir(void *ctx, DIR *pdir) int err = frogfs_vfs_readdir_r(ctx, pdir, &dh->dirent, &out_ent); if (err != 0) { - errno = err; return NULL; } @@ -324,7 +318,6 @@ esp_err_t frogfs_vfs_register(const frogfs_vfs_conf_t *conf) frogfs_vfs_t *vfs = calloc(1, sizeof(*vfs) + (sizeof(frogfs_fh_t *) * conf->max_files)); if (vfs == NULL) { - LOGE("vfs could not be alloc'd"); return ESP_ERR_NO_MEM; }