xref: /illumos-gate/usr/src/cmd/cdrw/main.h (revision 8c067cfd3aea0c49a166f9fb38114b56a9160ac6)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_MAIN_H
27 #define	_MAIN_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include "device.h"
36 #include <hal/libhal.h>
37 
38 extern int debug;
39 
40 extern int		keep_disc_open;
41 extern int		requested_speed;
42 extern int		simulation;
43 extern int		verbose;
44 extern char		*image_file;
45 extern char		*blanking_type;
46 extern int		audio_type;
47 extern cd_device	*target;		/* Default target device */
48 extern int		extract_track_no;
49 extern char		*extract_file;
50 extern char		*alt_tmp_dir;
51 extern char		*copy_src;
52 extern int		vol_running;
53 extern int		cflag, tflag;
54 extern uid_t		ruid, cur_uid;
55 extern int		device_type;
56 extern int		write_mode;
57 
58 typedef enum {DBUS_CONNECTION, HAL_CONTEXT, HAL_PAIRED,
59     HAL_INITIALIZED} hal_state_t;
60 
61 #define	TAO_MODE	0
62 #define	DAO_MODE	1	/* not implemented for CD yet only DVD */
63 
64 #define	CD_RW		1		/* CD_RW/CD-R	*/
65 #define	DVD_MINUS	2		/* DVD-RW/DVD-R	*/
66 
67 /*
68  * DVD+RW is listed differently from DVD+R since DVD+RW requires
69  * that we format the media prior to writing, this cannot be
70  * done for DVD+R since it is write once media, we treat the
71  * media as pre-formatted.
72  */
73 #define	DVD_PLUS	3		/* DVD+R	*/
74 #define	DVD_PLUS_W	4		/* DVD+RW	*/
75 
76 #define	ALL		0	/* erase the complete media, slow */
77 #define	FAST		1	/* only erases the leadin and TOC */
78 #define	SESSION		6	/* erases the last session */
79 #define	LEADOUT		5	/* erases the leadout of the media */
80 #define	CLEAR		1	/* same as fast, used for fixing media */
81 
82 #define	HAL_RDSK_PROP	"block.solaris.raw_device"
83 #define	HAL_SYMDEV_PROP	"storage.solaris.legacy.symdev"
84 
85 #define	ONE_MB_BASE2	1048576	/* Number of bytes in 1 MB */
86 #define	ONE_GB_BASE10	1000000000	/* Manufacturers use 1 GB = 10^9 B */
87 
88 int setup_target(int flag);
89 
90 int hald_running(void);
91 LibHalContext *attach_to_hald(void);
92 void detach_from_hald(LibHalContext *ctx, hal_state_t state);
93 
94 void info(void);
95 void list(void);
96 void write_image(void);
97 void blank(void);
98 void write_audio(char **argv, int start_argc, int argc);
99 void extract_audio(void);
100 void copy_cd(void);
101 
102 #ifdef	__cplusplus
103 }
104 #endif
105 
106 #endif /* _MAIN_H */
107