* This function will return whether this file has been opend. * * @param pathname the file path name. * * @return 0 on file has been open successfully, -1 on open failed. */
| 153 | * @return 0 on file has been open successfully, -1 on open failed. |
| 154 | */ |
| 155 | int dfs_file_is_open(const char *pathname) |
| 156 | { |
| 157 | char *fullpath = NULL; |
| 158 | struct dfs_vnode *vnode = NULL; |
| 159 | int ret = 0; |
| 160 | |
| 161 | fullpath = dfs_normalize_path(NULL, pathname); |
| 162 | |
| 163 | dfs_fm_lock(); |
| 164 | vnode = dfs_vnode_find(fullpath, NULL); |
| 165 | if (vnode) |
| 166 | { |
| 167 | ret = 1; |
| 168 | } |
| 169 | dfs_fm_unlock(); |
| 170 | |
| 171 | rt_free(fullpath); |
| 172 | return ret; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | /** |
no test coverage detected