1236628Sgnn/* 2236628Sgnn * CDDL HEADER START 3236628Sgnn * 4236628Sgnn * The contents of this file are subject to the terms of the 5236628Sgnn * Common Development and Distribution License (the "License"). 6236628Sgnn * You may not use this file except in compliance with the License. 7236628Sgnn * 8236628Sgnn * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9236628Sgnn * or http://www.opensolaris.org/os/licensing. 10236628Sgnn * See the License for the specific language governing permissions 11236628Sgnn * and limitations under the License. 12236628Sgnn * 13236628Sgnn * When distributing Covered Code, include this CDDL HEADER in each 14236628Sgnn * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15236628Sgnn * If applicable, add the following below this CDDL HEADER, with the 16236628Sgnn * fields enclosed by brackets "[]" replaced with your own identifying 17236628Sgnn * information: Portions Copyright [yyyy] [name of copyright owner] 18236628Sgnn * 19236628Sgnn * CDDL HEADER END 20236628Sgnn * 21236628Sgnn * $FreeBSD$ 22236628Sgnn */ 23236628Sgnn/* 24236628Sgnn * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25236628Sgnn * Use is subject to license terms. 26236628Sgnn */ 27236628Sgnn 28236628Sgnn#pragma ident "%Z%%M% %I% %E% SMI" 29236628Sgnn 30236628Sgnn#pragma D depends_on provider io 31236628Sgnn 32236628Sgnntypedef struct devinfo { 33243989Sgnn int dev_major; /* major number */ 34243989Sgnn int dev_minor; /* minor number */ 35243989Sgnn int dev_instance; /* instance number */ 36243989Sgnn string dev_name; /* name of device */ 37243989Sgnn string dev_statname; /* name of device + instance/minor */ 38243989Sgnn string dev_pathname; /* pathname of device */ 39236628Sgnn} devinfo_t; 40236628Sgnn 41236628Sgnn#pragma D binding "1.0" translator 42243989Sgnntranslator devinfo_t < struct devstat *D > { 43243989Sgnn dev_major = D->device_number; 44243989Sgnn dev_minor = D->unit_number; 45243989Sgnn dev_instance = 0; 46243989Sgnn dev_name = stringof(D->device_name); 47243989Sgnn dev_statname = stringof(D->device_name); 48243989Sgnn dev_pathname = stringof(D->device_name); 49236628Sgnn}; 50236628Sgnn 51243989Sgnntypedef struct bufinfo { 52243989Sgnn int b_flags; /* flags */ 53243989Sgnn long b_bcount; /* number of bytes */ 54243989Sgnn caddr_t b_addr; /* buffer address */ 55243989Sgnn uint64_t b_blkno; /* expanded block # on device */ 56243989Sgnn uint64_t b_lblkno; /* block # on device */ 57243989Sgnn size_t b_resid; /* # of bytes not transferred */ 58243989Sgnn size_t b_bufsize; /* size of allocated buffer */ 59243989Sgnn/* caddr_t b_iodone; I/O completion routine */ 60243989Sgnn int b_error; /* expanded error field */ 61243989Sgnn/* dev_t b_edev; extended device */ 62243989Sgnn} bufinfo_t; 63236628Sgnn 64236628Sgnn#pragma D binding "1.0" translator 65243989Sgnntranslator bufinfo_t < struct bio *B > { 66243989Sgnn b_flags = B->bio_flags; 67243989Sgnn b_bcount = B->bio_bcount; 68243989Sgnn b_addr = B->bio_data; 69243989Sgnn b_blkno = 0; 70243989Sgnn b_lblkno = 0; 71243989Sgnn b_resid = B->bio_resid; 72243989Sgnn b_bufsize = 0; /* XXX gnn */ 73243989Sgnn b_error = B->bio_error; 74236628Sgnn}; 75236628Sgnn 76236628Sgnn/* 77236628Sgnn * The following inline constants can be used to examine fi_oflags when using 78236628Sgnn * the fds[] array or a translated fileinfo_t. Note that the various open 79236628Sgnn * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR. 80236628Sgnn * To test the open mode, you write code similar to that used with the fcntl(2) 81236628Sgnn * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) == O_WRONLY). 82236628Sgnn */ 83236628Sgnninline int O_ACCMODE = 0x0003; 84236628Sgnn#pragma D binding "1.1" O_ACCMODE 85236628Sgnn 86236628Sgnninline int O_RDONLY = 0x0000; 87236628Sgnn#pragma D binding "1.1" O_RDONLY 88236628Sgnninline int O_WRONLY = 0x0001; 89236628Sgnn#pragma D binding "1.1" O_WRONLY 90236628Sgnninline int O_RDWR = 0x0002; 91236628Sgnn#pragma D binding "1.1" O_RDWR 92236628Sgnn 93236628Sgnninline int O_APPEND = 0x0008; 94236628Sgnn#pragma D binding "1.1" O_APPEND 95236628Sgnninline int O_CREAT = 0x0200; 96236628Sgnn#pragma D binding "1.1" O_CREAT 97236628Sgnninline int O_EXCL = 0x0800; 98236628Sgnn#pragma D binding "1.1" O_EXCL 99236628Sgnninline int O_NOCTTY = 0x8000; 100236628Sgnn#pragma D binding "1.1" O_NOCTTY 101236628Sgnninline int O_NONBLOCK = 0x0004; 102236628Sgnn#pragma D binding "1.1" O_NONBLOCK 103236628Sgnninline int O_NDELAY = 0x0004; 104236628Sgnn#pragma D binding "1.1" O_NDELAY 105236628Sgnninline int O_SYNC = 0x0080; 106236628Sgnn#pragma D binding "1.1" O_SYNC 107236628Sgnninline int O_TRUNC = 0x0400; 108236628Sgnn#pragma D binding "1.1" O_TRUNC 109236628Sgnn 110236628Sgnn 111