1/*
2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24// cddafs_util.h created by CJS on Mon 18-May-2000
25
26#ifndef __CDDAFS_UTIL_H__
27#define __CDDAFS_UTIL_H__
28
29#include "AppleCDDAFileSystemDefines.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36//-----------------------------------------------------------------------------
37//	Constants
38//-----------------------------------------------------------------------------
39
40// cddafs Stuff
41#define kCDDAFileSystemName				"cddafs"
42#define	kMountPointName					"Audio CD"
43#define kCDDAFileSystemMountType		"cddafs"
44
45// (Un)Mount Stuff
46#define kMountCommand					"/sbin/mount"
47#define kUnmountCommand					"/sbin/umount"
48#define kLoadCommand 					"/sbin/kextload"
49#define kCDDAFileSystemExtensionPath 	"/System/Library/Extensions/cddafs.kext"
50
51#define kMountExecutableName			"/sbin/mount_cddafs"
52#define kUtilExecutableName				"cddafs.util"
53
54#define kIOCDMediaTOC					"TOC"
55#define kIOCDMediaString				"IOCDMedia"
56
57#ifndef FSUR_MOUNT_HIDDEN
58#define FSUR_MOUNT_HIDDEN (-9)
59#endif
60
61/* XML PList keys */
62#define kRawTOCDataString				"Format 0x02 TOC Data"
63#define kSessionsString					"Sessions"
64#define kSessionTypeString				"Session Type"
65#define kTrackArrayString				"Track Array"
66#define kFirstTrackInSessionString		"First Track"
67#define kLastTrackInSessionString		"Last Track"
68#define kLeadoutBlockString				"Leadout Block"
69#define	kDataString 					"Data"
70#define kPointString					"Point"
71#define kSessionNumberString			"Session Number"
72#define kStartBlockString		 		"Start Block"
73#define kPreEmphasisString				"Pre-Emphasis Enabled"
74
75enum
76{
77	kUsageTypeUtility	= 0,
78	kUsageTypeMount		= 1
79};
80
81
82//-----------------------------------------------------------------------------
83//	Function Prototypes
84//-----------------------------------------------------------------------------
85
86
87void				DisplayUsage  			( int usageType, const char * argv[] );
88void 				StripTrailingSpaces		( char * contentsPtr );
89void				WriteDiskLabel 			( char * contentsPtr );
90int					Mount					( const char * 	deviceNamePtr,
91											  const char * 	mountPointPtr,
92											  int			mountFlags );
93int 				Probe 					( char * deviceNamePtr );
94int 				Unmount 				( const char * mountPtPtr );
95int					ParseMountArgs			( int * argc, const char ** argv[], int * mountFlags );
96int					ParseUtilityArgs 		( int argc,
97											  const char * argv[],
98											  const char ** actionPtr,
99											  const char ** mountPointPtr,
100											  boolean_t * isEjectablePtr,
101											  boolean_t * isLockedPtr );
102UInt8 *				CreateBufferFromCFData 	( CFDataRef string );
103CFDataRef			CreateXMLFileInPListFormat ( QTOCDataFormat10Ptr TOCDataPtr );
104UInt32				FindNumberOfAudioTracks ( QTOCDataFormat10Ptr TOCDataPtr );
105
106int					ParseTOC 				( UInt8 * TOCInfoPtr );
107UInt8 *				GetTOCDataPtr			( const char * deviceNamePtr );
108UInt8				GetPointValue			( UInt32 trackIndex, QTOCDataFormat10Ptr TOCData );
109Boolean				IsAudioTrack			( UInt32 trackNumber, QTOCDataFormat10Ptr TOCData );
110SInt32				GetNumberOfTrackDescriptors ( 	QTOCDataFormat10Ptr	TOCDataPtr,
111													UInt8 * 			numberOfDescriptors );
112
113int					GetVFSConfigurationByName ( const char * fileSystemName,
114												struct vfsconf * vfsConfPtr );
115int					LoadKernelExtension		( void );
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif // __CDDAFS_UTIL_H__