AppleCDDAFileSystemDefines.h [plain text]
#ifndef __APPLE_CDDA_FS_DEFINES_H__
#define __APPLE_CDDA_FS_DEFINES_H__
#ifndef __AIFF_SUPPORT_H__
#include "AIFFSupport.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <libkern/OSTypes.h>
#if KERNEL
#include <sys/systm.h>
#endif
enum
{
kDigitalDataBit = 2,
kDigitalDataMask = ( 1 << kDigitalDataBit )
};
enum
{
kSecondsPerMinute = 60,
kFramesPerSecond = 75,
kMSFToLBA = (kFramesPerSecond << 1) };
enum cddaNodeType
{
kAppleCDDADirectoryType = 1,
kAppleCDDATrackType = 2,
kAppleCDDXMLFileType = 3
};
enum
{
kAppleCDDANumberOfFileReferences = 1,
kAppleCDDANumberOfRootDirReferences = 2
};
enum
{
kAppleCDDAAccessedBit = 0
};
enum
{
kAppleCDDAAccessedMask = ( 1 << kAppleCDDAAccessedBit )
};
enum
{
kAppleCDDAXMLFileID = 3
};
enum
{
kUnknownUserID = 99,
kUnknownGroupID = 99
};
enum
{
kCDDAMaxFileNameBytes = 3 * 255
};
extern char gFileSuffix[];
enum
{
kFinderInfoOnDesktopBit = 0,
kFinderInfoOwnApplBit = 1,
kFinderInfoNoFileExtensionBit = 4,
kFinderInfoSharedBit = 6,
kFinderInfoCachedBit = 7,
kFinderInfoInitedBit = 8,
kFinderInfoChangedBit = 9,
kFinderInfoBusyBit = 10,
kFinderInfoNoCopyBit = 11,
kFinderInfoSystemBit = 12,
kFinderInfoHasBundleBit = 13,
kFinderInfoInvisibleBit = 14,
kFinderInfoLockedBit = 15
};
enum
{
kFinderInfoOnDesktopMask = (1 << kFinderInfoOnDesktopBit),
kFinderInfoOwnApplMask = (1 << kFinderInfoOwnApplBit),
kFinderInfoNoFileExtensionMask = (1 << kFinderInfoNoFileExtensionBit),
kFinderInfoSharedMask = (1 << kFinderInfoSharedBit),
kFinderInfoCachedMask = (1 << kFinderInfoCachedBit),
kFinderInfoInitedMask = (1 << kFinderInfoInitedBit),
kFinderInfoChangedMask = (1 << kFinderInfoChangedBit),
kFinderInfoBusyMask = (1 << kFinderInfoBusyBit),
kFinderInfoNoCopyMask = (1 << kFinderInfoNoCopyBit),
kFinderInfoSystemMask = (1 << kFinderInfoSystemBit),
kFinderInfoHasBundleMask = (1 << kFinderInfoHasBundleBit),
kFinderInfoInvisibleMask = (1 << kFinderInfoInvisibleBit),
kFinderInfoLockedMask = (1 << kFinderInfoLockedBit)
};
#define kExtendedFinderInfoSize 16
struct FinderInfo
{
UInt32 fileType;
UInt32 fileCreator;
UInt16 finderFlags;
struct
{
SInt16 v;
SInt16 h;
} location;
UInt16 reserved;
};
typedef struct FinderInfo FinderInfo;
struct SubQTOCInfo
{
UInt8 sessionNumber;
UInt8 address:4;
UInt8 control:4;
UInt8 tno;
UInt8 point;
UInt8 ATIP[3];
UInt8 zero;
union {
struct {
UInt8 minutes;
UInt8 seconds;
UInt8 frames;
} startPosition;
struct {
UInt8 firstTrackNum;
UInt8 discType;
UInt8 reserved;
} A0PMSF;
struct {
UInt8 lastTrackNum;
UInt8 reserved[2];
} A1PMSF;
struct {
UInt8 minutes;
UInt8 seconds;
UInt8 frames;
} leadOutStartPosition;
} PMSF;
};
typedef struct SubQTOCInfo SubQTOCInfo;
typedef struct SubQTOCInfo * SubQTOCInfoPtr;
struct QTOCDataFormat10
{
UInt16 TOCDataLength;
UInt8 firstSessionNumber;
UInt8 lastSessionNumber;
SubQTOCInfo trackDescriptors[1];
};
typedef struct QTOCDataFormat10 QTOCDataFormat10;
typedef struct QTOCDataFormat10 * QTOCDataFormat10Ptr;
struct AppleCDDAArguments
{
char * device; UInt8 numTracks; UInt32 nameDataSize; char * nameData; UInt32 xmlFileSize; UInt8 * xmlData; UInt32 fileType; UInt32 fileCreator; };
typedef struct AppleCDDAArguments AppleCDDAArguments;
typedef struct AppleCDDAArguments * AppleCDDAArgumentsPtr;
#if KERNEL
struct AppleCDDANodeInfo
{
struct vnode * vNodePtr; UInt8 nameSize; char * name; SubQTOCInfo trackDescriptor; UInt32 LBA; UInt32 numBytes; };
typedef struct AppleCDDANodeInfo AppleCDDANodeInfo;
typedef struct AppleCDDANodeInfo * AppleCDDANodeInfoPtr;
struct AppleCDDAMount
{
struct vnode * root; struct vnode * xmlFileVNodePtr; UInt32 nameDataSize; UInt8 * nameData; AppleCDDANodeInfoPtr nodeInfoArrayPtr; struct lock__bsd__ nodeInfoLock; UInt8 numTracks; struct timespec mountTime; UInt32 fileType; UInt32 fileCreator; };
typedef struct AppleCDDAMount AppleCDDAMount;
typedef struct AppleCDDAMount * AppleCDDAMountPtr;
struct AppleCDDADirectoryNode
{
UInt32 entryCount; UInt64 directorySize; char * name; };
typedef struct AppleCDDADirectoryNode AppleCDDADirectoryNode;
typedef struct AppleCDDADirectoryNode * AppleCDDADirectoryNodePtr;
struct AppleCDDAFileNode
{
CDAIFFHeader aiffHeader; AppleCDDANodeInfoPtr nodeInfoPtr; };
typedef struct AppleCDDAFileNode AppleCDDAFileNode;
typedef struct AppleCDDAFileNode * AppleCDDAFileNodePtr;
struct AppleCDDAXMLFileNode
{
UInt32 fileSize; UInt8 * fileDataPtr; };
typedef struct AppleCDDAXMLFileNode AppleCDDAXMLFileNode;
typedef struct AppleCDDAXMLFileNode * AppleCDDAXMLFileNodePtr;
struct AppleCDDANode
{
enum cddaNodeType nodeType; UInt32 flags; struct vnode * vNodePtr; struct vnode * blockDeviceVNodePtr; struct lock__bsd__ lock; UInt32 nodeID; struct timespec accessTime; struct timespec lastModTime; union
{
AppleCDDADirectoryNode directory;
AppleCDDAFileNode file;
AppleCDDAXMLFileNode xmlFile;
} u;
};
typedef struct AppleCDDANode AppleCDDANode;
typedef struct AppleCDDANode * AppleCDDANodePtr;
#define VFSTOCDDA(mp) ((AppleCDDAMountPtr)((mp)->mnt_data))
#define VTOCDDA(vp) ((AppleCDDANodePtr)(vp)->v_data)
#define CDDATOV(cddaNodePtr) ((cddaNodePtr)->vNodePtr)
#define CDDATONODEINFO(cddaNodePtr) ((cddaNodePtr)->nodeInfoPtr)
#define VFSTONODEINFO(mp) ((AppleCDDANodeInfoPtr)((AppleCDDAMountPtr)((mp)->mnt_data))->nodeInfoArrayPtr)
#endif
#ifdef __cplusplus
}
#endif
#endif // __APPLE_CDDA_FS_DEFINES_H__