Rev 3500 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3500 | Rev 3555 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | The kernel exports the functions 'DiskAdd', 'DiskMediaChanged', 'DiskDel' for |
11 | The kernel exports the functions 'DiskAdd', 'DiskMediaChanged', 'DiskDel' for |
12 | drivers. They must be called in the following order: DiskAdd, then zero or |
12 | drivers. They must be called in the following order: DiskAdd, then zero or |
13 | more DiskMediaChanged, then optionally DiskDel. The driver must not call |
13 | more DiskMediaChanged, then optionally DiskDel. The driver must not call |
14 | two functions in parallel, including two calls to DiskMediaChanged. |
14 | two functions in parallel, including two calls to DiskMediaChanged. |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | void* stdcall DiskAdd(DISKFUNC* functions, const char* name, void* userdata, |
16 | void* DiskAdd(DISKFUNC* functions, const char* name, void* userdata, int flags); |
17 | int flags); ; The pointer 'functions' must be valid at least until the disk |
17 | ; The pointer 'functions' must be valid at least until the disk will be deleted |
18 | will be deleted ; (until DISKFUNC.close is called). ; The pointer 'name' can |
18 | ; (until DISKFUNC.close is called). |
19 | be invalid after this function returns. ; It should point to ASCIIZ-string |
19 | ; The pointer 'name' can be invalid after this function returns. |
- | 20 | ; It should point to ASCIIZ-string without leading '/' in latin lowercase and |
|
20 | without leading '/' in latin lowercase and ; digits, like 'usbhd0'. ; The |
21 | ; digits, like 'usbhd0'. |
- | 22 | ; The value 'userdata' is any pointer-sized data, passed as is to all |
|
21 | value 'userdata' is any pointer-sized data, passed as is to all ; callbacks. |
23 | ; callbacks. |
22 | DISK_NO_INSERT_NOTIFICATION = 1 |
24 | DISK_NO_INSERT_NOTIFICATION = 1 |
23 | ; The bitfield 'flags' has currently only one bit defined. If it is set, the |
25 | ; The bitfield 'flags' has currently only one bit defined. If it is set, the |
24 | ; driver will never call DiskMediaChanged(hDisk, true), so the kernel must scan |
26 | ; driver will never call DiskMediaChanged(hDisk, true), so the kernel must scan |
25 | ; for media insertion when the operation is requested. |
27 | ; for media insertion when the operation is requested. |
26 | struc DISKFUNC |
28 | struc DISKFUNC |
27 | { |
29 | { |
28 | .strucsize dd ? |
30 | .strucsize dd ? |
29 | .close dd ? |
31 | .close dd ? |
30 | ; void stdcall (*close)(void* userdata); |
32 | ; void close(void* userdata); |
31 | ; Optional. |
33 | ; Optional. |
32 | ; The last function that is called for the given disk. The kernel calls it when |
34 | ; The last function that is called for the given disk. The kernel calls it when |
33 | ; the kernel has finished all operations with the disk and it is safe to free |
35 | ; the kernel has finished all operations with the disk and it is safe to free |
34 | ; all driver-specific data identified by 'userdata'. |
36 | ; all driver-specific data identified by 'userdata'. |
35 | .closemedia dd ? |
37 | .closemedia dd ? |
36 | ; void stdcall (*closemedia)(void* userdata); |
38 | ; void closemedia(void* userdata); |
37 | ; Optional. |
39 | ; Optional. |
38 | ; The kernel calls this function when it finished all processing with the |
40 | ; The kernel calls this function when it finished all processing with the |
39 | ; current media. If media is removed, the driver should decline all requests |
41 | ; current media. If media is removed, the driver should decline all requests |
40 | ; to that media with DISK_STATUS_NO_MEDIA, even if new media is inserted, |
42 | ; to that media with DISK_STATUS_NO_MEDIA, even if new media is inserted, |
41 | ; until this function is called. If media is removed, a new call to |
43 | ; until this function is called. If media is removed, a new call to |
42 | ; DiskMediaChanged(hDisk, true) is not allowed until this function is called. |
44 | ; DiskMediaChanged(hDisk, true) is not allowed until this function is called. |
43 | .querymedia dd ? |
45 | .querymedia dd ? |
44 | ; int stdcall (*querymedia)(void* userdata, DISKMEDIAINFO* info); |
46 | ; int querymedia(void* userdata, DISKMEDIAINFO* info); |
45 | ; return value: 0 = success, otherwise = error |
47 | ; return value: 0 = success, otherwise = error |
46 | .read dd ? |
48 | .read dd ? |
47 | ; int stdcall (*read)(void* userdata, void* buffer, __int64 startsector, |
49 | ; int read(void* userdata, void* buffer, __int64 startsector, |
48 | ; int* numsectors); |
50 | ; int* numsectors); |
49 | ; return value: 0 = success, otherwise = error |
51 | ; return value: 0 = success, otherwise = error |
50 | .write dd ? |
52 | .write dd ? |
51 | ; int stdcall (*write)(void* userdata, const void* buffer, __int64 startsector, |
53 | ; int write(void* userdata, const void* buffer, __int64 startsector, |
52 | ; int* numsectors); |
54 | ; int* numsectors); |
53 | ; Optional. |
55 | ; Optional. |
54 | ; return value: 0 = success, otherwise = error |
56 | ; return value: 0 = success, otherwise = error |
55 | .flush dd ? |
57 | .flush dd ? |
56 | ; int stdcall (*flush)(void* userdata); |
58 | ; int flush(void* userdata); |
57 | ; Optional. |
59 | ; Optional. |
58 | ; Flushes the hardware cache, if it exists. Note that a driver should not |
60 | ; Flushes the hardware cache, if it exists. Note that a driver should not |
59 | ; implement a software cache for read/write, since they are called from the |
61 | ; implement a software cache for read/write, since they are called from the |
60 | ; kernel cache manager. |
62 | ; kernel cache manager. |
61 | .adjust_cache_size dd ? |
63 | .adjust_cache_size dd ? |
62 | ; unsigned int stdcall (*adjust_cache_size)(unsigned int suggested_size); |
64 | ; unsigned int adjust_cache_size(unsigned int suggested_size); |
63 | ; Optional. |
65 | ; Optional. |
64 | ; Returns the cache size for this device in bytes. 0 = disable cache. |
66 | ; Returns the cache size for this device in bytes. 0 = disable cache. |
65 | } |
67 | } |
66 | struc DISKMEDIAINFO |
68 | struc DISKMEDIAINFO |