1 
2 #ifndef __SYS_DISK_H__
3 #define __SYS_DISK_H__
4 
5 #include <sys/queue.h>
6 #include <sys/sga.h>
7 
8 typedef void (*DiskCB)(int, void *);
9 
10 typedef struct Disk Disk;
11 typedef struct Disk {
12     void	*handle;					// Driver handle
13     uint64_t	ctrlNo;						// Controller number
14     uint64_t	diskNo;						// Disk number
15     uint64_t	sectorSize;					// Sector Size
16     uint64_t	sectorCount;					// Sector Count
17     uint64_t	diskSize;					// Disk Size in Bytes
18     int		(*read)(Disk *, void *, SGArray *, DiskCB, void *);	// Read
19     int		(*write)(Disk *, void *, SGArray *, DiskCB, void *);	// Write
20     int		(*flush)(Disk *, void *, SGArray *, DiskCB, void *);	// Flush
21     LIST_ENTRY(Disk) entries;
22 } Disk;
23 
24 void Disk_AddDisk(Disk *disk);
25 void Disk_RemoveDisk(Disk *disk);
26 Disk *Disk_GetByID(uint64_t ctrlNo, uint64_t diskNo);
27 int Disk_Read(Disk *disk, void * buf, SGArray *sga, DiskCB cb, void *arg);
28 int Disk_Write(Disk *disk, void * buf, SGArray *sga, DiskCB cb, void *arg);
29 int Disk_Flush(Disk *disk, void * buf, SGArray *sga, DiskCB cb, void *arg);
30 
31 #endif /* __SYS_DISK_H__ */
32 
33