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