MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / mkdir

Function mkdir

components/dfs/dfs_v2/src/dfs_posix.c:812–847  ·  view source on GitHub ↗

* this function is a POSIX compliant version, which will make a directory * * @param path the directory path to be made. * @param mode The permission mode for the new directory (unused here, can be set to 0). * * @return 0 on successful, others on failed. */

Source from the content-addressed store, hash-verified

810 * @return 0 on successful, others on failed.
811 */
812int mkdir(const char *path, mode_t mode)
813{
814 int result;
815 struct stat stat;
816 struct dfs_file file;
817
818 if (path == NULL)
819 {
820 rt_set_errno(-EBADF);
821 return -1;
822 }
823
824 if (path && dfs_file_lstat(path, &stat) == 0)
825 {
826 rt_set_errno(-EEXIST);
827 return -1;
828 }
829
830 dfs_file_init(&file);
831
832 result = dfs_file_open(&file, path, O_DIRECTORY | O_CREAT, mode);
833 if (result >= 0)
834 {
835 dfs_file_close(&file);
836 result = 0;
837 }
838 else
839 {
840 rt_set_errno(result);
841 result = -1;
842 }
843
844 dfs_file_deinit(&file);
845
846 return result;
847}
848RTM_EXPORT(mkdir);
849
850#ifdef RT_USING_FINSH

Callers 5

dfs_mnt_insertFunction · 0.70
copydirFunction · 0.70
copyFunction · 0.70
dfs_devfs_mkdirFunction · 0.50
dfs_mqueue_initFunction · 0.50

Calls 6

rt_set_errnoFunction · 0.85
dfs_file_lstatFunction · 0.85
dfs_file_initFunction · 0.85
dfs_file_deinitFunction · 0.85
dfs_file_openFunction · 0.70
dfs_file_closeFunction · 0.70

Tested by

no test coverage detected