Skip to content

Commit

Permalink
minor changes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jkent committed Dec 8, 2023
1 parent 231c932 commit dc1ff84
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
8 changes: 3 additions & 5 deletions include/frogfs/frogfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern "C" {
#include "spi_flash_mmap.h"
#endif

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
Expand Down Expand Up @@ -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" */
Expand Down
5 changes: 3 additions & 2 deletions src/frogfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down
9 changes: 1 addition & 8 deletions src/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -11,13 +10,9 @@

#include <dirent.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/stat.h>

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit dc1ff84

Please sign in to comment.