Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
d70f688f
Commit
d70f688f
authored
May 10, 2017
by
Damien George
Browse files
extmod/vfs: Use MP_S_IFDIR, MP_S_IFREG consts instead of magic numbers.
parent
f1609bc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
extmod/vfs.c
View file @
d70f688f
...
...
@@ -408,7 +408,7 @@ mp_obj_t mp_vfs_stat(mp_obj_t path_in) {
mp_vfs_mount_t
*
vfs
=
lookup_path
(
path_in
,
&
path_out
);
if
(
vfs
==
MP_VFS_ROOT
)
{
mp_obj_tuple_t
*
t
=
MP_OBJ_TO_PTR
(
mp_obj_new_tuple
(
10
,
NULL
));
t
->
items
[
0
]
=
MP_OBJ_NEW_SMALL_INT
(
0x4000
);
// st_mode
= stat.S_IFDIR
t
->
items
[
0
]
=
MP_OBJ_NEW_SMALL_INT
(
MP_S_IFDIR
);
// st_mode
for
(
int
i
=
1
;
i
<=
9
;
++
i
)
{
t
->
items
[
i
]
=
MP_OBJ_NEW_SMALL_INT
(
0
);
// dev, nlink, uid, gid, size, atime, mtime, ctime
}
...
...
extmod/vfs_fat.c
View file @
d70f688f
...
...
@@ -225,9 +225,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_tuple_t
*
t
=
MP_OBJ_TO_PTR
(
mp_obj_new_tuple
(
10
,
NULL
));
mp_int_t
mode
=
0
;
if
(
fno
.
fattrib
&
AM_DIR
)
{
mode
|=
0x4000
;
// stat.
S_IFDIR
mode
|=
MP_
S_IFDIR
;
}
else
{
mode
|=
0x8000
;
// stat.
S_IFREG
mode
|=
MP_
S_IFREG
;
}
mp_int_t
seconds
=
timeutils_seconds_since_2000
(
1980
+
((
fno
.
fdate
>>
9
)
&
0x7f
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment