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
bd476acd
Commit
bd476acd
authored
Nov 22, 2016
by
w4kpm
Committed by
Damien George
Dec 02, 2016
Browse files
extmod/vfs_fat_file: Allow file obj to respond to ioctl flush request.
parent
e50cb73b
Changes
1
Hide whitespace changes
Inline
Side-by-side
extmod/vfs_fat_file.c
View file @
bd476acd
...
...
@@ -108,15 +108,6 @@ STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t siz
return
sz_out
;
}
STATIC
mp_obj_t
file_obj_flush
(
mp_obj_t
self_in
)
{
pyb_file_obj_t
*
self
=
MP_OBJ_TO_PTR
(
self_in
);
FRESULT
res
=
f_sync
(
&
self
->
fp
);
if
(
res
!=
FR_OK
)
{
mp_raise_OSError
(
fresult_to_errno_table
[
res
]);
}
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
file_obj_flush_obj
,
file_obj_flush
);
STATIC
mp_obj_t
file_obj_close
(
mp_obj_t
self_in
)
{
pyb_file_obj_t
*
self
=
MP_OBJ_TO_PTR
(
self_in
);
...
...
@@ -164,6 +155,14 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
s
->
offset
=
f_tell
(
&
self
->
fp
);
return
0
;
}
else
if
(
request
==
MP_STREAM_FLUSH
)
{
FRESULT
res
=
f_sync
(
&
self
->
fp
);
if
(
res
!=
FR_OK
)
{
*
errcode
=
fresult_to_errno_table
[
res
];
return
MP_STREAM_ERROR
;
}
return
0
;
}
else
{
*
errcode
=
MP_EINVAL
;
return
MP_STREAM_ERROR
;
...
...
@@ -243,7 +242,7 @@ STATIC const mp_rom_map_elem_t rawfile_locals_dict_table[] = {
{
MP_ROM_QSTR
(
MP_QSTR_readline
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readline_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_readlines
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readlines_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_write
),
MP_ROM_PTR
(
&
mp_stream_write_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_flush
),
MP_ROM_PTR
(
&
file_obj
_flush_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_flush
),
MP_ROM_PTR
(
&
mp_stream
_flush_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_close
),
MP_ROM_PTR
(
&
file_obj_close_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_seek
),
MP_ROM_PTR
(
&
mp_stream_seek_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_tell
),
MP_ROM_PTR
(
&
mp_stream_tell_obj
)
},
...
...
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