Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 36) 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 …]
/bootable/recovery/minui/
Devents.cpp45 android::base::unique_fd fd; member
80 android::base::unique_fd fd(openat(dirfd(dir.get()), de->d_name, O_RDONLY | O_CLOEXEC)); in ev_init() local
81 if (fd == -1) continue; in ev_init()
87 if (ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in ev_init()
102 if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) { in ev_init()
107 ev_fdinfo[g_ev_count].fd.reset(fd.release()); in ev_init()
126 int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb) { in ev_add_fd() argument
134 int ret = epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, fd, &ev); in ev_add_fd()
136 ev_fdinfo[g_ev_count].fd.reset(fd.release()); in ev_add_fd()
147 ev_fdinfo[--g_ev_count].fd.reset(); in ev_exit()
[all …]
Dgraphics_drm.cpp168 static drmModeCrtc* find_crtc_for_connector(int fd, drmModeRes* resources, in find_crtc_for_connector() argument
173 encoder = drmModeGetEncoder(fd, connector->encoder_id); in find_crtc_for_connector()
182 return drmModeGetCrtc(fd, crtc); in find_crtc_for_connector()
188 encoder = drmModeGetEncoder(fd, connector->encoders[i]); in find_crtc_for_connector()
198 return drmModeGetCrtc(fd, crtc); in find_crtc_for_connector()
206 static drmModeConnector* find_used_connector_by_type(int fd, drmModeRes* resources, unsigned type) { in find_used_connector_by_type() argument
208 drmModeConnector* connector = drmModeGetConnector(fd, resources->connectors[i]); in find_used_connector_by_type()
220 static drmModeConnector* find_first_connected_connector(int fd, drmModeRes* resources) { in find_first_connected_connector() argument
224 connector = drmModeGetConnector(fd, resources->connectors[i]); in find_first_connected_connector()
235 drmModeConnector* MinuiBackendDrm::FindMainMonitor(int fd, drmModeRes* resources, in FindMainMonitor() argument
[all …]
Dgraphics_adf.h45 __u32 pitch, int fd) in GRSurfaceAdf() argument
46 : GRSurface(width, height, row_bytes, pixel_bytes), offset(offset), pitch(pitch), fd(fd) {} in GRSurfaceAdf()
51 int fd; variable
Dgraphics_adf.cpp39 if (fd != -1) { in ~GRSurfaceAdf()
40 close(fd); in ~GRSurfaceAdf()
48 auto fd = adf_interface_simple_buffer_alloc(intf_fd, mode->hdisplay, mode->vdisplay, format, in Create() local
51 if (fd < 0) { in Create()
52 *err = fd; in Create()
58 offset, pitch, fd)); in Create()
61 mmap(nullptr, surf->pitch * surf->height, PROT_WRITE, MAP_SHARED, surf->fd, surf->offset); in Create()
185 surf->fd, surf->offset, surf->pitch, -1); in Flip()
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 …]
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()
Dminadbd_services.cpp67 static bool WriteCommandToFd(MinadbdCommand cmd, int fd) { in WriteCommandToFd() argument
72 if (!android::base::WriteFully(fd, message, kMinadbdMessageSize)) { in WriteCommandToFd()
81 static bool WaitForCommandStatus(int fd, MinadbdCommandStatus* status) { in WaitForCommandStatus() argument
83 if (!android::base::ReadFully(fd, buffer, kMinadbdMessageSize)) { in WaitForCommandStatus()
211 static void WipeDeviceService(unique_fd fd, const std::string& args) { in WipeDeviceService() argument
234 if (!android::base::WriteFully(fd, response.c_str(), response.size())) { in WipeDeviceService()
/bootable/recovery/otautil/
Dsysutil.cpp100 bool MemMapping::MapFD(int fd) { in MapFD() argument
102 if (fstat(fd, &sb) == -1) { in MapFD()
103 PLOG(ERROR) << "fstat(" << fd << ") failed"; in MapFD()
107 void* memPtr = mmap(nullptr, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); in MapFD()
109 PLOG(ERROR) << "mmap(" << sb.st_size << ", R, PRIVATE, " << fd << ", 0) failed"; in MapFD()
141 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(block_map_data.path().c_str(), O_RDONLY))); in MapBlockFile() local
142 if (fd == -1) { in MapBlockFile()
154 void* range_start = mmap(next, range_size, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, in MapBlockFile()
194 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY))); in MapFile() local
195 if (fd == -1) { in MapFile()
[all …]
Droots.cpp109 static int64_t get_file_size(int fd, uint64_t reserve_len) { in get_file_size() argument
111 int ret = fstat(fd, &buf); in get_file_size()
118 uint64_t block_device_size = get_block_device_size(fd); in get_file_size()
159 int fd = open(v->key_loc.c_str(), O_WRONLY | O_CREAT, 0644); in format_volume() local
160 if (fd == -1) { in format_volume()
164 wipe_block_device(fd, get_file_size(fd)); in format_volume()
165 close(fd); in format_volume()
172 android::base::unique_fd fd(open(v->blk_device.c_str(), O_RDONLY)); in format_volume() local
173 if (fd == -1) { in format_volume()
177 length = get_file_size(fd.get(), v->length ? -v->length : CRYPT_FOOTER_OFFSET); in format_volume()
/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/bootloader_message/
Dbootloader_message.cpp90 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_RDONLY)); in read_misc_partition() local
91 if (fd == -1) { in read_misc_partition()
96 if (lseek(fd, static_cast<off_t>(offset), SEEK_SET) != static_cast<off_t>(offset)) { in read_misc_partition()
101 if (!android::base::ReadFully(fd, p, size)) { in read_misc_partition()
111 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_WRONLY)); in write_misc_partition() local
112 if (fd == -1) { in write_misc_partition()
117 if (lseek(fd, static_cast<off_t>(offset), SEEK_SET) != static_cast<off_t>(offset)) { in write_misc_partition()
122 if (!android::base::WriteFully(fd, p, size)) { in write_misc_partition()
127 if (fsync(fd) == -1) { in write_misc_partition()
/bootable/recovery/updater/
Dblockimg.cpp90 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(last_command_file.c_str(), O_RDONLY))); in ParseLastCommandFile() local
91 if (fd == -1) { in ParseLastCommandFile()
103 if (!android::base::ReadFdToString(fd.get(), &content)) { in ParseLastCommandFile()
190 static bool discard_blocks(int fd, off64_t offset, uint64_t size, bool force = false) { in discard_blocks() argument
197 if (ioctl(fd, BLKDISCARD, &args) == -1) { in discard_blocks()
208 static bool check_lseek(int fd, off64_t offset, int whence) { in check_lseek() argument
209 off64_t rc = TEMP_FAILURE_RETRY(lseek64(fd, offset, whence)); in check_lseek()
230 RangeSinkWriter(int fd, const RangeSet& tgt) in RangeSinkWriter() argument
231 : fd_(fd), in RangeSinkWriter()
477 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
[all …]
Dupdater.cpp84 int fd = atoi(argv[2]); in main() local
85 FILE* cmd_pipe = fdopen(fd, "wb"); in main()
/bootable/recovery/tests/unit/
Dzip_test.cpp46 ASSERT_NE(-1, tmp_binary.fd); in TEST()
47 ASSERT_EQ(0, ExtractEntryToFile(handle, &binary_entry, tmp_binary.fd)); in TEST()
/bootable/recovery/install/
Dpackage.cpp80 FilePackage(android::base::unique_fd&& fd, uint64_t file_size, const std::string& path,
117 android::base::unique_fd fd(open(path.c_str(), O_RDONLY)); in CreateFilePackage() local
118 if (fd == -1) { in CreateFilePackage()
123 off64_t file_size = lseek64(fd.get(), 0, SEEK_END); in CreateFilePackage()
129 return std::make_unique<FilePackage>(std::move(fd), file_size, path, set_progress); in CreateFilePackage()
199 FilePackage::FilePackage(android::base::unique_fd&& fd, uint64_t file_size, const std::string& path, in FilePackage() argument
201 : fd_(std::move(fd)), package_size_(file_size), path_(path), zip_handle_(nullptr) { in FilePackage()
/bootable/recovery/boot_control/
Dboot_control.cpp95 android::base::unique_fd fd(open(misc_device, O_RDONLY)); in LoadBootloaderControl() local
96 if (fd.get() == -1) { in LoadBootloaderControl()
100 if (lseek(fd, kBootloaderControlOffset, SEEK_SET) != kBootloaderControlOffset) { in LoadBootloaderControl()
104 if (!android::base::ReadFully(fd.get(), buffer, sizeof(bootloader_control))) { in LoadBootloaderControl()
113 android::base::unique_fd fd(open(misc_device, O_WRONLY | O_SYNC)); in UpdateAndSaveBootloaderControl() local
114 if (fd.get() == -1) { in UpdateAndSaveBootloaderControl()
118 if (lseek(fd.get(), kBootloaderControlOffset, SEEK_SET) != kBootloaderControlOffset) { in UpdateAndSaveBootloaderControl()
122 if (!android::base::WriteFully(fd.get(), buffer, sizeof(bootloader_control))) { in UpdateAndSaveBootloaderControl()
/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/minui/include/minui/
Dminui.h152 using ev_callback = std::function<int(int fd, uint32_t epevents)>;
157 int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb);
168 int ev_get_input(int fd, uint32_t epevents, input_event* ev);
/bootable/recovery/recovery_ui/
Dui.cpp224 int RecoveryUI::OnInputEvent(int fd, uint32_t epevents) { in OnInputEvent() argument
226 if (ev_get_input(fd, epevents, &ev) == -1) { in OnInputEvent()
505 int fd = open("/sys/class/android_usb/android0/state", O_RDONLY); in IsUsbConnected() local
506 if (fd < 0) { in IsUsbConnected()
513 int connected = (TEMP_FAILURE_RETRY(read(fd, &buf, 1)) == 1) && (buf == 'C'); in IsUsbConnected()
514 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()
/bootable/recovery/otautil/include/otautil/
Dsysutil.h99 bool MapFD(int fd);

12