4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #ifndef _OPENSOLARIS_SYS_DKIO_H_
29 #define _OPENSOLARIS_SYS_DKIO_H_
36 * Disk io control commands
37 * Warning: some other ioctls with the DIOC prefix exist elsewhere.
38 * The Generic DKIOC numbers are from 0 - 50.
39 * The Floppy Driver uses 51 - 100.
40 * The Hard Disk (except SCSI) 101 - 106. (these are obsolete)
41 * The CDROM Driver 151 - 200.
42 * The USCSI ioctl 201 - 250.
44 #define DKIOC (0x04 << 8)
47 * The following ioctls are generic in nature and need to be
48 * suported as appropriate by all disk drivers
50 #define DKIOCGGEOM (DKIOC|1) /* Get geometry */
51 #define DKIOCINFO (DKIOC|3) /* Get info */
52 #define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */
53 #define DKIOCGVTOC (DKIOC|11) /* Get VTOC */
54 #define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */
57 * Disk Cache Controls. These ioctls should be supported by
60 * DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl
61 * argument, but it should be passed as NULL to allow for future
62 * reinterpretation. From user-mode, this ioctl request is synchronous.
64 * When invoked from within the kernel, the arg can be NULL to indicate
65 * a synchronous request or can be the address of a struct dk_callback
66 * to request an asynchronous callback when the flush request is complete.
67 * In this case, the flag to the ioctl must include FKIOCTL and the
68 * dkc_callback field of the pointed to struct must be non-null or the
69 * request is made synchronously.
71 * In the callback case: if the ioctl returns 0, a callback WILL be performed.
72 * If the ioctl returns non-zero, a callback will NOT be performed.
73 * NOTE: In some cases, the callback may be done BEFORE the ioctl call
74 * returns. The caller's locking strategy should be prepared for this case.
76 #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */
78 #define DKIOCTRIM (DKIOC|35) /* TRIM a block */
81 void (*dkc_callback)(void *dkc_cookie, int error);
89 #endif /* _OPENSOLARIS_SYS_DKIO_H_ */