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