xref: /illumos-gate/usr/src/cmd/cdrw/util.h (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
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	_UTIL_H
28 #define	_UTIL_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 #include "device.h"
36 #include "trackio.h"
37 #include "bstream.h"
38 
39 #define	EXIT_IF_CHECK_FAILED		0x80000000
40 #define	BUFSIZE				32
41 /*
42  * Condition to be checked for a device
43  */
44 #define	CHECK_TYPE_NOT_CDROM		1
45 #define	CHECK_DEVICE_NOT_READY		2
46 #define	CHECK_DEVICE_NOT_WRITABLE	4
47 #define	CHECK_NO_MEDIA			8
48 #define	CHECK_MEDIA_IS_NOT_WRITABLE	0x10
49 #define	CHECK_MEDIA_IS_NOT_BLANK	0x20
50 #define	CHECK_MEDIA_IS_NOT_ERASABLE	0x40
51 
52 /*
53  * audio types
54  */
55 #define	AUDIO_TYPE_NONE	0
56 #define	AUDIO_TYPE_SUN	1
57 #define	AUDIO_TYPE_WAV	2
58 #define	AUDIO_TYPE_CDA	3
59 #define	AUDIO_TYPE_AUR	4
60 
61 extern int progress_pos;
62 extern int priv_change_needed;
63 
64 void *my_zalloc(size_t size);
65 int str_print(char *str, int pos);
66 void print_trackio_error(struct trackio_error *te);
67 char *get_err_str(void);
68 int get_audio_type(char *ext);
69 void init_progress(void);
70 int progress(int64_t arg, int64_t completed);
71 void raise_priv(void);
72 void lower_priv(void);
73 int check_auth(uid_t uid);
74 void ms_delay(uint_t ms);
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif /* _UTIL_H */
81