Lines Matching refs:bs
96 struct binder_state *bs; in binder_open() local
98 bs = malloc(sizeof(*bs)); in binder_open()
99 if (!bs) { in binder_open()
104 bs->fd = open("/dev/binder", O_RDWR); in binder_open()
105 if (bs->fd < 0) { in binder_open()
111 bs->mapsize = mapsize; in binder_open()
112 bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd, 0); in binder_open()
113 if (bs->mapped == MAP_FAILED) { in binder_open()
121 return bs; in binder_open()
124 close(bs->fd); in binder_open()
126 free(bs); in binder_open()
130 void binder_close(struct binder_state *bs) in binder_close() argument
132 munmap(bs->mapped, bs->mapsize); in binder_close()
133 close(bs->fd); in binder_close()
134 free(bs); in binder_close()
137 int binder_become_context_manager(struct binder_state *bs) in binder_become_context_manager() argument
139 return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0); in binder_become_context_manager()
142 int binder_write(struct binder_state *bs, void *data, unsigned len) in binder_write() argument
152 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_write()
160 void binder_send_reply(struct binder_state *bs, in binder_send_reply() argument
191 binder_write(bs, &data, sizeof(data)); in binder_send_reply()
194 int binder_parse(struct binder_state *bs, struct binder_io *bio, in binder_parse() argument
234 res = func(bs, txn, &msg, &reply); in binder_parse()
235 binder_send_reply(bs, &reply, txn->data, res); in binder_parse()
259 death->func(bs, death->ptr); in binder_parse()
277 void binder_acquire(struct binder_state *bs, void *ptr) in binder_acquire() argument
282 binder_write(bs, cmd, sizeof(cmd)); in binder_acquire()
285 void binder_release(struct binder_state *bs, void *ptr) in binder_release() argument
290 binder_write(bs, cmd, sizeof(cmd)); in binder_release()
293 void binder_link_to_death(struct binder_state *bs, void *ptr, struct binder_death *death) in binder_link_to_death() argument
299 binder_write(bs, cmd, sizeof(cmd)); in binder_link_to_death()
303 int binder_call(struct binder_state *bs, in binder_call() argument
339 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_call()
346 res = binder_parse(bs, reply, readbuf, bwr.read_consumed, 0); in binder_call()
357 void binder_loop(struct binder_state *bs, binder_handler func) in binder_loop() argument
368 binder_write(bs, readbuf, sizeof(unsigned)); in binder_loop()
375 res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); in binder_loop()
382 res = binder_parse(bs, 0, readbuf, bwr.read_consumed, func); in binder_loop()
436 void binder_done(struct binder_state *bs, in binder_done() argument
444 binder_write(bs, cmd, sizeof(cmd)); in binder_done()