MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ISC_analyze_nfs

Function ISC_analyze_nfs

src/common/isc_file.cpp:214–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213#ifndef NO_NFS
214bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name)
215{
216/**************************************
217 *
218 * I S C _ a n a l y z e _ n f s
219 *
220 **************************************
221 *
222 * Functional description
223 * Check a file name for an NFS mount point. If so,
224 * decompose into node name and remote file name.
225 *
226 **************************************/
227
228 // If we are ignoring NFS remote mounts then do not bother checking here
229 // and pretend it's only local. MOD 16-Nov-2002
230
231 if (Config::getRemoteFileOpenAbility())
232 return false;
233
234#ifdef LINUX
235 // In order to avoid analyzing mtab in most cases check for non-device mounts first
236 struct stat fileStat;
237 unsigned m = 1; // use something that is known to be not non-device major
238
239 if (os_utils::stat(expanded_filename.c_str(), &fileStat) == 0)
240 m = major(fileStat.st_dev);
241 else // stat error - let's try with path component
242 {
243 tstring path, name;
244 PathUtils::splitLastComponent(path, name, expanded_filename);
245
246 if (path.hasData() && os_utils::stat(path.c_str(), &fileStat) == 0)
247 m = major(fileStat.st_dev);
248 }
249
250 if (m != 0 && m != 144 && m != 145 && m != 146)
251 {
252 // device mount or stat for file/path is impossible - definitely not NFS
253 return false;
254 }
255
256 // proceed with deeper analysis
257#endif
258
259 tstring max_node, max_path;
260 size_t len = 0;
261
262 // Search mount points
263 Mnt mount;
264 if (!mount.ok())
265 {
266 return false;
267 }
268
269 while (mount.get())
270 {
271 tstring node, path;

Callers 3

analyzeFunction · 0.85
ISC_extract_hostFunction · 0.85
expand_filename2Function · 0.85

Calls 12

get_serverFunction · 0.85
statClass · 0.70
ISC_expand_filenameFunction · 0.70
c_strMethod · 0.45
hasDataMethod · 0.45
okMethod · 0.45
getMethod · 0.45
findMethod · 0.45
substrMethod · 0.45
lengthMethod · 0.45
compareMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected