xref: /onnv-gate/usr/src/cmd/cdrw/main.h (revision 7024:c74e1591c8fd)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
56222Szk194757  * Common Development and Distribution License (the "License").
66222Szk194757  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
226222Szk194757  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_MAIN_H
270Sstevel@tonic-gate #define	_MAIN_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include "device.h"
366222Szk194757 #include <hal/libhal.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate extern int debug;
390Sstevel@tonic-gate 
400Sstevel@tonic-gate extern int		keep_disc_open;
410Sstevel@tonic-gate extern int		requested_speed;
420Sstevel@tonic-gate extern int		simulation;
430Sstevel@tonic-gate extern int		verbose;
440Sstevel@tonic-gate extern char		*image_file;
450Sstevel@tonic-gate extern char		*blanking_type;
460Sstevel@tonic-gate extern int		audio_type;
470Sstevel@tonic-gate extern cd_device	*target;		/* Default target device */
480Sstevel@tonic-gate extern int		extract_track_no;
490Sstevel@tonic-gate extern char		*extract_file;
500Sstevel@tonic-gate extern char		*alt_tmp_dir;
510Sstevel@tonic-gate extern char		*copy_src;
520Sstevel@tonic-gate extern int		vol_running;
530Sstevel@tonic-gate extern int		cflag, tflag;
540Sstevel@tonic-gate extern uid_t		ruid, cur_uid;
550Sstevel@tonic-gate extern int		device_type;
560Sstevel@tonic-gate extern int		write_mode;
570Sstevel@tonic-gate 
586222Szk194757 typedef enum {DBUS_CONNECTION, HAL_CONTEXT, HAL_PAIRED,
596222Szk194757     HAL_INITIALIZED} hal_state_t;
606222Szk194757 
610Sstevel@tonic-gate #define	TAO_MODE	0
626222Szk194757 #define	DAO_MODE	1	/* not implemented for CD yet only DVD */
630Sstevel@tonic-gate 
640Sstevel@tonic-gate #define	CD_RW		1		/* CD_RW/CD-R	*/
650Sstevel@tonic-gate #define	DVD_MINUS	2		/* DVD-RW/DVD-R	*/
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  * DVD+RW is listed differently from DVD+R since DVD+RW requires
696222Szk194757  * that we format the media prior to writing, this cannot be
700Sstevel@tonic-gate  * done for DVD+R since it is write once media, we treat the
710Sstevel@tonic-gate  * media as pre-formatted.
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate #define	DVD_PLUS	3		/* DVD+R	*/
740Sstevel@tonic-gate #define	DVD_PLUS_W	4		/* DVD+RW	*/
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #define	ALL		0	/* erase the complete media, slow */
770Sstevel@tonic-gate #define	FAST		1	/* only erases the leadin and TOC */
780Sstevel@tonic-gate #define	SESSION		6	/* erases the last session */
790Sstevel@tonic-gate #define	LEADOUT		5	/* erases the leadout of the media */
800Sstevel@tonic-gate #define	CLEAR		1	/* same as fast, used for fixing media */
810Sstevel@tonic-gate 
826222Szk194757 #define	HAL_RDSK_PROP	"block.solaris.raw_device"
836222Szk194757 #define	HAL_SYMDEV_PROP	"storage.solaris.legacy.symdev"
846222Szk194757 
85*6540Szk194757 #define	ONE_MB_BASE2	1048576	/* Number of bytes in 1 MB */
86*6540Szk194757 #define	ONE_GB_BASE10	1000000000	/* Manufacturers use 1 GB = 10^9 B */
87*6540Szk194757 
880Sstevel@tonic-gate int setup_target(int flag);
890Sstevel@tonic-gate 
906222Szk194757 int hald_running(void);
916222Szk194757 LibHalContext *attach_to_hald(void);
926222Szk194757 void detach_from_hald(LibHalContext *ctx, hal_state_t state);
936222Szk194757 
940Sstevel@tonic-gate void info(void);
950Sstevel@tonic-gate void list(void);
960Sstevel@tonic-gate void write_image(void);
970Sstevel@tonic-gate void blank(void);
980Sstevel@tonic-gate void write_audio(char **argv, int start_argc, int argc);
990Sstevel@tonic-gate void extract_audio(void);
1000Sstevel@tonic-gate void copy_cd(void);
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #ifdef	__cplusplus
1030Sstevel@tonic-gate }
1040Sstevel@tonic-gate #endif
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate #endif /* _MAIN_H */
107