Lines Matching refs:bs

97     struct binder_state *bs;  in binder_open()  local
100 bs = malloc(sizeof(*bs)); in binder_open()
101 if (!bs) { in binder_open()
106 bs->fd = open("/dev/binder", O_RDWR); in binder_open()
107 if (bs->fd < 0) { in binder_open()
113 if ((ioctl(bs->fd, BINDER_VERSION, &vers) == -1) || in binder_open()
119 bs->mapsize = mapsize; in binder_open()
120 bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd, 0); in binder_open()
121 if (bs->mapped == MAP_FAILED) { in binder_open()
127 return bs; in binder_open()
130 close(bs->fd); in binder_open()
132 free(bs); in binder_open()
136 void binder_close(struct binder_state *bs) in binder_close() argument
138 munmap(bs->mapped, bs->mapsize); in binder_close()
139 close(bs->fd); in binder_close()
140 free(bs); in binder_close()
143 int binder_become_context_manager(struct binder_state *bs) in binder_become_context_manager() argument
145 return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0); in binder_become_context_manager()
148 int binder_write(struct binder_state *bs, void *data, size_t len) in binder_write() argument
159 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_write()
167 void binder_send_reply(struct binder_state *bs, in binder_send_reply() argument
198 binder_write(bs, &data, sizeof(data)); in binder_send_reply()
201 int binder_parse(struct binder_state *bs, struct binder_io *bio, in binder_parse() argument
242 res = func(bs, txn, &msg, &reply); in binder_parse()
243 binder_send_reply(bs, &reply, txn->data.ptr.buffer, res); in binder_parse()
268 death->func(bs, death->ptr); in binder_parse()
286 void binder_acquire(struct binder_state *bs, uint32_t target) in binder_acquire() argument
291 binder_write(bs, cmd, sizeof(cmd)); in binder_acquire()
294 void binder_release(struct binder_state *bs, uint32_t target) in binder_release() argument
299 binder_write(bs, cmd, sizeof(cmd)); in binder_release()
302 void binder_link_to_death(struct binder_state *bs, uint32_t target, struct binder_death *death) in binder_link_to_death() argument
312 binder_write(bs, &data, sizeof(data)); in binder_link_to_death()
315 int binder_call(struct binder_state *bs, in binder_call() argument
351 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_call()
358 res = binder_parse(bs, reply, (uintptr_t) readbuf, bwr.read_consumed, 0); in binder_call()
369 void binder_loop(struct binder_state *bs, binder_handler func) in binder_loop() argument
380 binder_write(bs, readbuf, sizeof(uint32_t)); in binder_loop()
387 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_loop()
394 res = binder_parse(bs, 0, (uintptr_t) readbuf, bwr.read_consumed, func); in binder_loop()
448 void binder_done(struct binder_state *bs, in binder_done() argument
460 binder_write(bs, &data, sizeof(data)); in binder_done()