Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FileSystemInit.c
00001 /******************************************************************************* 00002 * Copyright 2016, 2017 ARM Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 *******************************************************************************/ 00016 #include "pal.h" 00017 #include <errno.h> 00018 #include <sys/stat.h> 00019 #include <sys/types.h> 00020 #include <stdio.h> 00021 00022 bool FileSystemInit = true; 00023 00024 // Desktop Linux 00025 // In order for tests to pass for all partition configurations we need to simulate the case of multiple 00026 // partitions using a single folder. We do this by creating one or two different sub-folders, depending on 00027 // the configuration. 00028 int fileSystemCreateRootFolders(void) 00029 { 00030 int status = 0; 00031 char folder[PAL_MAX_FILE_AND_FOLDER_LENGTH] = {0}; 00032 00033 // Get default mount point. 00034 status = pal_fsGetMountPoint(PAL_FS_PARTITION_PRIMARY, PAL_MAX_FILE_AND_FOLDER_LENGTH, folder); 00035 if(status != 0) 00036 { 00037 return 1; 00038 } 00039 printf("Mount point for primary partition: %s\r\n",folder); 00040 // Make the sub-folder 00041 int res = mkdir(folder,0744); 00042 if(res) 00043 { 00044 // Ignore error if it exists 00045 if( errno != EEXIST) 00046 { 00047 printf("mkdir failed errno= %d\r\n",errno); 00048 return 1; 00049 } 00050 } 00051 00052 // Get default mount point. 00053 memset(folder,0,sizeof(folder)); 00054 status = pal_fsGetMountPoint(PAL_FS_PARTITION_SECONDARY, PAL_MAX_FILE_AND_FOLDER_LENGTH, folder); 00055 printf("Mount point for secondary partition: %s\r\n",folder); 00056 if(status != 0) 00057 { 00058 return 1; 00059 } 00060 00061 // Make the sub-folder 00062 res = mkdir(folder,0744); 00063 if(res) 00064 { 00065 // Ignore error if it exists 00066 if( errno != EEXIST) 00067 { 00068 printf("mkdir failed errno= %d\r\n",errno); 00069 return 1; 00070 } 00071 } 00072 return status; 00073 }
Generated on Tue Jul 12 2022 19:01:34 by
1.7.2