dkio.h revision 270312
12490Sjkh/* 2108470Sschweikh * CDDL HEADER START 32490Sjkh * 42490Sjkh * The contents of this file are subject to the terms of the 52490Sjkh * Common Development and Distribution License (the "License"). 62490Sjkh * You may not use this file except in compliance with the License. 72490Sjkh * 82490Sjkh * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92490Sjkh * or http://www.opensolaris.org/os/licensing. 102490Sjkh * See the License for the specific language governing permissions 112490Sjkh * and limitations under the License. 122490Sjkh * 132490Sjkh * When distributing Covered Code, include this CDDL HEADER in each 142490Sjkh * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152490Sjkh * If applicable, add the following below this CDDL HEADER, with the 162490Sjkh * fields enclosed by brackets "[]" replaced with your own identifying 172490Sjkh * information: Portions Copyright [yyyy] [name of copyright owner] 182490Sjkh * 192490Sjkh * CDDL HEADER END 202490Sjkh * 21111016Sschweikh * $FreeBSD: stable/10/sys/cddl/compat/opensolaris/sys/dkio.h 270312 2014-08-21 22:44:08Z smh $ 22205995Suqs */ 23205995Suqs/* 242490Sjkh * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 252490Sjkh * Use is subject to license terms. 262490Sjkh */ 27205995Suqs 28205995Suqs#ifndef _OPENSOLARIS_SYS_DKIO_H_ 292490Sjkh#define _OPENSOLARIS_SYS_DKIO_H_ 302490Sjkh 312490Sjkh#ifdef __cplusplus 322490Sjkhextern "C" { 332490Sjkh#endif 342490Sjkh 352490Sjkh/* 362490Sjkh * Disk io control commands 372490Sjkh * Warning: some other ioctls with the DIOC prefix exist elsewhere. 382490Sjkh * The Generic DKIOC numbers are from 0 - 50. 392490Sjkh * The Floppy Driver uses 51 - 100. 402490Sjkh * The Hard Disk (except SCSI) 101 - 106. (these are obsolete) 412490Sjkh * The CDROM Driver 151 - 200. 422490Sjkh * The USCSI ioctl 201 - 250. 432490Sjkh */ 442490Sjkh#define DKIOC (0x04 << 8) 45205995Suqs 462490Sjkh/* 47205995Suqs * The following ioctls are generic in nature and need to be 48205995Suqs * suported as appropriate by all disk drivers 492490Sjkh */ 502490Sjkh#define DKIOCGGEOM (DKIOC|1) /* Get geometry */ 512490Sjkh#define DKIOCINFO (DKIOC|3) /* Get info */ 522490Sjkh#define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */ 532490Sjkh#define DKIOCGVTOC (DKIOC|11) /* Get VTOC */ 542490Sjkh#define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */ 552490Sjkh 56205995Suqs/* 57108470Sschweikh * Disk Cache Controls. These ioctls should be supported by 582490Sjkh * all disk drivers. 592490Sjkh * 602490Sjkh * DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl 612490Sjkh * argument, but it should be passed as NULL to allow for future 622490Sjkh * reinterpretation. From user-mode, this ioctl request is synchronous. 632490Sjkh * 642490Sjkh * When invoked from within the kernel, the arg can be NULL to indicate 652490Sjkh * a synchronous request or can be the address of a struct dk_callback 662490Sjkh * to request an asynchronous callback when the flush request is complete. 672490Sjkh * In this case, the flag to the ioctl must include FKIOCTL and the 682490Sjkh * dkc_callback field of the pointed to struct must be non-null or the 692490Sjkh * request is made synchronously. 702490Sjkh * 712490Sjkh * In the callback case: if the ioctl returns 0, a callback WILL be performed. 722490Sjkh * If the ioctl returns non-zero, a callback will NOT be performed. 732490Sjkh * NOTE: In some cases, the callback may be done BEFORE the ioctl call 742490Sjkh * returns. The caller's locking strategy should be prepared for this case. 752490Sjkh */ 762490Sjkh#define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ 772490Sjkh 782490Sjkhstruct dk_callback { 792490Sjkh void (*dkc_callback)(void *dkc_cookie, int error); 802490Sjkh void *dkc_cookie; 812490Sjkh}; 822490Sjkh 832490Sjkh#ifdef __cplusplus 842490Sjkh} 852490Sjkh#endif 862490Sjkh 872490Sjkh#endif /* _OPENSOLARIS_SYS_DKIO_H_ */ 882490Sjkh