Skip to content

fatfs: Update error code mapping #6336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2018
Merged

fatfs: Update error code mapping #6336

merged 4 commits into from
May 22, 2018

Conversation

geky
Copy link
Contributor

@geky geky commented Mar 12, 2018

Description

Continues #6072, #6120, #6323

A lot of the error codes in fatfs were mapped incorrectly. This patch revisits the error code mapping to try to correct these mistakes.

Note: This is required before we can test LittleFS + FAT consistently

ChanFS was should be ChanFS description
FR_OK 0 0 Succeeded
FR_DISK_ERR EIO EIO A hard error occurred in the low level disk I/O layer
FR_INT_ERR EBADF -1 Assertion failed
FR_NOT_READY EIO EIO The physical drive cannot work
FR_NO_FILE ENOENT ENOENT Could not find the file
FR_NO_PATH ENOENT ENOTDIR Could not find the path
FR_INVALID_NAME ENOENT EINVAL The path name format is invalid
FR_DENIED EACCES EACCES Access denied due to prohibited access or directory full
FR_EXIST EEXIST EEXIST Access denied due to prohibited access
FR_INVALID_OBJECT EFAULT EBADF The file/directory object is invalid
FR_WRITE_PROTECTED EACCES EACCES The physical drive is write protected
FR_INVALID_DRIVE ENOENT ENODEV The logical drive number is invalid
FR_NOT_ENABLED ENXIO ENODEV The volume has no work area
FR_NO_FILESYSTEM ENOENT EINVAL There is no valid FAT volume
FR_MKFS_ABORTED EBADF EIO The f_mkfs() aborted due to any problem
FR_TIMEOUT EBADF ETIMEDOUT Could not get a grant to access the volume within defined period
FR_LOCKED EACCES EBUSY The operation is rejected according to the file sharing policy
FR_NOT_ENOUGH_CORE ENOMEM ENOMEM LFN working buffer could not be allocated
FR_TOO_MANY_OPEN_FILES ENFILE ENFILE Number of open files > FF_FS_LOCK
FR_INVALID_PARAMETER ENOEXEC EINVAL Given parameter is invalid

cc @kegilbert, @deepikabhavnani, @kjbracey-arm, @JanneKiiskila, @teetak01
intended for minor release
should resolve #6072, #5653

Pull request type

  • Fix
  • Refactor
  • New target
  • Feature
  • Breaking change

0xc0170
0xc0170 previously approved these changes Mar 13, 2018
cmonr
cmonr previously approved these changes Mar 21, 2018
@cmonr
Copy link
Contributor

cmonr commented Mar 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

Build : SUCCESS

Build number : 1502
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6336/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 21, 2018

@JanneKiiskila @yogpan01 to be aware for this change

@JanneKiiskila
Copy link
Contributor

Task IOTCLT-2533 raised to our backog.

@teetak01
Copy link
Contributor

I would recommend to keep this PR open until IOTCLT-2533 is done.

@cmonr
Copy link
Contributor

cmonr commented Mar 21, 2018

Acking the Do Not Merge until the internal ticket is resolved.

kjbracey
kjbracey previously approved these changes Mar 22, 2018
@JanneKiiskila
Copy link
Contributor

JanneKiiskila commented Apr 18, 2018

This will be resolved in Cloud Client release 1.3.1, which is due any day now.

@geky geky dismissed stale reviews from kjbracey, cmonr, and 0xc0170 via 9902a2b April 29, 2018 15:00
@geky
Copy link
Contributor Author

geky commented Apr 29, 2018

Ok, now this should fix #5653

Also added a fix for some issues with errno include ordering

@cmonr
Copy link
Contributor

cmonr commented May 15, 2018

@geky @JanneKiiskila Is it safe to say that this is now unblocked and can proceed into 5.9?

@geky
Copy link
Contributor Author

geky commented May 15, 2018

@teetak01, can this be progressed?

@teetak01
Copy link
Contributor

teetak01 commented May 15, 2018

http://github.com/armmbed/mbed-cloud-client-example should be compatible. At least it was working one month ago still. The required fix on Client-side was already part of 1.3.1 release.

geky added 4 commits May 17, 2018 10:26
A lot of the error codes in fatfs were mapped incorrectly. This patch
revisits the error code mapping to try to correct these mistakes.
Unfortunately, some toolchains don't define the same errno codes that
are used fairly consistently on Linux based platforms, which means they
also don't match the errno codes used in the retarget layer.

If a user includes errno.h after mbed.h, the errno codes can be
redefined incorrectly.

Adding an include of errno.h in mbed.h forces the order to be fixed.
The errno.h header file defines the type error_t, unfortunately this
is a common type name that may be defined in user code. For at least GCC
we can work around this by telling errno that the error_t is already
defined.
@geky
Copy link
Contributor Author

geky commented May 17, 2018

Rebased and added a workaround for the error_t conflict

@cmonr
Copy link
Contributor

cmonr commented May 17, 2018

Will restart CI later today. Giving PRs targeted for 5.8.5 a chance to complete.

@adbridge
Copy link
Contributor

@kjbracey-arm @cmonr @0xc0170 Are you happy with the updates ? Can you please approve if so?

@cmonr
Copy link
Contributor

cmonr commented May 21, 2018

My bad. Forgot I was a reviewer ^_^

/morph build

@mbed-ci
Copy link

mbed-ci commented May 21, 2018

Build : SUCCESS

Build number : 2089
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6336/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented May 22, 2018

@mbed-ci
Copy link

mbed-ci commented May 22, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented May 22, 2018

I would recommend to keep this PR open until IOTCLT-2533 is done.

@teetak01 I checked and its closed. All good for this PR to be approved?

@0xc0170 0xc0170 requested a review from teetak01 May 22, 2018 11:02
Copy link
Contributor

@teetak01 teetak01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fine. I only tested the original PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FAT Filesystem error code maps to incorrect errors
9 participants