FSCopyObject.c File Reference

#include "FSCopyObject.h"
#include "GenLinkedList.h"
#include <UnicodeConverter.h>
#include <stddef.h>
#include <string.h>

Include dependency graph for FSCopyObject.c:

Go to the source code of this file.

Classes

struct  CopyParams
struct  FilterParams
struct  ForkTracker
struct  FolderListData
struct  FSCopyFolderGlobals
struct  FSDeleteObjectGlobals

Defines

#define kNumObjects   80
#define VolHasCopyFile(volParms)   (((volParms)->vMAttrib & (1L << bHasCopyFile)) != 0)

Typedefs

typedef CopyParams CopyParams
typedef FilterParams FilterParams
typedef ForkTracker ForkTracker
typedef ForkTrackerForkTrackerPtr
typedef FolderListData FolderListData
typedef FSCopyFolderGlobals FSCopyFolderGlobals
typedef FSDeleteObjectGlobals FSDeleteObjectGlobals

Enumerations

enum  { kDefaultCopyBufferSize = 256L * 1024, kMaximumCopyBufferSize = 2L * 1024 * 1024, kMinimumCopyBufferSize = 1024 }
enum  { errFSDestInsideSource = -1234 }
enum  {
  kPrivilegesMask = kioACAccessUserWriteMask | kioACAccessUserReadMask | kioACAccessUserSearchMask, kRWXUserAccessMask = 0x01C0, kReadAccessUser = 0x0100, kWriteAccessUser = 0x0080,
  kExecuteAccessUser = 0x0040, kRWXGroupAccessMask = 0x0038, kReadAccessGroup = 0x0020, kWriteAccessGroup = 0x0010,
  kExecuteAccessGroup = 0x0008, kRWXOtherAccessMask = 0x0007, kReadAccessOther = 0x0004, kWriteAccessOther = 0x0002,
  kExecuteAccessOther = 0x0001, kDropFolderValue = kWriteAccessOther | kExecuteAccessOther
}

Functions

