Skip to content

Commit d70f688

Browse files
committed
extmod/vfs: Use MP_S_IFDIR, MP_S_IFREG consts instead of magic numbers.
1 parent f1609bc commit d70f688

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

extmod/vfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ mp_obj_t mp_vfs_stat(mp_obj_t path_in) {
408408
mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out);
409409
if (vfs == MP_VFS_ROOT) {
410410
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
411-
t->items[0] = MP_OBJ_NEW_SMALL_INT(0x4000); // st_mode = stat.S_IFDIR
411+
t->items[0] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); // st_mode
412412
for (int i = 1; i <= 9; ++i) {
413413
t->items[i] = MP_OBJ_NEW_SMALL_INT(0); // dev, nlink, uid, gid, size, atime, mtime, ctime
414414
}

extmod/vfs_fat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
225225
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
226226
mp_int_t mode = 0;
227227
if (fno.fattrib & AM_DIR) {
228-
mode |= 0x4000; // stat.S_IFDIR
228+
mode |= MP_S_IFDIR;
229229
} else {
230-
mode |= 0x8000; // stat.S_IFREG
230+
mode |= MP_S_IFREG;
231231
}
232232
mp_int_t seconds = timeutils_seconds_since_2000(
233233
1980 + ((fno.fdate >> 9) & 0x7f),

0 commit comments

Comments
 (0)