Skip to content
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

elm fatfs: ERROR "FR_NO_FILE" will be raised when creating a file in an directory with many entires. #48

Closed
prife opened this issue Mar 13, 2013 · 2 comments

Comments

@prife
Copy link
Contributor

prife commented Mar 13, 2013

Error "FR_NO_NAME" will be raised up, when creating a more file in an directory with too many entries. Hower it should be "FR_DENIED" or something better.

FR_DENIED
The required access was denied due to one of the following reasons:
Write mode open against the read-only file.
Deleting the read-only file or directory.
Deleting the non-empty directory or current directory.
Reading the file opened without FA_READ flag.
Any modification to the file opened without FA_WRITE flag.
Could not create the file or directory due to the directory table is full.
Could not create the directory due to the volume is full.

more: http://elm-chan.org/fsw/ff/en/rc.html

more: http://blog.csdn.net/leonwei/article/details/3980179

Test code (tested in simulator)

#include <dfs_posix.h>
static void rt_test_thread_entry(void *parameter)
{
    static int count;
    static char buf[64];
    int fd;
    for(;;)
    {
        rt_sprintf(buf, "/disk/sd/%08d.dat", count++);
        fd = open(buf, O_RDWR|O_APPEND|O_CREAT, 0);
        if (fd < 0)
        {
            rt_thread_t tid;
            tid = rt_thread_self();

            rt_kprintf("error <%d>! could not create file <%s>\n", tid->error, buf);
            /* FIXME */
            return ;
        }
        close(fd);
    }
}


    tid = rt_thread_create("test",
                           rt_test_thread_entry, RT_NULL,
                           2048, RT_THREAD_PRIORITY_MAX * 3 / 4, 20);
    if (tid != RT_NULL)
        rt_thread_startup(tid);
@BernardXiong
Copy link
Member

What's the error code in dfs? The application should get POSIX error number and not the FatFs error number.

@prife
Copy link
Contributor Author

prife commented Mar 14, 2013

the FR_NO_FILE will be converted to DFS_STATUS_ENOENT.

case FR_NO_FILE:
case FR_NO_PATH:
case FR_NO_FILESYSTEM:
status = -DFS_STATUS_ENOENT;
break;

I have submit the issue report to fatfs official website.

2013/3/14 Bernard Xiong notifications@github.com

What's the error code in dfs? The application should get POSIX error
number and not the FatFs error number.


Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-14888623
.

把有限的时间投入到无限的学习中去

BernardXiong pushed a commit that referenced this issue May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants