Lines Matching refs:bs

98     struct binder_state *bs;  in binder_open()  local
101 bs = malloc(sizeof(*bs)); in binder_open()
102 if (!bs) { in binder_open()
107 bs->fd = open("/dev/binder", O_RDWR | O_CLOEXEC); in binder_open()
108 if (bs->fd < 0) { in binder_open()
114 if ((ioctl(bs->fd, BINDER_VERSION, &vers) == -1) || in binder_open()
122 bs->mapsize = mapsize; in binder_open()
123 bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd, 0); in binder_open()
124 if (bs->mapped == MAP_FAILED) { in binder_open()
130 return bs; in binder_open()
133 close(bs->fd); in binder_open()
135 free(bs); in binder_open()
139 void binder_close(struct binder_state *bs) in binder_close() argument
141 munmap(bs->mapped, bs->mapsize); in binder_close()
142 close(bs->fd); in binder_close()
143 free(bs); in binder_close()
146 int binder_become_context_manager(struct binder_state *bs) in binder_become_context_manager() argument
148 return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0); in binder_become_context_manager()
151 int binder_write(struct binder_state *bs, void *data, size_t len) in binder_write() argument
162 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_write()
170 void binder_free_buffer(struct binder_state *bs, in binder_free_buffer() argument
179 binder_write(bs, &data, sizeof(data)); in binder_free_buffer()
182 void binder_send_reply(struct binder_state *bs, in binder_send_reply() argument
213 binder_write(bs, &data, sizeof(data)); in binder_send_reply()
216 int binder_parse(struct binder_state *bs, struct binder_io *bio, in binder_parse() argument
257 res = func(bs, txn, &msg, &reply); in binder_parse()
259 binder_free_buffer(bs, txn->data.ptr.buffer); in binder_parse()
261 binder_send_reply(bs, &reply, txn->data.ptr.buffer, res); in binder_parse()
287 death->func(bs, death->ptr); in binder_parse()
305 void binder_acquire(struct binder_state *bs, uint32_t target) in binder_acquire() argument
310 binder_write(bs, cmd, sizeof(cmd)); in binder_acquire()
313 void binder_release(struct binder_state *bs, uint32_t target) in binder_release() argument
318 binder_write(bs, cmd, sizeof(cmd)); in binder_release()
321 void binder_link_to_death(struct binder_state *bs, uint32_t target, struct binder_death *death) in binder_link_to_death() argument
331 binder_write(bs, &data, sizeof(data)); in binder_link_to_death()
334 int binder_call(struct binder_state *bs, in binder_call() argument
370 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_call()
377 res = binder_parse(bs, reply, (uintptr_t) readbuf, bwr.read_consumed, 0); in binder_call()
388 void binder_loop(struct binder_state *bs, binder_handler func) in binder_loop() argument
399 binder_write(bs, readbuf, sizeof(uint32_t)); in binder_loop()
406 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_loop()
413 res = binder_parse(bs, 0, (uintptr_t) readbuf, bwr.read_consumed, func); in binder_loop()
467 void binder_done(struct binder_state *bs, in binder_done() argument
479 binder_write(bs, &data, sizeof(data)); in binder_done()