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 #pragma ident "%Z%%M% %I% %E% SMI"
30 #pragma D depends_on provider io
32 typedef struct devinfo {
33 int dev_major; /* major number */
34 int dev_minor; /* minor number */
35 int dev_instance; /* instance number */
36 string dev_name; /* name of device */
37 string dev_statname; /* name of device + instance/minor */
38 string dev_pathname; /* pathname of device */
41 #pragma D binding "1.0" translator
42 translator devinfo_t < struct devstat *D > {
43 dev_major = D->device_number;
44 dev_minor = D->unit_number;
46 dev_name = stringof(D->device_name);
47 dev_statname = stringof(D->device_name);
48 dev_pathname = stringof(D->device_name);
51 typedef struct bufinfo {
52 int b_flags; /* flags */
53 long b_bcount; /* number of bytes */
54 caddr_t b_addr; /* buffer address */
55 uint64_t b_blkno; /* expanded block # on device */
56 uint64_t b_lblkno; /* block # on device */
57 size_t b_resid; /* # of bytes not transferred */
58 size_t b_bufsize; /* size of allocated buffer */
59 /* caddr_t b_iodone; I/O completion routine */
60 int b_error; /* expanded error field */
61 /* dev_t b_edev; extended device */
64 #pragma D binding "1.0" translator
65 translator bufinfo_t < struct bio *B > {
66 b_flags = B->bio_flags;
67 b_bcount = B->bio_bcount;
71 b_resid = B->bio_resid;
72 b_bufsize = 0; /* XXX gnn */
73 b_error = B->bio_error;
77 * The following inline constants can be used to examine fi_oflags when using
78 * the fds[] array or a translated fileinfo_t. Note that the various open
79 * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR.
80 * To test the open mode, you write code similar to that used with the fcntl(2)
81 * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) == O_WRONLY).
83 inline int O_ACCMODE = 0x0003;
84 #pragma D binding "1.1" O_ACCMODE
86 inline int O_RDONLY = 0x0000;
87 #pragma D binding "1.1" O_RDONLY
88 inline int O_WRONLY = 0x0001;
89 #pragma D binding "1.1" O_WRONLY
90 inline int O_RDWR = 0x0002;
91 #pragma D binding "1.1" O_RDWR
93 inline int O_APPEND = 0x0008;
94 #pragma D binding "1.1" O_APPEND
95 inline int O_CREAT = 0x0200;
96 #pragma D binding "1.1" O_CREAT
97 inline int O_EXCL = 0x0800;
98 #pragma D binding "1.1" O_EXCL
99 inline int O_NOCTTY = 0x8000;
100 #pragma D binding "1.1" O_NOCTTY
101 inline int O_NONBLOCK = 0x0004;
102 #pragma D binding "1.1" O_NONBLOCK
103 inline int O_NDELAY = 0x0004;
104 #pragma D binding "1.1" O_NDELAY
105 inline int O_SYNC = 0x0080;
106 #pragma D binding "1.1" O_SYNC
107 inline int O_TRUNC = 0x0400;
108 #pragma D binding "1.1" O_TRUNC