root / Whitix / branches / network / include / sdevice.h

Revision 1, 2.0 kB (checked in by mtw07, 11 months ago)

Initial import of projects.

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#ifndef SDEVICE_H
20#define SDEVICE_H
21
22#include <typedefs.h>
23#include <llist.h>
24
25/* Common interface to storage devices for the block cache code */
26struct StorageDevice
27{
28        char* name;
29        int (*request)(void* data);
30        WORD blockSize,softBlockSize;
31        struct ListHead list,requestList,blockList;
32        void* priv;
33        int totalSectors,partIndex; /* For partition code */
34
35        /* Hardware information - may not apply for some storage devices */
36        DWORD heads,sectors,cylinders;
37};
38
39/* For user-space */
40struct StorageGeom
41{
42        DWORD heads,sectors,cylinders;
43}PACKED;
44
45int StorageAddDevice(struct StorageDevice* dev);
46int StorageRemoveDevice(struct StorageDevice* dev);
47
48int StorageQueueInit(struct StorageDevice* dev);
49struct Request* StorageGetCurrRequest(struct StorageDevice* dev);
50int StorageDoRequest(struct StorageDevice* dev,struct Request* request);
51int StorageQueueDestroy(struct StorageDevice* dev);
52int StorageEndRequest(struct StorageDevice* device,int status);
53
54/* Many of the properties of block device IoCtl's can be abstracted */
55
56int StorageIoCtl(struct StorageDevice* dev,unsigned long code,char* data);
57
58/* Block ioctls */
59#define IOCTL_BLOCK_GETBLKSIZE          0x00000001
60#define IOCTL_BLOCK_GETGEOM                     0x00000002
61
62#endif
Note: See TracBrowser for help on using the browser.