static OSErr FSCopyObjectPreflight (const FSRef *source, const FSRef *destDir, const DupeAction dupeAction, FSCatalogInfo *sourceCatInfo, CopyParams *copyParams, HFSUniStr255 *newObjectName, FSRef *deleteMeRef, Boolean *isReplacing, Boolean *isDirectory)
static OSErr FSCopyFile (const FSRef *source, const FSRef *destDir, const FSCatalogInfo *sourceCatInfo, const HFSUniStr255 *newFileName, CopyParams *copyParams, FilterParams *filterParams, FSRef *newFileRef, FSSpec *newFileSpec)
static OSErr CopyFile (const FSRef *source, FSCatalogInfo *sourceCatInfo, const FSRef *destDir, const HFSUniStr255 *destName, CopyParams *copyParams, FSRef *newRef, FSSpec *newSpec)
static OSErr FSUsePBHCopyFile (const FSRef *srcFileRef, const FSRef *dstDirectoryRef, const HFSUniStr255 *destName, TextEncoding textEncodingHint, FSRef *newRef, FSSpec *newSpec)
static OSErr DoCopyFile (const FSRef *source, FSCatalogInfo *sourceCatInfo, const FSRef *destDir, const HFSUniStr255 *destName, CopyParams *params, FSRef *newRef, FSSpec *newSpec)
static OSErr FSCopyFolder (const FSRef *source, const FSRef *destDir, const FSCatalogInfo *sourceCatInfo, const HFSUniStr255 *newFoldName, CopyParams *copyParams, FilterParams *filterParams, ItemCount maxLevels, FSRef *outDirRef, FSSpec *outDirSpec)
static OSErr ProcessFolderList (FSCopyFolderGlobals *folderGlobals)
static OSErr CopyFolder (FSCopyFolderGlobals *folderGlobals)
static OSErr CheckForDestInsideSrc (const FSRef *source, const FSRef *destDir)
static OSErr CopyForks (const FSRef *source, const FSRef *dest, CopyParams *params)
static OSErr CopyForksToDisk (const FSRef *source, const FSRef *dest, CopyParams *params)
static OSErr CopyForksToDropBox (const FSRef *source, const FSRef *dest, CopyParams *params)
static OSErr OpenAllForks (const FSRef *dest, GenLinkedList *forkList)
static OSErr WriteFork (const SInt16 srcRefNum, const SInt16 destRefNum, const CopyParams *params, const SInt64 forkSize)
static UInt32 CalcBufferSizeForVol (const GetVolParmsInfoBuffer *volParms, UInt32 volParmsSize)
static UInt32 BufferSizeForVolSpeed (UInt32 volumeBytesPerSecond)
static OSErr FSDeleteFolder (const FSRef *container)
static void FSDeleteFolderLevel (const FSRef *container, FSDeleteObjectGlobals *theGlobals)
static OSErr IsDropBox (const FSRef *source, Boolean *isDropBox)
static OSErr GetMagicBusyCreateDate (UTCDateTime *date)
static OSErr FSGetVRefNum (const FSRef *ref, FSVolumeRefNum *vRefNum)
static OSErr FSGetVolParms (FSVolumeRefNum volRefNum, UInt32 bufferSize, GetVolParmsInfoBuffer *volParmsInfo, UInt32 *actualInfoSize)
static OSErr UniStrToPStr (const HFSUniStr255 *uniStr, TextEncoding textEncodingHint, Boolean isVolumeName, Str255 pStr)
static OSErr FSMakeFSRef (FSVolumeRefNum volRefNum, SInt32 dirID, ConstStr255Param name, FSRef *ref)
static OSErr SetupDestination (const FSRef *destDir, const DupeAction dupeAction, HFSUniStr255 *sourceName, FSRef *deleteMeRef, Boolean *isReplacing)
static OSErr GetUniqueName (const FSRef *destDir, HFSUniStr255 *sourceName)
static OSErr GetObjectName (const FSRef *sourceRef, HFSUniStr255 *sourceName, TextEncoding *sourceEncoding)
static OSErr CreateFolder (const FSRef *sourceRef, const FSRef *destDirRef, const FSCatalogInfo *catalogInfo, const HFSUniStr255 *folderName, CopyParams *params, FSRef *newFSRefPtr, FSSpec *newFSSpecPtr)
static OSErr DoCreateFolder (const FSRef *sourceRef, const FSRef *destDirRef, const FSCatalogInfo *catalogInfo, const HFSUniStr255 *folderName, CopyParams *params, FSRef *newFSRefPtr, FSSpec *newFSSpecPtr)
static pascal void MyDisposeDataProc (void *pData)
static pascal void MyCloseForkProc (void *pData)
OSErr FSCopyObject (const FSRef *source, const FSRef *destDir, ItemCount maxLevels, FSCatalogInfoBitmap whichInfo, DupeAction dupeAction, const HFSUniStr255 *newObjectName, Boolean wantFSSpec, Boolean wantName, CopyObjectFilterProcPtr filterProcPtr, void *yourDataPtr, FSRef *newObjectRef, FSSpec *newObjectSpec)
OSErr FSDeleteObjects (const FSRef *source)


Define Documentation

#define kNumObjects   80

Definition at line 99 of file FSCopyObject.c.

Referenced by CopyFolder(), and FSCopyFolder().

#define VolHasCopyFile ( volParms   )     (((volParms)->vMAttrib & (1L << bHasCopyFile)) != 0)

Definition at line 101 of file FSCopyObject.c.

Referenced by FSCopyFile(), and FSCopyObjectPreflight().


Typedef Documentation

typedef struct CopyParams CopyParams

Definition at line 116 of file FSCopyObject.c.

typedef struct FilterParams FilterParams

Definition at line 129 of file FSCopyObject.c.

typedef struct FolderListData FolderListData

Definition at line 154 of file FSCopyObject.c.

typedef struct ForkTracker ForkTracker

Definition at line 142 of file FSCopyObject.c.

typedef ForkTracker* ForkTrackerPtr

Definition at line 143 of file FSCopyObject.c.

typedef struct FSCopyFolderGlobals FSCopyFolderGlobals

Definition at line 177 of file FSCopyObject.c.

