xref: /titanic_51/usr/src/cmd/cdrw/trackio.h (revision 1c5bc425cc346c6844d58e1fdd8794e9553dd289)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _TRACKIO_H
28 #define	_TRACKIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include "bstream.h"
38 #include "misc_scsi.h"
39 
40 struct trackio_error {
41 	int	err_type;
42 /* File I/O errors */
43 	int	te_errno;
44 /* Transport Errors */
45 	uchar_t	status, key, asc, ascq;
46 };
47 
48 /*
49  * trackio error types
50  */
51 #define	TRACKIO_ERR_SYSTEM	1
52 #define	TRACKIO_ERR_TRANSPORT	2
53 #define	TRACKIO_ERR_USER_ABORT	3
54 
55 /*
56  * iob state
57  */
58 #define	IOBS_UNDER_FILE_IO	1
59 #define	IOBS_UNDER_DEVICE_IO	2
60 #define	IOBS_READY		3
61 #define	IOBS_EMPTY		4
62 
63 struct iobuf {
64 	uchar_t *iob_buf;
65 	uint32_t iob_total_size; /* total size of the buf */
66 	uint32_t iob_data_size;	 /* size of the data in buf */
67 	uint32_t iob_start_blk;	 /* starting block address on the device */
68 	uint16_t iob_nblks;	 /* number of data blocks in this buf */
69 	int iob_state;		 /* state of buf */
70 };
71 
72 /* Use small buffers. Some drives do not behave well with large buffers */
73 #define	NIOBS			8
74 #define	NBLKS_PER_BUF		24	/* < 64K in all cases */
75 #define	DATA_TRACK_BLKSIZE	2048
76 #define	AUDIO_TRACK_BLKSIZE	2352
77 
78 int write_track(cd_device *dev, struct track_info *ti, bstreamhandle h,
79 		int (*cb)(int64_t, int64_t), int64_t arg, struct
80 		trackio_error *te);
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif /* _TRACKIO_H */
87