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 struct CopyParams CopyParams
typedef struct FilterParams FilterParams
typedef struct ForkTracker ForkTracker
typedef ForkTrackerForkTrackerPtr
typedef struct FolderListData FolderListData
typedef struct FSCopyFolderGlobals FSCopyFolderGlobals
typedef struct
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.

Definition at line 154 of file FSCopyObject.c.

typedef struct ForkTracker ForkTracker

Definition at line 142 of file FSCopyObject.c.

Definition at line 143 of file FSCopyObject.c.

Definition at line 177 of file FSCopyObject.c.

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().

Here is the caller graph for this function:

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

Definition at line 1382 of file FSCopyObject.c.

References BufferSizeForVolSpeed(), and mycheck.

Referenced by FSCopyObjectPreflight().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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 CopyParams::volHasCopyFile.

Referenced by CopyFolder(), and FSCopyFile().

Here is the call graph for this function:

Here is the caller graph for this function:

static OSErr CopyFolder ( FSCopyFolderGlobals folderGlobals  )  [static]

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

Definition at line 1111 of file FSCopyObject.c.

References CopyForksToDisk(), CopyForksToDropBox(), CopyParams::copyingToDropFolder, and mycheck_noerr.

Referenced by DoCopyFile(), and DoCreateFolder().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1126 of file FSCopyObject.c.

References CopyParams::copyingToLocalVolume, mycheck_noerr, myverify_noerr, NULL, and WriteFork().

Referenced by CopyForks().

Here is the call graph for this function:

Here is the caller graph for this function:

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(), and WriteFork().

Referenced by CopyForks().

Here is the call graph for this function:

Here is the caller graph for this function:

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 CopyParams::copyingToDropFolder, DoCreateFolder(), mycheck_noerr, and NULL.

Referenced by CopyFolder().

Here is the call graph for this function:

Here is the caller graph for this function:

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(), CopyParams::copyingToDropFolder, FSDeleteObjects(), kRWXUserAccessMask, mycheck_noerr, myverify_noerr, and NULL.

Referenced by CopyFile().

Here is the call graph for this function:

Here is the caller graph for this function:

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, and NULL.

Referenced by CreateFolder(), and FSCopyFolder().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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 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 
)

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]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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, and FSDeleteObjectGlobals::result.

Referenced by FSDeleteFolder().

Here is the caller graph for this function:

OSErr FSDeleteObjects ( const FSRef *  source  ) 

Definition at line 1446 of file FSCopyObject.c.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static OSErr GetMagicBusyCreateDate ( UTCDateTime *  date  )  [static]

Definition at line 1621 of file FSCopyObject.c.

References mycheck_noerr, and NULL.

Referenced by FSCopyFolder().

Here is the caller graph for this function:

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

Definition at line 1873 of file FSCopyObject.c.

References NULL.

Referenced by FSCopyObject().

Here is the caller graph for this function:

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

Definition at line 1832 of file FSCopyObject.c.

Referenced by SetupDestination().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

static pascal void MyCloseForkProc ( void *  pData  )  [static]

Definition at line 1974 of file FSCopyObject.c.

References myverify_noerr, and NULL.

Referenced by CopyForksToDropBox().

Here is the caller graph for this function:

static pascal void MyDisposeDataProc ( void *  pData  )  [static]

Definition at line 1964 of file FSCopyObject.c.

References NULL.

Referenced by CopyFolder(), and FSCopyFolder().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static OSErr ProcessFolderList ( FSCopyFolderGlobals folderGlobals  )  [static]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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 CopyParams::copyBuffer, CopyParams::copyBufferSize, CopyParams::copyingToLocalVolume, and NULL.

Referenced by CopyForksToDisk(), and CopyForksToDropBox().

Here is the caller graph for this function:


Generated on Fri May 16 08:36:14 2008 for SecondLife by  doxygen 1.5.5