1 /*
2  * Copyright (c) 2013 Corey Tabaka
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <lk/compiler.h>
11 #include <dev/driver.h>
12 
13 /* block interface */
14 struct block_ops {
15     struct driver_ops std;
16 
17     ssize_t (*get_block_size)(struct device *dev);
18     ssize_t (*get_block_count)(struct device *dev);
19 
20     ssize_t (*write)(struct device *dev, off_t offset, const void *buf, size_t count);
21     ssize_t (*read)(struct device *dev, off_t offset, void *buf, size_t count);
22 
23     status_t (*flush)(struct device *dev);
24 };
25 
26 __BEGIN_CDECLS
27 
28 ssize_t class_block_get_size(struct device *dev);
29 ssize_t class_block_get_count(struct device *dev);
30 ssize_t class_block_write(struct device *dev, off_t offset, const void *buf, size_t count);
31 ssize_t class_block_read(struct device *dev, off_t offset, void *buf, size_t count);
32 status_t class_block_flush(struct device *dev);
33 
34 __END_CDECLS
35 
36