Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
dc43508c
Commit
dc43508c
authored
Oct 07, 2016
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/vfs_fat_file: Use MP_Exxx errno constants.
parent
016dba0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
extmod/vfs_fat_file.c
extmod/vfs_fat_file.c
+23
-22
No files found.
extmod/vfs_fat_file.c
View file @
dc43508c
...
...
@@ -35,6 +35,7 @@
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "py/mperrno.h"
#include "lib/fatfs/ff.h"
#include "extmod/vfs_fat_file.h"
...
...
@@ -49,25 +50,25 @@ extern const mp_obj_type_t mp_type_textio;
// this table converts from FRESULT to POSIX errno
const
byte
fresult_to_errno_table
[
20
]
=
{
[
FR_OK
]
=
0
,
[
FR_DISK_ERR
]
=
EIO
,
[
FR_INT_ERR
]
=
EIO
,
[
FR_NOT_READY
]
=
EBUSY
,
[
FR_NO_FILE
]
=
ENOENT
,
[
FR_NO_PATH
]
=
ENOENT
,
[
FR_INVALID_NAME
]
=
EINVAL
,
[
FR_DENIED
]
=
EACCES
,
[
FR_EXIST
]
=
EEXIST
,
[
FR_INVALID_OBJECT
]
=
EINVAL
,
[
FR_WRITE_PROTECTED
]
=
EROFS
,
[
FR_INVALID_DRIVE
]
=
ENODEV
,
[
FR_NOT_ENABLED
]
=
ENODEV
,
[
FR_NO_FILESYSTEM
]
=
ENODEV
,
[
FR_MKFS_ABORTED
]
=
EIO
,
[
FR_TIMEOUT
]
=
EIO
,
[
FR_LOCKED
]
=
EIO
,
[
FR_NOT_ENOUGH_CORE
]
=
ENOMEM
,
[
FR_TOO_MANY_OPEN_FILES
]
=
EMFILE
,
[
FR_INVALID_PARAMETER
]
=
EINVAL
,
[
FR_DISK_ERR
]
=
MP_
EIO
,
[
FR_INT_ERR
]
=
MP_
EIO
,
[
FR_NOT_READY
]
=
MP_
EBUSY
,
[
FR_NO_FILE
]
=
MP_
ENOENT
,
[
FR_NO_PATH
]
=
MP_
ENOENT
,
[
FR_INVALID_NAME
]
=
MP_
EINVAL
,
[
FR_DENIED
]
=
MP_
EACCES
,
[
FR_EXIST
]
=
MP_
EEXIST
,
[
FR_INVALID_OBJECT
]
=
MP_
EINVAL
,
[
FR_WRITE_PROTECTED
]
=
MP_
EROFS
,
[
FR_INVALID_DRIVE
]
=
MP_
ENODEV
,
[
FR_NOT_ENABLED
]
=
MP_
ENODEV
,
[
FR_NO_FILESYSTEM
]
=
MP_
ENODEV
,
[
FR_MKFS_ABORTED
]
=
MP_
EIO
,
[
FR_TIMEOUT
]
=
MP_
EIO
,
[
FR_LOCKED
]
=
MP_
EIO
,
[
FR_NOT_ENOUGH_CORE
]
=
MP_
ENOMEM
,
[
FR_TOO_MANY_OPEN_FILES
]
=
MP_
EMFILE
,
[
FR_INVALID_PARAMETER
]
=
MP_
EINVAL
,
};
typedef
struct
_pyb_file_obj_t
{
...
...
@@ -101,7 +102,7 @@ STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t siz
}
if
(
sz_out
!=
size
)
{
// The FatFS documentation says that this means disk full.
*
errcode
=
ENOSPC
;
*
errcode
=
MP_
ENOSPC
;
return
MP_STREAM_ERROR
;
}
return
sz_out
;
...
...
@@ -140,7 +141,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
case
1
:
// SEEK_CUR
if
(
s
->
offset
!=
0
)
{
*
errcode
=
ENOTSU
P
;
*
errcode
=
MP_EOPNOTSUP
P
;
return
MP_STREAM_ERROR
;
}
// no-operation
...
...
@@ -155,7 +156,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
return
0
;
}
else
{
*
errcode
=
EINVAL
;
*
errcode
=
MP_
EINVAL
;
return
MP_STREAM_ERROR
;
}
}
...
...
Write
Preview
Markdown
is supported
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