typedef struct FSDeleteObjectGlobals FSDeleteObjectGlobals

Definition at line 187 of file FSCopyObject.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
kDefaultCopyBufferSize 
kMaximumCopyBufferSize 
kMinimumCopyBufferSize 

Definition at line 60 of file FSCopyObject.c.

anonymous enum

Enumerator:
errFSDestInsideSource 

Definition at line 67 of file FSCopyObject.c.

anonymous enum

Enumerator:
kPrivilegesMask 
kRWXUserAccessMask 
kReadAccessUser 
kWriteAccessUser 
kExecuteAccessUser 
kRWXGroupAccessMask 
kReadAccessGroup 
kWriteAccessGroup 
kExecuteAccessGroup 
kRWXOtherAccessMask 
kReadAccessOther 
kWriteAccessOther 
kExecuteAccessOther 
kDropFolderValue 

Definition at line 71 of file FSCopyObject.c.


Function Documentation

static UInt32 BufferSizeForVolSpeed ( UInt32  volumeBytesPerSecond  )  [static]

Definition at line 1418 of file FSCopyObject.c.

References kDefaultCopyBufferSize, kMaximumCopyBufferSize, and kMinimumCopyBufferSize.

Referenced by CalcBufferSizeForVol().

static UInt32 CalcBufferSizeForVol ( const GetVolParmsInfoBuffer *  volParms,
UInt32  volParmsSize 
) [static]

Definition at line 1382 of file FSCopyObject.c.

References BufferSizeForVolSpeed(), and mycheck.

Referenced by FSCopyObjectPreflight().

static OSErr CheckForDestInsideSrc ( const FSRef *  source,
const FSRef *  destDir 
) [static]

Definition at line 1063 of file FSCopyObject.c.

References errFSDestInsideSource, mycheck_noerr, and NULL.

Referenced by FSCopyObject().

static OSErr CopyFile ( const FSRef *  source,
FSCatalogInfo *  sourceCatInfo,
const FSRef *  destDir,
const HFSUniStr255 *  destName,
CopyParams copyParams,
FSRef *  newRef,
FSSpec *  newSpec 
) [static]

Definition at line 597 of file FSCopyObject.c.

References DoCopyFile(), FSUsePBHCopyFile(), mycheck_noerr, and params.

Referenced by CopyFolder(), and FSCopyFile().

static OSErr CopyFolder ( FSCopyFolderGlobals folderGlobals  )  [static]

Definition at line 945 of file FSCopyObject.c.

References FSDeleteObjectGlobals::actualObjects, AddToTail(), CallCopyObjectFilterProc, FSCopyFolderGlobals::catInfoList, FilterParams::containerChanged, CopyFile(), FSCopyFolderGlobals::copyParams, CreateFolder(), FSCopyFolderGlobals::currentLevel, FolderListData::destDirRef, FSCopyFolderGlobals::destDirRef, dwarning, FSCopyFolderGlobals::filterParams, FilterParams::filterProcPtr, i, InitLinkedList(), kNumObjects, FolderListData::level, FSCopyFolderGlobals::maxLevels, MyDisposeDataProc(), FSCopyFolderGlobals::nameList, NULL, FolderListData::sourceDirRef, FSCopyFolderGlobals::sourceDirRef, FSCopyFolderGlobals::srcRefList, FilterParams::wantName, FilterParams::wantSpec, FilterParams::whichInfo, and FilterParams::yourDataPtr.

Referenced by ProcessFolderList().

static OSErr CopyForks ( const FSRef *  source,
const FSRef *  dest,
CopyParams params 
) [static]

Definition at line 1111 of file FSCopyObject.c.

References CopyForksToDisk(), CopyForksToDropBox(), mycheck_noerr, and params.

Referenced by DoCopyFile(), and DoCreateFolder().

static OSErr CopyForksToDisk ( const FSRef *  source,
const FSRef *  dest,
CopyParams params 
) [static]

Definition at line 1126 of file FSCopyObject.c.

References mycheck_noerr, myverify_noerr, NULL, params, and WriteFork().

Referenced by CopyForks().

static OSErr CopyForksToDropBox ( const FSRef *  source,
const FSRef *  dest,
CopyParams params 
) [static]

Definition at line 1190 of file FSCopyObject.c.

References DestroyList(), ForkTracker::forkDestRefNum, ForkTracker::forkName, ForkTracker::forkSize, GetData(), InitIterator(), InitLinkedList(), mycheck_noerr, MyCloseForkProc(), myverify_noerr, Next(), NULL, OpenAllForks(), params, and WriteFork().

Referenced by CopyForks().

static OSErr CreateFolder ( const FSRef *  sourceRef,
const FSRef *  destDirRef,
const FSCatalogInfo *  catalogInfo,
const HFSUniStr255 *  folderName,
CopyParams params,
FSRef *  newFSRefPtr,
FSSpec *  newFSSpecPtr 
) [static]

Definition at line 1890 of file FSCopyObject.c.

References DoCreateFolder(), mycheck_noerr, NULL, and params.

Referenced by CopyFolder().

static OSErr DoCopyFile ( const FSRef *  source,
FSCatalogInfo *  sourceCatInfo,
const FSRef *  destDir,
const HFSUniStr255 *  destName,
CopyParams params,
FSRef *  newRef,
FSSpec *  newSpec 
) [static]

Definition at line 681 of file FSCopyObject.c.

References CopyForks(), FSDeleteObjects(), kRWXUserAccessMask, mycheck_noerr, myverify_noerr, NULL, and params.

Referenced by CopyFile().

static OSErr DoCreateFolder ( const FSRef *  sourceRef,
const FSRef *  destDirRef,
const FSCatalogInfo *  catalogInfo,
const HFSUniStr255 *  folderName,
CopyParams params,
FSRef *  newFSRefPtr,
FSSpec *  newFSSpecPtr 
) [static]

Definition at line 1923 of file FSCopyObject.c.

References CopyForks(), kRWXUserAccessMask, mycheck_noerr, NULL, and params.

Referenced by CreateFolder(), and FSCopyFolder().

static OSErr FSCopyFile ( const FSRef *  source,
const FSRef *  destDir,
const FSCatalogInfo *  sourceCatInfo,
const HFSUniStr255 *  newFileName,
CopyParams copyParams,
FilterParams filterParams,
FSRef *  newFileRef,
FSSpec *  newFileSpec 
) [static]

Definition at line 547 of file FSCopyObject.c.

References CallCopyObjectFilterProc, CopyFile(), FilterParams::filterProcPtr, mycheck_noerr, NULL, FilterParams::wantName, FilterParams::wantSpec, FilterParams::whichInfo, and FilterParams::yourDataPtr.

Referenced by FSCopyObject().

static OSErr FSCopyFolder ( const FSRef *  source,
const FSRef *  destDir,
const FSCatalogInfo *  sourceCatInfo,
const HFSUniStr255 *  newFoldName,
CopyParams copyParams,
FilterParams filterParams,
ItemCount  maxLevels,
FSRef *  outDirRef,
FSSpec *  outDirSpec 
) [static]

Definition at line 790 of file FSCopyObject.c.

References AddToTail(), CallCopyObjectFilterProc, FSCopyFolderGlobals::catInfoList, CopyParams::copyingToDropFolder, FSCopyFolderGlobals::copyParams, FSCopyFolderGlobals::currentLevel, FolderListData::destDirRef, DestroyList(), DoCreateFolder(), dwarning, FSCopyFolderGlobals::filterParams, FilterParams::filterProcPtr, FSCopyFolderGlobals::folderList, FSCopyFolderGlobals::folderListIter, GetMagicBusyCreateDate(), GetNumberOfItems(), InitLinkedList(), kNumObjects, FolderListData::level, FSCopyFolderGlobals::maxLevels, mycheck_noerr, MyDisposeDataProc(), FSCopyFolderGlobals::nameList, NULL, ProcessFolderList(), FolderListData::sourceDirRef, FSCopyFolderGlobals::srcRefList, FilterParams::wantName, FilterParams::wantSpec, FilterParams::whichInfo, and FilterParams::yourDataPtr.

Referenced by FSCopyObject().

