Added espFsFlags function

pull/30/head
Jindra Dolezy 10 years ago
parent 7fabf11107
commit 4596834b34
  1. 11
      espfs/espfs.c
  2. 1
      espfs/espfs.h

@ -112,6 +112,17 @@ void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
#define memcpyAligned memcpy #define memcpyAligned memcpy
#endif #endif
// Returns flags of opened file.
int ICACHE_FLASH_ATTR espFsFlags(EspFsFile *fh) {
if (fh == NULL) {
os_printf("File handle not ready\n");
return -1;
}
int8_t flags;
memcpyAligned((char*)&flags, (char*)&fh->header->flags, 1);
return (int)flags;
}
//Open a file and return a pointer to the file desc struct. //Open a file and return a pointer to the file desc struct.
EspFsFile ICACHE_FLASH_ATTR *espFsOpen(char *fileName) { EspFsFile ICACHE_FLASH_ATTR *espFsOpen(char *fileName) {

@ -15,6 +15,7 @@ typedef struct EspFsFile EspFsFile;
EspFsInitResult espFsInit(void *flashAddress); EspFsInitResult espFsInit(void *flashAddress);
EspFsFile *espFsOpen(char *fileName); EspFsFile *espFsOpen(char *fileName);
int espFsFlags(EspFsFile *fh);
int espFsRead(EspFsFile *fh, char *buff, int len); int espFsRead(EspFsFile *fh, char *buff, int len);
void espFsClose(EspFsFile *fh); void espFsClose(EspFsFile *fh);

Loading…
Cancel
Save