/* this function is a POSIX compliant version, which will make a directory */
int mkdir(const char *path, mode_t mode)
/* this function is a POSIX compliant version, which will make a directory */
int mkdir(const char *path, mode_t mode)
{
    int result;
    struct stat stat;
    struct dfs_file file;
    if (path == NULL)
    {
        rt_set_errno(-EBADF);
        return -1;
    }
    if (path && dfs_file_lstat(path, &stat) == 0)
    {
        rt_set_errno(-EEXIST);
        return -1;
    }
    dfs_file_init(&file);
    result = dfs_file_open(&file, path, O_DIRECTORY | O_CREAT, mode);
    if (result >= 0)
    {
        dfs_file_close(&file);
        result = 0;
    }
    else
    {
        rt_set_errno(result);
        result = -1;
    }
    dfs_file_deinit(&file);
    return result;
}