MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / open

Method open

libraries/AP_Filesystem/AP_Filesystem.cpp:127–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127int AP_Filesystem::open(const char *fname, int flags, bool allow_absolute_paths)
128{
129 const Backend &backend = backend_by_path(fname);
130 int fd = backend.fs.open(fname, flags, allow_absolute_paths);
131 if (fd < 0) {
132 return -1;
133 }
134 if (uint32_t(fd) >= MAX_FD_PER_BACKEND) {
135 backend.fs.close(fd);
136 errno = ERANGE;
137 return -1;
138 }
139 // offset fd so we can recognise the backend
140 const uint8_t idx = (&backend - &backends[0]);
141 fd += idx * MAX_FD_PER_BACKEND;
142 return fd;
143}
144
145int AP_Filesystem::close(int fd)
146{

Callers 4

apfs_fopenFunction · 0.45
apfs_freopenFunction · 0.45
write_fileFunction · 0.45
read_fileFunction · 0.45

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected