mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 11:39:14 -07:00
make style
This commit is contained in:
parent
b4d54ae0a2
commit
9beabaabf5
29 changed files with 4784 additions and 4778 deletions
|
@ -507,7 +507,8 @@ int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, R
|
|||
break;
|
||||
case RDV40_SPIFFS_FILETYPE_BOTH:
|
||||
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
||||
default:;
|
||||
default:
|
||||
;
|
||||
} //
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ typedef enum spiffs_file_type {
|
|||
RDV40_SPIFFS_FILETYPE_UNKNOWN
|
||||
} RDV40SpiFFSFileType;
|
||||
|
||||
typedef struct rdv40_spiffs_fsinfo
|
||||
{
|
||||
typedef struct rdv40_spiffs_fsinfo {
|
||||
uint32_t blockSize;
|
||||
uint32_t pageSize;
|
||||
uint32_t maxOpenFiles;
|
||||
|
|
|
@ -406,8 +406,7 @@ static s32_t spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, s
|
|||
} else {
|
||||
// if nothing exists, we cannot safely make a decision - delete
|
||||
}
|
||||
}
|
||||
else if ((p_hdr->flags & SPIFFS_PH_FLAG_DELET) == 0) {
|
||||
} else if ((p_hdr->flags & SPIFFS_PH_FLAG_DELET) == 0) {
|
||||
SPIFFS_CHECK_DBG("LU: pix "_SPIPRIpg" busy in lu but deleted on page\n", cur_pix);
|
||||
delete_page = 1;
|
||||
} else if ((p_hdr->flags & SPIFFS_PH_FLAG_FINAL)) {
|
||||
|
@ -688,8 +687,7 @@ static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
|
|||
SPIFFS_CHECK_RES(res);
|
||||
restart = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// mark rpix as referenced
|
||||
const u32_t rpix_byte_ix = (rpix - pix_offset) / (8 / bits);
|
||||
const u8_t rpix_bit_ix = (rpix & ((8 / bits) - 1)) * bits;
|
||||
|
|
|
@ -185,7 +185,9 @@ void SPIFFS_clearerr(spiffs *fs) {
|
|||
s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) {
|
||||
SPIFFS_API_DBG("%s '%s'\n", __func__, path);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)path; (void)mode;
|
||||
(void)fs;
|
||||
(void)path;
|
||||
(void)mode;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
(void)mode;
|
||||
|
@ -459,7 +461,10 @@ static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offs
|
|||
s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
||||
SPIFFS_API_DBG("%s "_SPIPRIfd " "_SPIPRIi "\n", __func__, fh, len);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)fh; (void)buf; (void)len;
|
||||
(void)fs;
|
||||
(void)fh;
|
||||
(void)buf;
|
||||
(void)len;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -512,8 +517,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
|
|||
// have a cached page for this fd already, check cache page boundaries
|
||||
if (offset < fd->cache_page->ucache.swrc.offset || // writing before cache
|
||||
offset > fd->cache_page->ucache.swrc.offset + fd->cache_page->ucache.swrc.size || // writing after cache
|
||||
offset + len > fd->cache_page->ucache.swrc.offset + SPIFFS_CFG_LOG_PAGE_SZ(fs)) // writing beyond cache page
|
||||
{
|
||||
offset + len > fd->cache_page->ucache.swrc.offset + SPIFFS_CFG_LOG_PAGE_SZ(fs)) { // writing beyond cache page
|
||||
// boundary violation, write back cache first and allocate new
|
||||
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page "_SPIPRIi" for fd "_SPIPRIfd":"_SPIPRIid", boundary viol, offs:"_SPIPRIi" size:"_SPIPRIi"\n",
|
||||
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->ucache.swrc.offset, fd->cache_page->ucache.swrc.size);
|
||||
|
@ -650,7 +654,8 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
|
|||
s32_t SPIFFS_remove(spiffs *fs, const char *path) {
|
||||
SPIFFS_API_DBG("%s '%s'\n", __func__, path);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)path;
|
||||
(void)fs;
|
||||
(void)path;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -693,7 +698,8 @@ s32_t SPIFFS_remove(spiffs *fs, const char *path) {
|
|||
s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh) {
|
||||
SPIFFS_API_DBG("%s "_SPIPRIfd "\n", __func__, fh);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)fh;
|
||||
(void)fs;
|
||||
(void)fh;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -874,7 +880,9 @@ s32_t SPIFFS_close(spiffs *fs, spiffs_file fh) {
|
|||
s32_t SPIFFS_rename(spiffs *fs, const char *old_path, const char *new_path) {
|
||||
SPIFFS_API_DBG("%s %s %s\n", __func__, old_path, new_path);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)old_path; (void)new_path;
|
||||
(void)fs;
|
||||
(void)old_path;
|
||||
(void)new_path;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -929,7 +937,9 @@ s32_t SPIFFS_rename(spiffs *fs, const char *old_path, const char *new_path) {
|
|||
#if SPIFFS_OBJ_META_LEN
|
||||
s32_t SPIFFS_update_meta(spiffs *fs, const char *name, const void *meta) {
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)name; (void)meta;
|
||||
(void)fs;
|
||||
(void)name;
|
||||
(void)meta;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -966,7 +976,9 @@ s32_t SPIFFS_update_meta(spiffs *fs, const char *name, const void *meta) {
|
|||
|
||||
s32_t SPIFFS_fupdate_meta(spiffs *fs, spiffs_file fh, const void *meta) {
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)fh; (void)meta;
|
||||
(void)fs;
|
||||
(void)fh;
|
||||
(void)meta;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
SPIFFS_API_CHECK_CFG(fs);
|
||||
|
@ -1149,7 +1161,8 @@ s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used) {
|
|||
s32_t SPIFFS_gc_quick(spiffs *fs, u16_t max_free_pages) {
|
||||
SPIFFS_API_DBG("%s "_SPIPRIi "\n", __func__, max_free_pages);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)max_free_pages;
|
||||
(void)fs;
|
||||
(void)max_free_pages;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
s32_t res;
|
||||
|
@ -1169,7 +1182,8 @@ s32_t SPIFFS_gc_quick(spiffs *fs, u16_t max_free_pages) {
|
|||
s32_t SPIFFS_gc(spiffs *fs, u32_t size) {
|
||||
SPIFFS_API_DBG("%s "_SPIPRIi "\n", __func__, size);
|
||||
#if SPIFFS_READ_ONLY
|
||||
(void)fs; (void)size;
|
||||
(void)fs;
|
||||
(void)size;
|
||||
return SPIFFS_ERR_RO_NOT_IMPL;
|
||||
#else
|
||||
s32_t res;
|
||||
|
|
|
@ -169,8 +169,7 @@ s32_t spiffs_obj_lu_find_entry_visitor(
|
|||
// check each entry
|
||||
while (res == SPIFFS_OK &&
|
||||
cur_entry - entry_offset < entries_per_page && // for non-last obj lookup pages
|
||||
cur_entry < (int)SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs)) // for last obj lookup page
|
||||
{
|
||||
cur_entry < (int)SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs)) { // for last obj lookup page
|
||||
if ((flags & SPIFFS_VIS_CHECK_ID) == 0 || obj_lu_buf[cur_entry - entry_offset] == obj_id) {
|
||||
if (block_ix) *block_ix = cur_block;
|
||||
if (lu_entry) *lu_entry = cur_entry;
|
||||
|
|
|
@ -509,7 +509,8 @@ typedef struct SPIFFS_PACKED
|
|||
// metadata. not interpreted by SPIFFS in any way.
|
||||
u8_t meta[SPIFFS_OBJ_META_LEN];
|
||||
#endif
|
||||
} spiffs_page_object_ix_header;
|
||||
}
|
||||
spiffs_page_object_ix_header;
|
||||
|
||||
// object index page header
|
||||
typedef struct SPIFFS_PACKED {
|
||||
|
|
|
@ -109,16 +109,14 @@ void itoa(int n, char s[]) {
|
|||
|
||||
|
||||
|
||||
char *strcpy(char *dst, const char *src)
|
||||
{
|
||||
char *strcpy(char *dst, const char *src) {
|
||||
char *save = dst;
|
||||
|
||||
for (; (*dst = *src) != '\0'; ++src, ++dst);
|
||||
return save;
|
||||
}
|
||||
|
||||
char *strncpy(char *dst, const char *src, size_t n)
|
||||
{
|
||||
char *strncpy(char *dst, const char *src, size_t n) {
|
||||
if (n != 0) {
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
|
@ -136,8 +134,7 @@ char *strncpy(char *dst, const char *src, size_t n)
|
|||
return dst;
|
||||
}
|
||||
|
||||
int strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
int strcmp(const char *s1, const char *s2) {
|
||||
while (*s1 == *s2++) {
|
||||
if (*s1++ == 0) {
|
||||
return (0);
|
||||
|
@ -148,8 +145,7 @@ int strcmp(const char *s1, const char *s2)
|
|||
|
||||
char *__strtok_r(char *, const char *, char **);
|
||||
|
||||
char* __strtok_r(char* s, const char* delim, char** last)
|
||||
{
|
||||
char *__strtok_r(char *s, const char *delim, char **last) {
|
||||
char *spanp, *tok;
|
||||
int c, sc;
|
||||
|
||||
|
@ -161,14 +157,13 @@ char* __strtok_r(char* s, const char* delim, char** last)
|
|||
*/
|
||||
cont:
|
||||
c = *s++;
|
||||
for(spanp = (char*)delim; (sc = *spanp++) != 0;)
|
||||
{
|
||||
for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
|
||||
if (c == sc)
|
||||
goto cont;
|
||||
}
|
||||
|
||||
if(c == 0)
|
||||
{ /* no non-delimiter characters */
|
||||
if (c == 0) {
|
||||
/* no non-delimiter characters */
|
||||
*last = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -178,14 +173,11 @@ cont:
|
|||
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||
* Note that delim must have one NUL; we stop if we see that, too.
|
||||
*/
|
||||
for(;;)
|
||||
{
|
||||
for (;;) {
|
||||
c = *s++;
|
||||
spanp = (char *)delim;
|
||||
do
|
||||
{
|
||||
if((sc = *spanp++) == c)
|
||||
{
|
||||
do {
|
||||
if ((sc = *spanp++) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
|
@ -198,8 +190,7 @@ cont:
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
char* strtok(char* s, const char* delim)
|
||||
{
|
||||
char *strtok(char *s, const char *delim) {
|
||||
static char *last;
|
||||
|
||||
return (__strtok_r(s, delim, &last));
|
||||
|
|
|
@ -432,8 +432,10 @@ static int CmdFlashMemSpiFFSLoad(const char *Cmd) {
|
|||
static command_t CommandTable[] = {
|
||||
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"copy", CmdFlashMemSpiFFSCopy, IfPm3Flash,
|
||||
"Copy a file to another (destructively) in SPIFFS FileSystem in FlashMEM (spiffs)"},
|
||||
{
|
||||
"copy", CmdFlashMemSpiFFSCopy, IfPm3Flash,
|
||||
"Copy a file to another (destructively) in SPIFFS FileSystem in FlashMEM (spiffs)"
|
||||
},
|
||||
{"dump", CmdFlashMemSpiFFSDump, IfPm3Flash, "Dump a file from SPIFFS FileSystem in FlashMEM (spiffs)"},
|
||||
{"info", CmdFlashMemSpiFFSInfo, IfPm3Flash, "Print filesystem info and usage statistics (spiffs)"},
|
||||
{"load", CmdFlashMemSpiFFSLoad, IfPm3Flash, "Upload file into SPIFFS Filesystem (spiffs)"},
|
||||
|
@ -443,7 +445,8 @@ static command_t CommandTable[] = {
|
|||
{"test", CmdFlashMemSpiFFSTest, IfPm3Flash, "Test SPIFFS Functionning (require wiping pages 0 and 1)"},
|
||||
{"tree", CmdFlashMemSpiFFSTree, IfPm3Flash, "Print the Flash Memory FileSystem Tree (spiffs)"},
|
||||
{"unmount", CmdFlashMemSpiFFSUnmount, IfPm3Flash, "Un-mount the SPIFFS Filesystem if not already mounted (spiffs)"},
|
||||
{NULL, NULL, NULL, NULL}};
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static int CmdHelp(const char *Cmd) {
|
||||
(void)Cmd; // Cmd is not used so far
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue