Skip to content

Commit 71b429b

Browse files
committed
Cleaned up compilation with logging enabled
- Removed list of warnings on signedness of integers in printf - Fixed issue with "true" in ifdef
1 parent 72fab82 commit 71b429b

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

LittleFileSystem.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int LittleFileSystem::mount(BlockDevice *bd) {
169169

170170
int LittleFileSystem::unmount() {
171171
_mutex.lock();
172-
LFS_INFO("unmount()", "");
172+
LFS_INFO("unmount(%s)", "");
173173
if (_bd) {
174174
int err = lfs_unmount(&_lfs);
175175
if (err) {
@@ -196,7 +196,7 @@ int LittleFileSystem::unmount() {
196196
int LittleFileSystem::format(BlockDevice *bd,
197197
lfs_size_t read_size, lfs_size_t prog_size,
198198
lfs_size_t block_size, lfs_size_t lookahead) {
199-
LFS_INFO("format(%p, %d, %d, %d, %d)",
199+
LFS_INFO("format(%p, %ld, %ld, %ld, %ld)",
200200
bd, read_size, prog_size, block_size, lookahead);
201201
int err = bd->init();
202202
if (err) {
@@ -309,7 +309,7 @@ int LittleFileSystem::rename(const char *oldname, const char *newname) {
309309

310310
int LittleFileSystem::mkdir(const char *name, mode_t mode) {
311311
_mutex.lock();
312-
LFS_INFO("mkdir(\"%s\", 0x%x)", name, mode);
312+
LFS_INFO("mkdir(\"%s\", 0x%lx)", name, mode);
313313
int err = lfs_mkdir(&_lfs, name);
314314
LFS_INFO("mkdir -> %d", lfs_toerror(err));
315315
_mutex.unlock();
@@ -385,7 +385,7 @@ int LittleFileSystem::file_sync(fs_file_t file) {
385385
off_t LittleFileSystem::file_seek(fs_file_t file, off_t offset, int whence) {
386386
lfs_file_t *f = (lfs_file_t *)file;
387387
_mutex.lock();
388-
LFS_INFO("file_seek(%p, %d, %d)", file, offset, whence);
388+
LFS_INFO("file_seek(%p, %ld, %d)", file, offset, whence);
389389
off_t res = lfs_file_seek(&_lfs, f, offset, lfs_fromwhence(whence));
390390
LFS_INFO("file_seek -> %d", lfs_toerror(res));
391391
_mutex.unlock();
@@ -454,9 +454,9 @@ ssize_t LittleFileSystem::dir_read(fs_dir_t dir, struct dirent *ent) {
454454
void LittleFileSystem::dir_seek(fs_dir_t dir, off_t offset) {
455455
lfs_dir_t *d = (lfs_dir_t *)dir;
456456
_mutex.lock();
457-
LFS_INFO("dir_seek(%p, %d)", dir, offset);
457+
LFS_INFO("dir_seek(%p, %ld)", dir, offset);
458458
lfs_dir_seek(&_lfs, d, offset);
459-
LFS_INFO("dir_seek -> void", "");
459+
LFS_INFO("dir_seek -> %s", "void");
460460
_mutex.unlock();
461461
}
462462

@@ -475,7 +475,7 @@ void LittleFileSystem::dir_rewind(fs_dir_t dir) {
475475
_mutex.lock();
476476
LFS_INFO("dir_rewind(%p)", dir);
477477
lfs_dir_rewind(&_lfs, d);
478-
LFS_INFO("dir_rewind -> void", "");
478+
LFS_INFO("dir_rewind -> %s", "void");
479479
_mutex.unlock();
480480
}
481481

littlefs/lfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
20272027
}
20282028

20292029
if (superblock.d.version > (0x00010001 | 0x0000ffff)) {
2030-
LFS_ERROR("Invalid version %ld.%ld\n",
2030+
LFS_ERROR("Invalid version %ld.%ld",
20312031
0xffff & (superblock.d.version >> 16),
20322032
0xffff & (superblock.d.version >> 0));
20332033
return LFS_ERR_INVAL;
@@ -2343,14 +2343,14 @@ int lfs_deorphan(lfs_t *lfs) {
23432343
}
23442344

23452345
if (moved) {
2346-
LFS_DEBUG("Found move %d %d",
2346+
LFS_DEBUG("Found move %ld %ld",
23472347
entry.d.u.dir[0], entry.d.u.dir[1]);
23482348
int err = lfs_dir_remove(lfs, &cwd, &entry);
23492349
if (err) {
23502350
return err;
23512351
}
23522352
} else {
2353-
LFS_DEBUG("Found partial move %d %d",
2353+
LFS_DEBUG("Found partial move %ld %ld",
23542354
entry.d.u.dir[0], entry.d.u.dir[1]);
23552355
entry.d.type &= ~0x80;
23562356
int err = lfs_dir_update(lfs, &cwd, &entry, NULL);

littlefs/lfs_util.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,31 +98,31 @@ void lfs_crc(uint32_t *crc, const void *buffer, size_t size);
9898
#define MBED_LFS_ENABLE_ERROR true
9999
#endif
100100

101-
#if MBED_LFS_ENABLE_INFO == true
101+
#if MBED_LFS_ENABLE_INFO
102102
#define LFS_INFO(fmt, ...) printf("lfs info: " fmt "\n", __VA_ARGS__)
103103
#elif !defined(MBED_LFS_ENABLE_INFO)
104104
#define LFS_INFO(fmt, ...) debug("lfs info: " fmt "\n", __VA_ARGS__)
105105
#else
106106
#define LFS_INFO(fmt, ...)
107107
#endif
108108

109-
#if MBED_LFS_ENABLE_DEBUG == true
109+
#if MBED_LFS_ENABLE_DEBUG
110110
#define LFS_DEBUG(fmt, ...) printf("lfs debug: " fmt "\n", __VA_ARGS__)
111111
#elif !defined(MBED_LFS_ENABLE_DEBUG)
112112
#define LFS_DEBUG(fmt, ...) debug("lfs debug: " fmt "\n", __VA_ARGS__)
113113
#else
114114
#define LFS_DEBUG(fmt, ...)
115115
#endif
116116

117-
#if MBED_LFS_ENABLE_WARN == true
117+
#if MBED_LFS_ENABLE_WARN
118118
#define LFS_WARN(fmt, ...) printf("lfs warn: " fmt "\n", __VA_ARGS__)
119119
#elif !defined(MBED_LFS_ENABLE_WARN)
120120
#define LFS_WARN(fmt, ...) debug("lfs warn: " fmt "\n", __VA_ARGS__)
121121
#else
122122
#define LFS_WARN(fmt, ...)
123123
#endif
124124

125-
#if MBED_LFS_ENABLE_ERROR == true
125+
#if MBED_LFS_ENABLE_ERROR
126126
#define LFS_ERROR(fmt, ...) printf("lfs error: " fmt "\n", __VA_ARGS__)
127127
#elif !defined(MBED_LFS_ENABLE_ERROR)
128128
#define LFS_ERROR(fmt, ...) debug("lfs error: " fmt "\n", __VA_ARGS__)

0 commit comments

Comments
 (0)