diff --git a/src/fs/file.c b/src/fs/file.c index f65c2b6..645cca3 100644 --- a/src/fs/file.c +++ b/src/fs/file.c @@ -430,3 +430,13 @@ int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { bool file_has_data(file_t *f) { return (f != NULL && f->data != NULL && file_get_size(f) > 0); } + +int delete_file(file_t *ef) { + meta_delete(ef->fid); + if (flash_clear_file(ef) != CCID_OK) + return CCID_EXEC_ERROR; + if (delete_dynamic_file(ef) != CCID_OK) + return CCID_EXEC_ERROR; + low_flash_available(); + return CCID_OK; +} diff --git a/src/fs/file.h b/src/fs/file.h index 3219c80..6b93118 100644 --- a/src/fs/file.h +++ b/src/fs/file.h @@ -118,6 +118,7 @@ extern bool isUserAuthenticated; extern int meta_find(uint16_t, uint8_t **out); extern int meta_delete(uint16_t fid); extern int meta_add(uint16_t fid, const uint8_t *data, uint16_t len); +extern int delete_file(file_t *ef); #endif