Home
last modified time | relevance | path

Searched refs:bch (Results 1 - 9 of 9) sorted by relevance

/third_party/NuttX/drivers/bch/
H A Dbchdev_driver.c2 * drivers/bch/bchdev_driver.c
35 #include "bch.h"
87 struct bchlib_s *bch; in bch_open() local
90 bch = (struct bchlib_s *)((struct drv_data *)vnode->data)->priv; in bch_open()
94 bchlib_semtake(bch); in bch_open()
95 if (bch->refs == MAX_OPENCNT) in bch_open()
101 bch->refs++; in bch_open()
104 bchlib_semgive(bch); in bch_open()
118 struct bchlib_s *bch; in bch_close() local
121 bch in bch_close()
177 struct bchlib_s *bch; bch_seek() local
241 struct bchlib_s *bch; bch_read() local
264 struct bchlib_s *bch; bch_write() local
295 struct bchlib_s *bch; bch_ioctl() local
383 struct bchlib_s *bch; bch_unlink() local
[all...]
H A Dbchlib_setup.c2 * drivers/bch/bchlib_setup.c
32 #include "bch.h"
49 struct bchlib_s *bch; in bchlib_setup() local
58 bch = (struct bchlib_s *)zalloc(sizeof(struct bchlib_s)); in bchlib_setup()
59 if (!bch) in bchlib_setup()
67 ret = open_blockdriver(blkdev, readonly ? MS_RDONLY : 0, &bch->vnode); in bchlib_setup()
74 struct drv_data *drv = (struct drv_data *)bch->vnode->data; in bchlib_setup()
77 DEBUGASSERT(bch->vnode && bops && bops->geometry); in bchlib_setup()
79 ret = bops->geometry(bch->vnode, &geo); in bchlib_setup()
102 (void)sem_init(&bch in bchlib_setup()
[all...]
H A Dbchlib_read.c2 * drivers/bch/bchlib_read.c
29 #include "bch.h"
63 struct bchlib_s *bch = (struct bchlib_s *)handle; in bchlib_read() local
80 sector = offset / bch->sectsize; in bchlib_read()
81 sectoffset = offset - sector * bch->sectsize; in bchlib_read()
83 if (sector >= bch->nsectors) in bchlib_read()
97 ret = bchlib_readsector(bch, sector + bch->sectstart); in bchlib_read()
105 if (sectoffset + len > bch->sectsize) in bchlib_read()
107 nbytes = bch in bchlib_read()
[all...]
H A Dbchlib_write.c2 * drivers/bch/bchlib_write.c
30 #include "bch.h"
47 struct bchlib_s *bch = (struct bchlib_s *)handle; in bchlib_write() local
64 sector = offset / bch->sectsize; in bchlib_write()
65 sectoffset = offset - sector * bch->sectsize; in bchlib_write()
67 if (sector >= bch->nsectors) in bchlib_write()
79 ret = bchlib_readsector(bch, sector + bch->sectstart); in bchlib_write()
87 if (sectoffset + len > bch->sectsize) in bchlib_write()
89 nbytes = bch in bchlib_write()
[all...]
H A Dbchlib_cache.c2 * drivers/bch/bchlib_cache.c
28 #include "bch.h"
49 int bchlib_flushsector(struct bchlib_s *bch) in bchlib_flushsector() argument
57 if (bch->dirty) in bchlib_flushsector()
61 ret = los_disk_write(bch->disk->disk_id, (const void *)bch->buffer, bch->sector, 1); in bchlib_flushsector()
70 bch->dirty = false; in bchlib_flushsector()
87 int bchlib_readsector(struct bchlib_s *bch, unsigned long long sector) in bchlib_readsector() argument
91 if (bch in bchlib_readsector()
[all...]
H A Dbchlib_teardown.c2 * drivers/bch/bchlib_teardown.c
27 #include "bch.h"
44 struct bchlib_s *bch = (struct bchlib_s *)handle; in bchlib_teardown() local
50 if (bch->refs > 0) in bchlib_teardown()
57 (void)bchlib_flushsector(bch); in bchlib_teardown()
61 (void)close_blockdriver(bch->vnode); in bchlib_teardown()
65 if (bch->buffer) in bchlib_teardown()
67 free(bch->buffer); in bchlib_teardown()
70 (void)sem_destroy(&bch->sem); in bchlib_teardown()
71 free(bch); in bchlib_teardown()
[all...]
H A Dbchdev_unregister.c2 * drivers/bch/bchdev_unregister.c
31 #include "bch.h"
51 struct bchlib_s *bch; in bchdev_unregister() local
75 ret = ioctl(fd, DIOC_GETPRIV, (unsigned long)((uintptr_t)&bch)); in bchdev_unregister()
93 if (bch->refs > 1) in bchdev_unregister()
114 bch->refs = 0; in bchdev_unregister()
115 return bchlib_teardown(bch); in bchdev_unregister()
118 bch->refs--; in bchdev_unregister()
H A Dbch.h2 * drivers/bch/bch.h
82 EXTERN void bchlib_semtake(struct bchlib_s *bch);
83 EXTERN int bchlib_flushsector(struct bchlib_s *bch);
84 EXTERN int bchlib_readsector(struct bchlib_s *bch, unsigned long long sector);
H A Dbchlib_sem.c2 * drivers/bch/bchlib_sem.c
27 #include "bch.h"
37 void bchlib_semtake(struct bchlib_s *bch) in bchlib_semtake() argument
39 while (sem_wait(&bch->sem) != 0) in bchlib_semtake()

Completed in 3 milliseconds