summaryrefslogtreecommitdiff
path: root/components/dfs/src
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-11-20 23:13:45 +0800
committerGitHub <[email protected]>2018-11-20 23:13:45 +0800
commit46dae3f35f5cc44664a26ebd87803156033a166a (patch)
tree47f132d0a7472768deabd2add67d990c0c6e64e7 /components/dfs/src
parentb31888de49408b212d2aeab4b40b2a672b958313 (diff)
parent6b6d122e3673ca64d2171d3daf1ae940edfa699a (diff)
Merge branch 'master' into dev-4.0.x
Diffstat (limited to 'components/dfs/src')
-rw-r--r--components/dfs/src/dfs.c20
-rw-r--r--components/dfs/src/dfs_file.c38
-rw-r--r--components/dfs/src/dfs_fs.c28
-rw-r--r--components/dfs/src/dfs_posix.c22
-rw-r--r--components/dfs/src/poll.c18
-rw-r--r--components/dfs/src/select.c18
6 files changed, 30 insertions, 114 deletions
diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c
index 5a98883549..38a1813421 100644
--- a/components/dfs/src/dfs.c
+++ b/components/dfs/src/dfs.c
@@ -1,21 +1,7 @@
/*
- * File : dfs.c
- * This file is part of Device File System in RT-Thread RTOS
- * COPYRIGHT (C) 2004-2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -199,7 +185,7 @@ int fd_new(void)
if (idx == fdt->maxfd)
{
idx = -(1 + DFS_FD_OFFSET);
- dbg_log(DBG_ERROR, "DFS fd new is failed! Could not found an empty fd entry.");
+ LOG_E( "DFS fd new is failed! Could not found an empty fd entry.");
goto __result;
}
diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c
index 76cf419c0a..646ae58e36 100644
--- a/components/dfs/src/dfs_file.c
+++ b/components/dfs/src/dfs_file.c
@@ -1,22 +1,8 @@
/*
- * File : dfs_file.c
- * This file is part of Device File System in RT-Thread RTOS
- * COPYRIGHT (C) 2004-2011, RT-Thread Development Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
+ * SPDX-License-Identifier: Apache-2.0
+ *
* Change Logs:
* Date Author Notes
* 2005-02-22 Bernard The first version.
@@ -60,7 +46,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
return -ENOMEM;
}
- dbg_log(DBG_LOG, "open file:%s\n", fullpath);
+ LOG_D("open file:%s", fullpath);
/* Check whether file is already open */
if (fd_is_open(fullpath) == 0)
@@ -79,7 +65,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
return -ENOENT;
}
- dbg_log(DBG_LOG, "open in filesystem:%s\n", fs->ops->name);
+ LOG_D("open in filesystem:%s", fs->ops->name);
fd->fops = fs->ops->fops; /* set file ops */
/* initialize the fd item */
@@ -96,7 +82,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
else
fd->path = rt_strdup(dfs_subdir(fs->path, fullpath));
rt_free(fullpath);
- dbg_log(DBG_LOG, "Actual file path: %s\n", fd->path);
+ LOG_D("Actual file path: %s", fd->path);
}
else
{
@@ -119,7 +105,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
rt_free(fd->path);
fd->path = NULL;
- dbg_log(DBG_ERROR, "open failed\n");
+ LOG_E("open failed");
return result;
}
@@ -131,7 +117,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
fd->flags |= DFS_F_DIRECTORY;
}
- dbg_log(DBG_INFO, "open successful\n");
+ LOG_I("open successful");
return 0;
}
@@ -389,8 +375,8 @@ int dfs_file_stat(const char *path, struct stat *buf)
if ((fs = dfs_filesystem_lookup(fullpath)) == NULL)
{
- dbg_log(DBG_ERROR,
- "can't find mounted filesystem on this path:%s\n", fullpath);
+ LOG_E(
+ "can't find mounted filesystem on this path:%s", fullpath);
rt_free(fullpath);
return -ENOENT;
@@ -419,8 +405,8 @@ int dfs_file_stat(const char *path, struct stat *buf)
if (fs->ops->stat == NULL)
{
rt_free(fullpath);
- dbg_log(DBG_ERROR,
- "the filesystem didn't implement this function\n");
+ LOG_E(
+ "the filesystem didn't implement this function");
return -ENOSYS;
}
diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c
index 66740d647e..a183e7f124 100644
--- a/components/dfs/src/dfs_fs.c
+++ b/components/dfs/src/dfs_fs.c
@@ -1,21 +1,7 @@
/*
- * File : dfs_fs.c
- * This file is part of Device File System in RT-Thread RTOS
- * COPYRIGHT (C) 2004-2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -69,7 +55,7 @@ int dfs_register(const struct dfs_filesystem_ops *ops)
if (empty == NULL)
{
rt_set_errno(-ENOSPC);
- dbg_log(DBG_ERROR, "There is no space to register this file system (%d).\n", ops->name);
+ LOG_E("There is no space to register this file system (%d).", ops->name);
ret = -1;
}
else if (ret == RT_EOK)
@@ -318,7 +304,7 @@ int dfs_mount(const char *device_name,
if ((fs == NULL) && (iter == &filesystem_table[DFS_FILESYSTEMS_MAX]))
{
rt_set_errno(-ENOSPC);
- dbg_log(DBG_ERROR, "There is no space to mount this file system (%s).\n", filesystemtype);
+ LOG_E("There is no space to mount this file system (%s).", filesystemtype);
goto err1;
}
@@ -451,7 +437,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
if (dev_id == NULL)
{
rt_set_errno(-ENODEV);
- dbg_log(DBG_ERROR, "Device (%s) was not found\n", device_name);
+ LOG_E("Device (%s) was not found", device_name);
return -1;
}
@@ -472,7 +458,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
const struct dfs_filesystem_ops *ops = filesystem_operation_table[index];
if (ops->mkfs == NULL)
{
- dbg_log(DBG_ERROR, "The file system (%s) mkfs function was not implement\n", fs_name);
+ LOG_E("The file system (%s) mkfs function was not implement", fs_name);
rt_set_errno(-ENOSYS);
return -1;
}
@@ -480,7 +466,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
return ops->mkfs(dev_id);
}
- dbg_log(DBG_ERROR, "File system (%s) was not found.\n", fs_name);
+ LOG_E("File system (%s) was not found.", fs_name);
return -1;
}
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index 898488a2aa..97531ad59c 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -1,21 +1,7 @@
/*
- * File : dfs_posix.c
- * This file is part of Device File System in RT-Thread RTOS
- * COPYRIGHT (C) 2004-2012, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
@@ -124,7 +110,7 @@ RTM_EXPORT(close);
* @return the actual read data buffer length. If the returned value is 0, it
* may be reach the end of file, please check errno.
*/
-#ifdef RT_USING_NEWLIB
+#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
_READ_WRITE_RETURN_TYPE _EXFUN(read, (int fd, void *buf, size_t len))
#else
int read(int fd, void *buf, size_t len)
@@ -168,7 +154,7 @@ RTM_EXPORT(read);
*
* @return the actual written data buffer length.
*/
-#ifdef RT_USING_NEWLIB
+#if defined(RT_USING_NEWLIB) && defined(_EXFUN)
_READ_WRITE_RETURN_TYPE _EXFUN(write, (int fd, const void *buf, size_t len))
#else
int write(int fd, const void *buf, size_t len)
diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c
index f2f3fc4c76..6655a8a667 100644
--- a/components/dfs/src/poll.c
+++ b/components/dfs/src/poll.c
@@ -1,21 +1,7 @@
/*
- * File : poll.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/components/dfs/src/select.c b/components/dfs/src/select.c
index cbbd159557..b9a444fe44 100644
--- a/components/dfs/src/select.c
+++ b/components/dfs/src/select.c
@@ -1,21 +1,7 @@
/*
- * File : select.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes