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/mount.h>
#include <sys/stat.h>
#include <sys/attr.h>
#include <libkern/OSTypes.h>
#if KERNEL
#include <sys/systm.h>
#endif
enum
{
kPreEmphasisBit = 0,
kDigitalDataBit = 2
};
enum
{
kPreEmphasisMask = ( 1 << kPreEmphasisBit ),
kDigitalDataMask = ( 1 << kDigitalDataBit )
};
enum
{
kSecondsPerMinute = 60,
kFramesPerSecond = 75,
kMSFToLBA = (kFramesPerSecond << 1) };
enum cddaNodeType
{
kAppleCDDADirectoryType = 1,
kAppleCDDATrackType = 2,
kAppleCDDAXMLFileType = 3
};
enum
{
kAppleCDDANumberOfFileReferences = 1,
kAppleCDDANumberOfRootDirReferences = 2
};
enum
{
kAppleCDDANodeBusyBit = 0,
kAppleCDDANodeWantedBit = 1,
kAppleCDDANodeBusyMask = ( 1 << kAppleCDDANodeBusyBit ),
kAppleCDDANodeWantedMask = ( 1 << kAppleCDDANodeWantedBit )
};
enum
{
kAppleCDDAXMLFileID = 3
};
enum
{
kUnknownUserID = 99,
kUnknownGroupID = 99
};
enum
{
kCDDAMaxFileNameBytes = 3 * 255
};
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;
enum
{
kAppleCDDACommonAttributesValidMask = ATTR_CMN_NAME | ATTR_CMN_DEVID | ATTR_CMN_FSID |
ATTR_CMN_OBJTYPE | ATTR_CMN_OBJTAG | ATTR_CMN_OBJID |
ATTR_CMN_OBJPERMANENTID | ATTR_CMN_PAROBJID | ATTR_CMN_SCRIPT |
ATTR_CMN_CRTIME | ATTR_CMN_MODTIME | ATTR_CMN_CHGTIME |
ATTR_CMN_ACCTIME | ATTR_CMN_BKUPTIME | ATTR_CMN_FNDRINFO |
ATTR_CMN_OWNERID | ATTR_CMN_GRPID | ATTR_CMN_ACCESSMASK |
ATTR_CMN_FLAGS | ATTR_CMN_USERACCESS,
kAppleCDDAVolumeAttributesValidMask = ATTR_VOL_FSTYPE | ATTR_VOL_SIGNATURE | ATTR_VOL_SIZE |
ATTR_VOL_SPACEFREE | ATTR_VOL_SPACEAVAIL |
ATTR_VOL_MINALLOCATION | ATTR_VOL_ALLOCATIONCLUMP |
ATTR_VOL_IOBLOCKSIZE | ATTR_VOL_OBJCOUNT | ATTR_VOL_FILECOUNT |
ATTR_VOL_DIRCOUNT | ATTR_VOL_MAXOBJCOUNT |
ATTR_VOL_MOUNTPOINT | ATTR_VOL_NAME | ATTR_VOL_MOUNTFLAGS |
ATTR_VOL_MOUNTEDDEVICE | ATTR_VOL_ENCODINGSUSED |
ATTR_VOL_CAPABILITIES | ATTR_VOL_ATTRIBUTES | ATTR_VOL_INFO,
kAppleCDDADirectoryAttributesValidMask = ATTR_DIR_LINKCOUNT | ATTR_DIR_ENTRYCOUNT | ATTR_DIR_MOUNTSTATUS,
kAppleCDDAFileAttributesValidMask = ATTR_FILE_LINKCOUNT | ATTR_FILE_TOTALSIZE | ATTR_FILE_ALLOCSIZE |
ATTR_FILE_IOBLOCKSIZE | ATTR_FILE_CLUMPSIZE | ATTR_FILE_DEVTYPE |
ATTR_FILE_DATALENGTH | ATTR_FILE_DATAALLOCSIZE |
ATTR_FILE_RSRCLENGTH | ATTR_FILE_RSRCALLOCSIZE,
kAppleCDDAForkAttributesValidMask = 0x00000000
};
enum
{
kAppleCDDAFileSystemVolumeSignature = 0x4244, kAppleCDDAFileSystemVCBFSID = 0x4A48 };
struct SubQTOCInfo
{
UInt8 sessionNumber;
#if defined(__BIG_ENDIAN__)
UInt8 address:4;
UInt8 control:4;
#elif defined(__LITTLE_ENDIAN__)
UInt8 control:4;
UInt8 address:4;
#else
#error Unknown byte order
#endif
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
{
#ifndef KERNEL
char * device; #endif
UInt8 numTracks; UInt32 nameDataSize; char * nameData; UInt32 xmlFileSize; UInt8 * xmlData; UInt32 fileType; UInt32 fileCreator; };
typedef struct AppleCDDAArguments AppleCDDAArguments;
#if KERNEL
struct UserAppleCDDAArguments
{
UInt8 numTracks; UInt32 nameDataSize; user_addr_t nameData; UInt32 xmlFileSize; user_addr_t xmlData; UInt32 fileType; UInt32 fileCreator; };
typedef struct UserAppleCDDAArguments UserAppleCDDAArguments;
typedef struct UserAppleCDDAArguments * UserAppleCDDAArgumentsPtr;
struct AppleCDDANodeInfo
{
vnode_t vNodePtr; UInt8 nameSize; char * name; SubQTOCInfo trackDescriptor; UInt32 LBA; UInt32 numBytes; UInt32 flags; };
typedef struct AppleCDDANodeInfo AppleCDDANodeInfo;
typedef struct AppleCDDANodeInfo * AppleCDDANodeInfoPtr;
struct AppleCDDAMount
{
vnode_t root; UInt32 rootVID; vnode_t xmlFileVNodePtr; UInt32 xmlFileFlags; UInt32 nameDataSize; UInt8 * nameData; AppleCDDANodeInfoPtr nodeInfoArrayPtr; lck_grp_t * cddaMountLockGroup; lck_grp_attr_t * cddaMountLockGroupAttr; lck_mtx_t * cddaMountLock; lck_attr_t * cddaMountLockAttr; UInt8 numTracks; struct timespec mountTime; UInt32 xmlDataSize; UInt8 * xmlData; UInt32 fileType; UInt32 fileCreator; };
typedef struct AppleCDDAMount AppleCDDAMount;
typedef struct AppleCDDAMount * AppleCDDAMountPtr;
struct AppleCDDADirectoryNode
{
UInt32 entryCount; UInt64 directorySize; };
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; vnode_t vNodePtr; vnode_t blockDeviceVNodePtr; UInt32 nodeID; union
{
AppleCDDADirectoryNode directory;
AppleCDDAFileNode file;
AppleCDDAXMLFileNode xmlFile;
} u;
};
typedef struct AppleCDDANode AppleCDDANode;
typedef struct AppleCDDANode * AppleCDDANodePtr;
#define VFSTOCDDA(mp) ((AppleCDDAMountPtr)(vfs_fsprivate(mp)))
#define VTOCDDA(vp) ((AppleCDDANodePtr)(vnode_fsnode(vp)))
#define CDDATOV(cddaNodePtr) ((cddaNodePtr)->vNodePtr)
#define CDDATONODEINFO(cddaNodePtr) ((cddaNodePtr)->u.file.nodeInfoPtr)
#define VFSTONODEINFO(mp) ((AppleCDDANodeInfoPtr)((AppleCDDAMountPtr)(vfs_fsprivate(mp)))->nodeInfoArrayPtr)
#define VFSTONAMEINFO(mp) ((UInt8 *)((AppleCDDAMountPtr)(vfs_fsprivate(mp)))->nameData)
#define VFSTOXMLDATA(mp) ((UInt8 *)((AppleCDDAMountPtr)(vfs_fsprivate(mp)))->xmlData)
#endif
#ifdef __cplusplus
}
#endif
#endif // __APPLE_CDDA_FS_DEFINES_H__