Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
dc43508c
Commit
dc43508c
authored
8 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
extmod/vfs_fat_file: Use MP_Exxx errno constants.
parent
016dba0e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
extmod/vfs_fat_file.c
+23
-22
23 additions, 22 deletions
extmod/vfs_fat_file.c
with
23 additions
and
22 deletions
extmod/vfs_fat_file.c
+
23
−
22
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
=
E
NOTSUP
;
*
errcode
=
MP_EOP
NOTSUP
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
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment