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 <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
{
kAppleCDDAAccessedBit = 0
};
enum
{
kAppleCDDAAccessedMask = ( 1 << kAppleCDDAAccessedBit )
};
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;
#ifndef VOL_CAP_FMT_JOURNAL
#define VOL_CAP_FMT_JOURNAL 0x00000008
#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
#define VOL_CAP_FMT_SPARSE_FILES 0x00000040
#define VOL_CAP_FMT_ZERO_RUNS 0x00000080
#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
#define VOL_CAP_FMT_FAST_STATFS 0x00000400
#endif
#ifndef VOL_CAP_INT_EXCHANGEDATA
#define VOL_CAP_INT_EXCHANGEDATA 0x00000010
#define VOL_CAP_INT_COPYFILE 0x00000020
#define VOL_CAP_INT_ALLOCATE 0x00000040
#define VOL_CAP_INT_VOL_RENAME 0x00000080
#define VOL_CAP_INT_ADVLOCK 0x00000100
#define VOL_CAP_INT_FLOCK 0x00000200
#endif
#ifndef ATTR_VOL_VCBFSID
#define ATTR_VOL_VCBFSID 0x00040000
#endif
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_VCBFSID |
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
{
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)
#define VFSTONAMEINFO(mp) ((UInt8 *)((AppleCDDAMountPtr)((mp)->mnt_data))->nameData)
#endif
#ifdef __cplusplus
}
#endif
#endif // __APPLE_CDDA_FS_DEFINES_H__