Lines Matching refs:bch
2 * drivers/bch/bchdev_driver.c
35 #include "bch.h"
87 struct bchlib_s *bch;
90 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
94 bchlib_semtake(bch);
95 if (bch->refs == MAX_OPENCNT)
101 bch->refs++;
104 bchlib_semgive(bch);
118 struct bchlib_s *bch;
121 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
125 bchlib_semtake(bch);
126 (void)bchlib_flushsector(bch);
133 if (bch->refs == 0)
139 bch->refs--;
145 if (bch->refs == 0 && bch->unlinked)
149 ret = bchlib_teardown((void *)bch);
166 bchlib_semgive(bch);
177 struct bchlib_s *bch;
181 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
182 bchlib_semtake(bch);
197 newpos = (loff_t)bch->sectsize * bch->nsectors + offset;
203 bchlib_semgive(bch);
230 bchlib_semgive(bch);
241 struct bchlib_s *bch;
244 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
246 bchlib_semtake(bch);
247 ret = bchlib_read(bch, buffer, filep->f_pos, len);
253 bchlib_semgive(bch);
264 struct bchlib_s *bch;
267 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
269 if (!bch->readonly)
271 bchlib_semtake(bch);
272 ret = bchlib_write(bch, buffer, filep->f_pos, len);
278 bchlib_semgive(bch);
295 struct bchlib_s *bch;
299 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
312 bchlib_semtake(bch);
313 if (!bchr || bch->refs == MAX_OPENCNT)
319 bch->refs++;
320 ret = LOS_CopyFromKernel(bchr, sizeof(char *), &bch, sizeof(char *));
331 bchlib_semgive(bch);
341 los_disk *disk = bch->disk;
358 ret = bop->ioctl(bch->vnode, cmd, arg);
383 struct bchlib_s *bch;
386 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv;
390 bchlib_semtake(bch);
394 bch->unlinked = true;
400 if (bch->refs == 0)
404 ret = bchlib_teardown((void *)bch);
420 bchlib_semgive(bch);