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