OSErr FSCopyObject ( const FSRef *  source,
const FSRef *  destDir,
ItemCount  maxLevels,
FSCatalogInfoBitmap  whichInfo,
DupeAction  dupeAction,
const HFSUniStr255 *  newObjectName,
Boolean  wantFSSpec,
Boolean  wantName,
CopyObjectFilterProcPtr  filterProcPtr,
void yourDataPtr,
FSRef *  newObjectRef,
FSSpec *  newObjectSpec 
)

Definition at line 343 of file FSCopyObject.c.

References CheckForDestInsideSrc(), CopyParams::copyBuffer, CopyParams::copyBufferSize, CopyParams::copyingToDropFolder, CopyParams::copyingToLocalVolume, CopyParams::dupeAction, dwarning, FilterParams::filterProcPtr, FSCopyFile(), FSCopyFolder(), FSCopyObjectPreflight(), FSDeleteObjects(), GetObjectName(), kDupeActionRename, kDupeActionReplace, mycheck_noerr, myverify_noerr, NULL, CopyParams::volHasCopyFile, FilterParams::wantName, FilterParams::wantSpec, FilterParams::whichInfo, and FilterParams::yourDataPtr.

Referenced by restoreObject(), and updatethreadproc().

static OSErr FSCopyObjectPreflight ( const FSRef *  source,
const FSRef *  destDir,
const DupeAction  dupeAction,
FSCatalogInfo *  sourceCatInfo,
CopyParams copyParams,
HFSUniStr255 *  newObjectName,
FSRef *  deleteMeRef,
Boolean *  isReplacing,
Boolean *  isDirectory 
) [static]

Definition at line 455 of file FSCopyObject.c.

References CalcBufferSizeForVol(), FSGetVolParms(), FSGetVRefNum(), IsDropBox(), NULL, SetupDestination(), and VolHasCopyFile.

Referenced by FSCopyObject().

static OSErr FSDeleteFolder ( const FSRef *  container  )  [static]

Definition at line 1484 of file FSCopyObject.c.

References FSDeleteFolderLevel(), mycheck_noerr, NULL, and FSDeleteObjectGlobals::result.

Referenced by FSDeleteObjects().

static void FSDeleteFolderLevel ( const FSRef *  container,
FSDeleteObjectGlobals theGlobals 
) [static]

Definition at line 1501 of file FSCopyObject.c.

References FSDeleteObjectGlobals::actualObjects, FSDeleteObjectGlobals::catalogInfo, mycheck_noerr, myverify_noerr, NULL, FSDeleteObjectGlobals::result, and void.

Referenced by FSDeleteFolder().

OSErr FSDeleteObjects ( const FSRef *  source  ) 

Definition at line 1446 of file FSCopyObject.c.

References dwarning, FSDeleteFolder(), mycheck_noerr, myverify_noerr, NULL, and void.

Referenced by DoCopyFile(), FSCopyObject(), and updatethreadproc().

static OSErr FSGetVolParms ( FSVolumeRefNum  volRefNum,
UInt32  bufferSize,
GetVolParmsInfoBuffer *  volParmsInfo,
UInt32 *  actualInfoSize 
) [static]

Definition at line 1656 of file FSCopyObject.c.

References mycheck_noerr, and NULL.

Referenced by FSCopyFile(), FSCopyObjectPreflight(), FSExchangeObjectsCompat(), and FSMoveRename().

static OSErr FSGetVRefNum ( const FSRef *  ref,
FSVolumeRefNum *  vRefNum 
) [static]

Definition at line 1638 of file FSCopyObject.c.

References mycheck_noerr, and NULL.

Referenced by FSCopyObjectPreflight().

static OSErr FSMakeFSRef ( FSVolumeRefNum  volRefNum,
SInt32  dirID,
ConstStr255Param  name,
FSRef *  ref 
) [static]

Definition at line 1757 of file FSCopyObject.c.

References mycheck_noerr, and NULL.

Referenced by FSCopyFile(), FSMakePath(), FSMoveRename(), FSResolveFileIDRef(), FSSetDefault(), and FSUsePBHCopyFile().

