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

Function dfs_file_access

components/dfs/dfs_v2/src/dfs_file.c:2431–2451  ·  view source on GitHub ↗

* @brief Check file accessibility with specified mode * * This function checks whether the file specified by path can be accessed * with the given mode. * * @param[in] path The file path to check accessibility * @param[in] mode The access mode to check (read/write/execute permissions) * * @return int Access status: * - 0 if file is accessible with specified mode * - -1 if

Source from the content-addressed store, hash-verified

2429 * - -1 if file is not accessible
2430 */
2431int dfs_file_access(const char *path, mode_t mode)
2432{
2433 int ret;
2434 struct dfs_file file;
2435
2436 dfs_file_init(&file);
2437
2438 if (dfs_file_open(&file, path, O_RDONLY, mode) >= 0)
2439 {
2440 ret = 0;
2441 dfs_file_close(&file);
2442 }
2443 else
2444 {
2445 ret = -1;
2446 }
2447
2448 dfs_file_deinit(&file);
2449
2450 return ret;
2451}
2452
2453#ifdef RT_USING_SMART
2454/**

Callers 1

dfs_file_symlinkFunction · 0.85

Calls 4

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