Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 41) sorted by relevance

12

/bootable/recovery/fuse_sideload/
Dfuse_sideload.cpp98 static void fuse_reply(const fuse_data* fd, uint64_t unique, const void* data, size_t len) { in fuse_reply() argument
110 int res = writev(fd->ffd, vec, 2); in fuse_reply()
116 static int handle_init(void* data, fuse_data* fd, const fuse_in_header* hdr) { in handle_init() argument
147 fuse_reply(fd, hdr->unique, &out, fuse_struct_size); in handle_init()
152 static void fill_attr(fuse_attr* attr, const fuse_data* fd, uint64_t nodeid, uint64_t size, in fill_attr() argument
156 attr->uid = fd->uid; in fill_attr()
157 attr->gid = fd->gid; in fill_attr()
166 static int handle_getattr(void* /* data */, const fuse_data* fd, const fuse_in_header* hdr) { in handle_getattr() argument
171 fill_attr(&(out.attr), fd, hdr->nodeid, 4096, S_IFDIR | 0555); in handle_getattr()
173 fill_attr(&(out.attr), fd, PACKAGE_FILE_ID, fd->file_size, S_IFREG | 0444); in handle_getattr()
[all …]
Dfuse_provider.cpp82 android::base::unique_fd&& fd, in FuseBlockDataProvider() argument
85 fd_(std::move(fd)), in FuseBlockDataProvider()
142 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(block_map.path().c_str(), O_RDONLY))); in CreateFromBlockMap() local
143 if (fd == -1) { in CreateFromBlockMap()
149 new FuseBlockDataProvider(block_map.file_size(), fuse_block_size, std::move(fd), in CreateFromBlockMap()
/bootable/recovery/minui/
Devents.cpp48 android::base::unique_fd fd; member
68 static bool should_add_input_device(int fd, bool allow_touch_inputs) { in should_add_input_device() argument
73 if (ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in should_add_input_device()
88 static int inotify_cb(int fd, __unused uint32_t epevents) { in inotify_cb() argument
94 int ret = ioctl(fd, FIONREAD, &event_len_int); in inotify_cb()
106 ssize_t r = TEMP_FAILURE_RETRY(read(fd, buf.data(), event_len)); in inotify_cb()
168 android::base::unique_fd fd(openat(dirfd(dir.get()), de->d_name, O_RDONLY | O_CLOEXEC)); in ev_init() local
169 if (fd == -1) continue; in ev_init()
171 if (!should_add_input_device(fd, allow_touch_inputs)) { in ev_init()
178 if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) { in ev_init()
[all …]
Dgraphics_drm.cpp172 static drmModeCrtc* find_crtc_for_connector(int fd, drmModeRes* resources, in find_crtc_for_connector() argument
177 encoder = drmModeGetEncoder(fd, connector->encoder_id); in find_crtc_for_connector()
186 return drmModeGetCrtc(fd, crtc); in find_crtc_for_connector()
192 encoder = drmModeGetEncoder(fd, connector->encoders[i]); in find_crtc_for_connector()
202 return drmModeGetCrtc(fd, crtc); in find_crtc_for_connector()
210 static drmModeConnector* find_used_connector_by_type(int fd, drmModeRes* resources, unsigned type) { in find_used_connector_by_type() argument
212 drmModeConnector* connector = drmModeGetConnector(fd, resources->connectors[i]); in find_used_connector_by_type()
224 static drmModeConnector* find_first_connected_connector(int fd, drmModeRes* resources) { in find_first_connected_connector() argument
228 connector = drmModeGetConnector(fd, resources->connectors[i]); in find_first_connected_connector()
239 drmModeConnector* MinuiBackendDrm::FindMainMonitor(int fd, drmModeRes* resources, in FindMainMonitor() argument
[all …]
Dgraphics_fbdev.cpp59 android::base::unique_fd fd(open("/dev/graphics/fb0", O_RDWR | O_CLOEXEC)); in Init() local
60 if (fd == -1) { in Init()
66 if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) { in Init()
71 if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) { in Init()
96 void* bits = mmap(0, fi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in Init()
130 fb_fd = std::move(fd); in Init()
Dgraphics_drm.h66 void DisableNonMainCrtcs(int fd, drmModeRes* resources, drmModeCrtc* main_crtc);
67 drmModeConnector* FindMainMonitor(int fd, drmModeRes* resources, uint32_t* mode_index);
/bootable/recovery/minadbd/
Dminadbd_services_test.cpp65 void ReadAndCheckCommandMessage(int fd, MinadbdCommand expected_command) { in ReadAndCheckCommandMessage() argument
67 ASSERT_TRUE(android::base::ReadFully(fd, received.data(), kMinadbdMessageSize)); in ReadAndCheckCommandMessage()
110 unique_fd fd = daemon_service_to_fd(command, nullptr); in ExecuteCommandAndWaitForExit() local
111 ASSERT_NE(-1, fd); in ExecuteCommandAndWaitForExit()
147 unique_fd fd = daemon_service_to_fd(command, nullptr); in TEST_F() local
148 ASSERT_NE(-1, fd); in TEST_F()
170 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(package_path_.c_str(), O_RDONLY))); in TEST_F() local
173 if (fd == -1) { in TEST_F()
178 if (!android::base::ReadFully(fd, content_from_fuse.data(), 4096)) { in TEST_F()
189 unique_fd fd = daemon_service_to_fd("sideload-host:4096:4096", nullptr); in TEST_F() local
[all …]
Dminadbd_services.cpp68 static bool WriteCommandToFd(MinadbdCommand cmd, int fd) { in WriteCommandToFd() argument
73 if (!android::base::WriteFully(fd, message, kMinadbdMessageSize)) { in WriteCommandToFd()
82 static bool WaitForCommandStatus(int fd, MinadbdCommandStatus* status) { in WaitForCommandStatus() argument
84 if (!android::base::ReadFully(fd, buffer, kMinadbdMessageSize)) { in WaitForCommandStatus()
146 static bool WaitForSocketClose(int fd, std::chrono::milliseconds timeout) { in WaitForSocketClose() argument
153 struct pollfd pfd = { .fd = fd, .events = 0 }; in WaitForSocketClose()
280 static void WipeDeviceService(unique_fd fd, const std::string& args) { in WipeDeviceService() argument
303 if (!android::base::WriteFully(fd, response.c_str(), response.size())) { in WipeDeviceService()
Dfuse_adb_provider.h26 FuseAdbDataProvider(int fd, uint64_t file_size, uint32_t block_size) in FuseAdbDataProvider() argument
27 : FuseDataProvider(file_size, block_size), fd_(fd) {} in FuseAdbDataProvider()
/bootable/recovery/otautil/
Dsysutil.cpp105 bool MemMapping::MapFD(int fd) { in MapFD() argument
107 if (fstat(fd, &sb) == -1) { in MapFD()
108 PLOG(ERROR) << "fstat(" << fd << ") failed"; in MapFD()
112 void* memPtr = mmap(nullptr, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); in MapFD()
114 PLOG(ERROR) << "mmap(" << sb.st_size << ", R, PRIVATE, " << fd << ", 0) failed"; in MapFD()
146 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(block_map_data.path().c_str(), O_RDONLY))); in MapBlockFile() local
147 if (fd == -1) { in MapBlockFile()
159 void* range_start = mmap(next, range_size, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, in MapBlockFile()
199 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY))); in MapFile() local
200 if (fd == -1) { in MapFile()
[all …]
/bootable/recovery/applypatch/
Dapplypatch.cpp110 android::base::unique_fd fd( in SaveFileContents() local
112 if (fd == -1) { in SaveFileContents()
117 if (!android::base::WriteFully(fd, file->data.data(), file->data.size())) { in SaveFileContents()
122 if (fsync(fd) != 0) { in SaveFileContents()
127 if (close(fd.release()) != 0) { in SaveFileContents()
142 android::base::unique_fd fd(open(partition.name.c_str(), O_RDWR)); in WriteBufferToPartition() local
143 if (fd == -1) { in WriteBufferToPartition()
148 if (TEMP_FAILURE_RETRY(lseek(fd, start, SEEK_SET)) == -1) { in WriteBufferToPartition()
153 if (!android::base::WriteFully(fd, data + start, len - start)) { in WriteBufferToPartition()
158 if (fsync(fd) != 0) { in WriteBufferToPartition()
[all …]
Dimgdiff.cpp185 static inline bool Write8(int fd, int64_t value) { in Write8() argument
186 return android::base::WriteFully(fd, &value, sizeof(int64_t)); in Write8()
191 static inline bool Write4(int fd, int32_t value) { in Write4() argument
192 return android::base::WriteFully(fd, &value, sizeof(int32_t)); in Write4()
341 int fd = mkstemp(ptemp); in MakePatch() local
342 if (fd == -1) { in MakePatch()
346 close(fd); in MakePatch()
499 size_t PatchChunk::WriteHeaderToFd(int fd, size_t offset, size_t index) const { in WriteHeaderToFd() argument
500 Write4(fd, type_); in WriteHeaderToFd()
505 Write8(fd, static_cast<int64_t>(source_start_)); in WriteHeaderToFd()
[all …]
/bootable/recovery/recovery_utils/
Droots.cpp110 static int64_t get_file_size(int fd, uint64_t reserve_len) { in get_file_size() argument
112 int ret = fstat(fd, &buf); in get_file_size()
119 uint64_t block_device_size = get_block_device_size(fd); in get_file_size()
168 int fd = open(v->key_loc.c_str(), O_WRONLY | O_CREAT, 0644); in format_volume() local
169 if (fd == -1) { in format_volume()
173 wipe_block_device(fd, get_file_size(fd)); in format_volume()
174 close(fd); in format_volume()
181 android::base::unique_fd fd(open(v->blk_device.c_str(), O_RDONLY)); in format_volume() local
182 if (fd == -1) { in format_volume()
186 length = get_file_size(fd.get(), v->length ? -v->length : CRYPT_FOOTER_OFFSET); in format_volume()
/bootable/recovery/install/
Dwipe_device.cpp96 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(partition.c_str(), O_WRONLY))); in SecureWipePartition() local
97 if (fd == -1) { in SecureWipePartition()
103 if (ioctl(fd, BLKGETSIZE64, &range[1]) == -1 || range[1] == 0) { in SecureWipePartition()
110 if (ioctl(fd, BLKSECDISCARD, &range) == -1) { in SecureWipePartition()
115 if (ioctl(fd, BLKDISCARDZEROES, &zeroes) == 0 && zeroes != 0) { in SecureWipePartition()
117 if (ioctl(fd, BLKDISCARD, &range) == -1) { in SecureWipePartition()
123 if (ioctl(fd, BLKZEROOUT, &range) == -1) { in SecureWipePartition()
Dpackage.cpp88 FilePackage(android::base::unique_fd&& fd, uint64_t file_size, const std::string& path,
133 android::base::unique_fd fd(open(path.c_str(), O_RDONLY)); in CreateFilePackage() local
134 if (fd == -1) { in CreateFilePackage()
139 off64_t file_size = lseek64(fd.get(), 0, SEEK_END); in CreateFilePackage()
145 return std::make_unique<FilePackage>(std::move(fd), file_size, path, set_progress); in CreateFilePackage()
215 FilePackage::FilePackage(android::base::unique_fd&& fd, uint64_t file_size, const std::string& path, in FilePackage() argument
217 : fd_(std::move(fd)), package_size_(file_size), path_(path), zip_handle_(nullptr) { in FilePackage()
/bootable/recovery/updater/
Dblockimg.cpp95 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(last_command_file.c_str(), O_RDONLY))); in ParseLastCommandFile() local
96 if (fd == -1) { in ParseLastCommandFile()
108 if (!android::base::ReadFdToString(fd.get(), &content)) { in ParseLastCommandFile()
195 static bool discard_blocks(int fd, off64_t offset, uint64_t size, bool force = false) { in discard_blocks() argument
202 if (ioctl(fd, BLKDISCARD, &args) == -1) { in discard_blocks()
213 static bool check_lseek(int fd, off64_t offset, int whence) { in check_lseek() argument
214 off64_t rc = TEMP_FAILURE_RETRY(lseek64(fd, offset, whence)); in check_lseek()
235 RangeSinkWriter(int fd, const RangeSet& tgt) in RangeSinkWriter() argument
236 : fd_(fd), in RangeSinkWriter()
482 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
[all …]
Dupdater_main.cpp78 int fd; in main() local
79 if (!android::base::ParseInt(argv[2], &fd)) { in main()
107 if (!updater.Init(fd, package_name, is_retry)) { in main()
Dupdater_runtime.cpp147 android::base::unique_fd fd(open(std::string(filename).c_str(), O_WRONLY)); in WipeBlockDevice() local
148 if (fd == -1) { in WipeBlockDevice()
153 return wipe_block_device(fd, len); in WipeBlockDevice()
Dtarget_files.cpp173 if (auto status = ExtractEntryToFile(handle_, &entry, temp_file->fd); status != 0) { in ExtractEntryToTempFile()
257 if (!SimgToImg(sparse_image.fd, image_file->fd)) { in ExtractImage()
/bootable/recovery/bootloader_message/
Dbootloader_message.cpp95 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_RDONLY)); in read_misc_partition() local
96 if (fd == -1) { in read_misc_partition()
101 if (lseek(fd, static_cast<off_t>(offset), SEEK_SET) != static_cast<off_t>(offset)) { in read_misc_partition()
106 if (!android::base::ReadFully(fd, p, size)) { in read_misc_partition()
116 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_WRONLY)); in write_misc_partition() local
117 if (fd == -1) { in write_misc_partition()
122 if (lseek(fd, static_cast<off_t>(offset), SEEK_SET) != static_cast<off_t>(offset)) { in write_misc_partition()
127 if (!android::base::WriteFully(fd, p, size)) { in write_misc_partition()
132 if (fsync(fd) == -1) { in write_misc_partition()
/bootable/recovery/uncrypt/
Duncrypt.cpp223 static int RetryFibmap(int fd, const std::string& name, int* block, const int head_block) { in RetryFibmap() argument
226 if (fsync(fd) == -1) { in RetryFibmap()
230 if (ioctl(fd, FIBMAP, block) != 0) { in RetryFibmap()
291 android::base::unique_fd fd(open(path.c_str(), O_RDWR)); in ProductBlockMap() local
292 if (fd == -1) { in ProductBlockMap()
324 int error = ioctl(fd, F2FS_IOC_SET_PIN_FILE, &set); in ProductBlockMap()
345 if (ioctl(fd, FIBMAP, &block) != 0) { in ProductBlockMap()
352 int error = RetryFibmap(fd, path, &block, head_block); in ProductBlockMap()
373 if (!android::base::ReadFully(fd, buffers[tail].data(), to_read)) { in ProductBlockMap()
390 if (ioctl(fd, FIBMAP, &block) != 0) { in ProductBlockMap()
[all …]
/bootable/recovery/tests/unit/
Dzip_test.cpp45 ASSERT_NE(-1, tmp_binary.fd); in TEST()
46 ASSERT_EQ(0, ExtractEntryToFile(handle, &binary_entry, tmp_binary.fd)); in TEST()
/bootable/recovery/minui/include/minui/
Dminui.h153 using ev_callback = std::function<int(int fd, uint32_t epevents)>;
158 int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb);
169 int ev_get_input(int fd, uint32_t epevents, input_event* ev);
/bootable/recovery/recovery_ui/
Dui.cpp236 int RecoveryUI::OnInputEvent(int fd, uint32_t epevents) { in OnInputEvent() argument
238 if (ev_get_input(fd, epevents, &ev) == -1) { in OnInputEvent()
514 int fd = open("/sys/class/android_usb/android0/state", O_RDONLY); in IsUsbConnected() local
515 if (fd < 0) { in IsUsbConnected()
522 int connected = (TEMP_FAILURE_RETRY(read(fd, &buf, 1)) == 1) && (buf == 'C'); in IsUsbConnected()
523 if (close(fd) < 0) { in IsUsbConnected()
/bootable/recovery/update_verifier/
Dupdate_verifier.cpp148 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(dm_block_device.c_str(), O_RDONLY))); in ReadBlocks() local
149 if (fd.get() == -1) { in ReadBlocks()
159 if (lseek64(fd.get(), static_cast<off64_t>(range_start) * kBlockSize, SEEK_SET) == -1) { in ReadBlocks()
167 if (!android::base::ReadFully(fd.get(), buf.data(), to_read)) { in ReadBlocks()

12