• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GPXE_BLOCKDEV_H
2 #define _GPXE_BLOCKDEV_H
3 
4 /**
5  * @file
6  *
7  * Block devices
8  *
9  */
10 
11 FILE_LICENCE ( GPL2_OR_LATER );
12 
13 #include <gpxe/uaccess.h>
14 
15 struct block_device;
16 
17 /** Block device operations */
18 struct block_device_operations {
19 	/**
20 	 * Read block
21 	 *
22 	 * @v blockdev	Block device
23 	 * @v block	Block number
24 	 * @v count	Block count
25 	 * @v buffer	Data buffer
26 	 * @ret rc	Return status code
27 	 */
28 	int ( * read ) ( struct block_device *blockdev, uint64_t block,
29 			 unsigned long count, userptr_t buffer );
30 	/**
31 	 * Write block
32 	 *
33 	 * @v blockdev	Block device
34 	 * @v block	Block number
35 	 * @v count	Block count
36 	 * @v buffer	Data buffer
37 	 * @ret rc	Return status code
38 	 */
39 	int ( * write ) ( struct block_device *blockdev, uint64_t block,
40 			  unsigned long count, userptr_t buffer );
41 };
42 
43 /** A block device */
44 struct block_device {
45 	/** Block device operations */
46 	struct block_device_operations *op;
47 	/** Block size */
48 	size_t blksize;
49 	/** Total number of blocks */
50 	uint64_t blocks;
51 };
52 
53 #endif /* _GPXE_BLOCKDEV_H */
54