X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/1c79356b52d46aa6b508fb032f5ae709b1f2897b..21362eb3e66fd2c787aee132bce100a44d71a99c:/bsd/isofs/cd9660/iso.h diff --git a/bsd/isofs/cd9660/iso.h b/bsd/isofs/cd9660/iso.h index 7e6f702c9..31e37c0e4 100644 --- a/bsd/isofs/cd9660/iso.h +++ b/bsd/isofs/cd9660/iso.h @@ -1,23 +1,29 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* $NetBSD: iso.h,v 1.9 1995/01/18 09:23:19 mycroft Exp $ */ @@ -63,6 +69,9 @@ #ifndef _ISO_H_ #define _ISO_H_ +#include + +#ifdef __APPLE_API_PRIVATE #define ISODCL(from, to) (to - from + 1) struct iso_volume_descriptor { @@ -92,6 +101,8 @@ struct iso_volume_descriptor { #define UCS_SEPARATOR1 0x002e #define UCS_SEPARATOR2 0x003b +#define ISO_DFLT_VOLUME_ID "ISO_9660_CD" + /* pathconf filename lengths */ #define ISO_NAMEMAX (31+1) #define ISO_JOLIET_NAMEMAX (64*3) @@ -119,7 +130,11 @@ struct finder_info { unsigned long fdType; unsigned long fdCreator; unsigned short fdFlags; - unsigned short fdReserved[3]; + struct { + short v; /* file's location */ + short h; + } fdLocation; + unsigned short fdReserved; }; struct iso_primary_descriptor { @@ -249,9 +264,9 @@ struct iso_mnt { int logical_block_size; int im_bshift; int im_bmask; + int im_sector_size; int volume_space_size; - struct netexport im_export; char root[ISODCL (157, 190)]; int root_extent; @@ -264,6 +279,10 @@ struct iso_mnt { struct timespec creation_date; /* needed for getattrlist */ struct timespec modification_date; /* needed for getattrlist */ u_char volume_id[32]; /* name of volume */ + struct vnode *phys_devvp; /* device for 2352-byte blocks */ + struct CDTOC *toc; /* the TOC, or NULL for none */ + int video_dir_start; /* start sector of the "MPEGAV" dir */ + int video_dir_end; /* sector following end of "MPEGAV" dir */ }; /* bit settings for iso_mnt.im_flags2 */ @@ -274,47 +293,52 @@ struct iso_mnt { */ #define IMF2_IS_CDXA 0x00000001 -#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data)) +/* CD is Video CD (version < 2.0) */ +#define IMF2_IS_VCD 0x00000002 + +#define VFSTOISOFS(mp) ((struct iso_mnt *)(vfs_fsprivate(mp))) #define blkoff(imp, loc) ((loc) & (imp)->im_bmask) #define lblktosize(imp, blk) ((blk) << (imp)->im_bshift) #define lblkno(imp, loc) ((loc) >> (imp)->im_bshift) #define blksize(imp, ip, lbn) ((imp)->logical_block_size) -int cd9660_mount __P((struct mount *, - char *, caddr_t, struct nameidata *, struct proc *)); -int cd9660_start __P((struct mount *, int, struct proc *)); -int cd9660_unmount __P((struct mount *, int, struct proc *)); -int cd9660_root __P((struct mount *, struct vnode **)); -int cd9660_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); -int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *)); -int cd9660_sync __P((struct mount *, int, struct ucred *, struct proc *)); -int cd9660_vget __P((struct mount *, void *, struct vnode **)); -int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); -int cd9660_vptofh __P((struct vnode *, struct fid *)); -int cd9660_init __P(()); +#define SECTOFF(imp, off) \ + (off_t)(((off) / (imp)->im_sector_size) * (imp)->im_sector_size) + -int cd9660_mountroot __P((void)); +int cd9660_mount(struct mount *, vnode_t, user_addr_t, vfs_context_t); +int cd9660_start(struct mount *, int, vfs_context_t); +int cd9660_unmount(struct mount *, int, vfs_context_t); +int cd9660_root(struct mount *, struct vnode **, vfs_context_t); +int cd9660_statfs(struct mount *, struct vfsstatfs *, vfs_context_t); +int cd9660_vfs_getattr(struct mount *mp, struct vfs_attr *fsap, vfs_context_t context); +int cd9660_sync(struct mount *, int, vfs_context_t); +int cd9660_vget(struct mount *, ino64_t, struct vnode **, vfs_context_t); +int cd9660_fhtovp(struct mount *, int, unsigned char *, struct vnode **, vfs_context_t); +int cd9660_vptofh(struct vnode *, int *, unsigned char *, vfs_context_t); +int cd9660_init(struct vfsconf *); +int cd9660_mountroot(mount_t, vnode_t, vfs_context_t); +int cd9660_sysctl(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t); -int cd9660_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *)); +int cd9660_vget_internal(mount_t, ino_t, vnode_t *, vnode_t, struct componentname *, + int, struct iso_directory_record *, proc_t); extern int (**cd9660_vnodeop_p)(void *); extern int (**cd9660_specop_p)(void *); #if FIFO extern int (**cd9660_fifoop_p)(void *); #endif +extern int (**cd9660_cdxaop_p)(void *); static __inline int -isonum_711(p) - u_char *p; +isonum_711(u_char *p) { return *p; } static __inline int -isonum_712(p) - char *p; +isonum_712(char *p) { return *p; } @@ -322,15 +346,13 @@ isonum_712(p) #ifndef UNALIGNED_ACCESS static __inline int -isonum_723(p) - u_char *p; +isonum_723(u_char *p) { return *p|(p[1] << 8); } static __inline int -isonum_733(p) - u_char *p; +isonum_733(u_char *p) { return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24); } @@ -340,15 +362,13 @@ isonum_733(p) #if BYTE_ORDER == LITTLE_ENDIAN static __inline int -isonum_723(p) - u_char *p +isonum_723(u_char *p) { return *(u_int16t *)p; } static __inline int -isonum_733(p) - u_char *p; +isonum_733(u_char *p) { return *(u_int32t *)p; } @@ -358,15 +378,13 @@ isonum_733(p) #if BYTE_ORDER == BIG_ENDIAN static __inline int -isonum_723(p) - u_char *p +isonum_723(u_char *p) { return *(u_int16t *)(p + 2); } static __inline int -isonum_733(p) - u_char *p; +isonum_733(u_char *p) { return *(u_int32t *)(p + 4); } @@ -375,19 +393,86 @@ isonum_733(p) #endif /* UNALIGNED_ACCESS */ -int isofncmp __P((u_char *, int, u_char *, int)); -int ucsfncmp __P((u_int16_t *, int, u_int16_t *, int)); -void isofntrans __P((u_char *, int, u_char *, u_short *, int)); -void ucsfntrans __P((u_int16_t *, int, u_char *, u_short *, int)); -ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *)); -int attrcalcsize __P((struct attrlist *attrlist)); -void packattrblk __P((struct attrlist *alist, struct vnode *vp, - void **attrbufptrptr, void **varbufptrptr)); +int isofncmp(u_char *fn, int fnlen, u_char *isofn, int isolen); +int ucsfncmp(u_int16_t *, int, u_int16_t *, int); +void isofntrans(u_char *infn, int infnlen, u_char *outfn, u_short *outfnlen, + int original, int assoc); +void ucsfntrans(u_int16_t *, int, u_char *, u_short *, int, int); +int attrcalcsize(struct attrlist *attrlist); +struct iso_node; +void packcommonattr(struct attrlist *alist, struct iso_node *ip, + void **attrbufptrptr, void **varbufptrptr); +void packdirattr(struct attrlist *alist, struct iso_node *ip, + void **attrbufptrptr, void **varbufptrptr); +void packfileattr(struct attrlist *alist, struct iso_node *ip, + void **attrbufptrptr, void **varbufptrptr); +void packattrblk(struct attrlist *alist, struct vnode *vp, + void **attrbufptrptr, void **varbufptrptr); + + +/* + * Associated files have a leading "._". + */ +#define ASSOCCHAR1 '.' +#define ASSOCCHAR2 '_' + +/* + * This header is prepended on media tracks, such as Video CD MPEG files. + */ +struct riff_header { + char riff[4]; // "RIFF" + u_int32_t fileSize; // little endian file size, not including this field or sig + char cdxa[4]; // "CDXA" + char fmt[4]; // "fmt " + u_int32_t fmtSize; // always 16 (XXX this is an assumption) + char fmtData[16]; // CDXA extension of ISO directory entry, padded to 16 bytes + char data[4]; // "data" + u_int32_t dataSize; // number of sectors * 2352, little endian +}; + +#define CDXA_SECTOR_SIZE 2352 + + +/* + * AppleDouble constants + */ +#define APPLEDOUBLE_MAGIC 0x00051607 +#define APPLEDOUBLE_VERSION 0x00020000 +#define APPLEDOUBLE_DATAFORK 1 +#define APPLEDOUBLE_RESFORK 2 +#define APPLEDOUBLE_FINDERINFO 9 /* - * Associated files have a leading '='. + * Note that 68k alignment is needed to make sure that the first + * AppleDoubleEntry (after the numEntries below) is *immediately* + * after the numEntries, and not padded by 2 bytes. + * + * Consult RFC 1740 for details on AppleSingle/AppleDouble formats. */ -#define ASSOCCHAR '=' +#pragma options align=mac68k + +struct apple_double_entry { + u_int32_t entryID; + u_int32_t offset; + u_int32_t length; +}; +typedef struct apple_double_entry apple_double_entry_t; + +struct apple_double_header { + u_int32_t magic; + u_int32_t version; + u_int8_t filler[16]; + u_int16_t count; + apple_double_entry_t entries[2]; /* FinderInfo + ResourceFork */ + struct finder_info finfo; +}; +typedef struct apple_double_header apple_double_header_t; + +#define ADH_SIZE 4096 +#define ADH_BLKS 2 + +#pragma options align=reset +#endif /* __APPLE_API_PRIVATE */ #endif /* ! _ISO_H_ */