static OSErr FSUsePBHCopyFile ( const FSRef *  srcFileRef,
const FSRef *  dstDirectoryRef,
const HFSUniStr255 *  destName,
TextEncoding  textEncodingHint,
FSRef *  newRef,
FSSpec *  newSpec 
) [static]

Definition at line 626 of file FSCopyObject.c.

References FSMakeFSRef(), mycheck_noerr, myverify_noerr, NULL, and UniStrToPStr().

Referenced by CopyFile().

static OSErr GetMagicBusyCreateDate ( UTCDateTime *  date  )  [static]

Definition at line 1621 of file FSCopyObject.c.

References mycheck_noerr, and NULL.

Referenced by FSCopyFolder().

static OSErr GetObjectName ( const FSRef *  sourceRef,
HFSUniStr255 *  sourceName,
TextEncoding *  sourceEncoding 
) [static]

Definition at line 1873 of file FSCopyObject.c.

References NULL.

Referenced by FSCopyObject().

static OSErr GetUniqueName ( const FSRef *  destDir,
HFSUniStr255 *  sourceName 
) [static]

Definition at line 1832 of file FSCopyObject.c.

References count.

Referenced by SetupDestination().

static OSErr IsDropBox ( const FSRef *  source,
Boolean *  isDropBox 
) [static]

Definition at line 1560 of file FSCopyObject.c.

References kDropFolderValue, kPrivilegesMask, kRWXOtherAccessMask, mycheck_noerr, and NULL.

Referenced by FSCopyObjectPreflight().

static pascal void MyCloseForkProc ( void pData  )  [static]

Definition at line 1974 of file FSCopyObject.c.

References myverify_noerr, and NULL.

Referenced by CopyForksToDropBox().

static pascal void MyDisposeDataProc ( void pData  )  [static]

Definition at line 1964 of file FSCopyObject.c.

References NULL.

Referenced by CopyFolder(), and FSCopyFolder().

static OSErr OpenAllForks ( const FSRef *  dest,
GenLinkedList forkList 
) [static]

Definition at line 1238 of file FSCopyObject.c.

References AddToTail(), ForkTracker::forkDestRefNum, ForkTracker::forkName, ForkTracker::forkSize, mycheck_noerr, and NULL.

Referenced by CopyForksToDropBox().

static OSErr ProcessFolderList ( FSCopyFolderGlobals folderGlobals  )  [static]

Definition at line 902 of file FSCopyObject.c.

References CopyFolder(), FSCopyFolderGlobals::currentLevel, FSCopyFolderGlobals::destDirRef, FolderListData::destDirRef, dwarning, FSCopyFolderGlobals::folderList, FSCopyFolderGlobals::folderListIter, GetData(), InitIterator(), FolderListData::level, myverify_noerr, Next(), NULL, FSCopyFolderGlobals::sourceDirRef, and FolderListData::sourceDirRef.

Referenced by FSCopyFolder().

static OSErr SetupDestination ( const FSRef *  destDir,
const DupeAction  dupeAction,
HFSUniStr255 *  sourceName,
FSRef *  deleteMeRef,
Boolean *  isReplacing 
) [static]

Definition at line 1794 of file FSCopyObject.c.

References GetUniqueName(), kDupeActionRename, and kDupeActionReplace.

Referenced by FSCopyObjectPreflight().

static OSErr UniStrToPStr ( const HFSUniStr255 *  uniStr,
TextEncoding  textEncodingHint,
Boolean  isVolumeName,
Str255  pStr 
) [static]

Definition at line 1687 of file FSCopyObject.c.

References mycheck_noerr, myverify_noerr, and NULL.

Referenced by FSUsePBHCopyFile().

static OSErr WriteFork ( const SInt16  srcRefNum,
const SInt16  destRefNum,
const CopyParams params,
const SInt64  forkSize 
) [static]

Definition at line 1307 of file FSCopyObject.c.

References NULL, and params.

Referenced by CopyForksToDisk(), and CopyForksToDropBox().


Generated on Thu Jul 1 06:10:04 2010 for Second Life Viewer by  doxygen 1.4.7