1/* 2 * Copyright (c) 1999-2004 Apple Computer, 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#if !defined(__FS_FORMATNAME__) 24#define __FS_FORMATNAME__ 1 25 26#include "FSPrivate.h" 27 28#include "bootsect.h" // for MSDOS 29#include "bpb.h" 30 31#include <CoreFoundation/CFBundle.h> 32#include <CoreFoundation/CFDictionary.h> 33#include <CoreFoundation/CFNumber.h> 34#include <CoreFoundation/CFPriv.h> 35#include <libkern/OSAtomic.h> // for OSSpinLock 36#include <sys/mount.h> // for struct statfs 37#include <unistd.h> 38#include <stdlib.h> 39#include <string.h> 40#include <fcntl.h> 41#include <stdio.h> 42#include <hfs/hfs_format.h> // for HFS 43 44/* Currently HFS has maximum subtypes (5) */ 45#define MAX_FS_SUBTYPES 5 46 47/* Maximun length of f_fstypename in /System/Library/Filesystem/ */ 48#define MAX_FSNAME 10 49 50#define kFSSystemLibraryFileSystemsPath CFSTR("/System/Library/Filesystems") 51#define KEY_FS_PERSONALITIES CFSTR("FSPersonalities") 52#define KEY_FS_SUBTYPE CFSTR("FSSubType") 53#define KEY_FS_NAME CFSTR("FSName") 54#define UNKNOWN_FS_NAME CFSTR("Unknown") 55 56 57/* HFS type and subtype number */ 58#define HFS_NAME "hfs" 59enum { 60 kHFSPlusSubType = 0, /* HFS Plus */ 61 kHFSJSubType = 1, /* HFS Journaled */ 62 kHFSXSubType = 2, /* HFS Case-sensitive */ 63 kHFSXJSubType = 3, /* HFS Case-sensitive, Journaled */ 64 kHFSSubType = 128 /* HFS */ 65}; 66#define MAX_HFS_BLOCK_READ 512 67 68/* MSDOS type and subtype number */ 69#define MSDOS_NAME "msdos" 70enum { 71 kFAT12SubType = 0, /* FAT 12 */ 72 kFAT16SubType = 1, /* FAT 16 */ 73 kFAT32SubType = 2, /* FAT 32 */ 74}; 75#define MAX_DOS_BLOCKSIZE 2048 76 77/* Internal function */ 78CFStringRef FSCopyFormatNameForFSType(CFStringRef fsType, int16_t fsSubtype, bool localized, bool encrypted); 79bool getfstype(char *devnode, char *fsname, int *fssubtype); 80bool is_hfs(char *devnode, int *fssubtype); 81bool is_msdos(char *devnode, int *fssubtype); 82static int getblk(int fd, unsigned long blk, int blksize, char* buf); 83static int getwrapper(const HFSMasterDirectoryBlock *mdbp, off_t *offset); 84 85#endif /* !__FS_FORMATNAME__ */ 86