Lines Matching refs:fd

88     int fd;
91 fd = ::open(filename, O_RDONLY);
92 if (fd < 0) {
96 success = readFrom(fd);
97 close(fd);
100 ALOGW("failed to read from %s (fd=%d)\n", filename, fd);
107 bool ObbFile::readFrom(int fd)
109 if (fd < 0) {
110 ALOGW("attempt to read from invalid fd\n");
114 return parseObbFile(fd);
117 bool ObbFile::parseObbFile(int fd)
119 off64_t fileLength = lseek64(fd, 0, SEEK_END);
134 lseek64(fd, fileLength - kFooterTagSize, SEEK_SET);
137 actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize));
166 if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) {
179 actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, footerSize));
228 int fd;
231 fd = ::open(filename, O_WRONLY);
232 if (fd < 0) {
235 success = writeTo(fd);
236 close(fd);
245 bool ObbFile::writeTo(int fd)
247 if (fd < 0) {
251 lseek64(fd, 0, SEEK_END);
262 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
268 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
274 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
279 if (write(fd, mSalt, sizeof(mSalt)) != (ssize_t)sizeof(mSalt)) {
286 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
291 if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) {
297 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
303 if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) {
313 int fd;
316 fd = ::open(filename, O_RDWR);
317 if (fd < 0) {
320 success = removeFrom(fd);
321 close(fd);
330 bool ObbFile::removeFrom(int fd)
332 if (fd < 0) {
336 if (!readFrom(fd)) {
340 ftruncate(fd, mFooterStart);