Jump to content

FS COPY: Difference between revisions

From EDM2
Created page with "Copy a specified file or subdirectory to a specified target. ==Syntax== FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType) ==Parameters== ;..."
 
Ak120 (talk | contribs)
m sb
 
Line 1: Line 1:
Copy a specified file or subdirectory to a specified target.  
{{DISPLAYTITLE:FS_COPY}}
Copy a specified file or subdirectory to a specified target.


==Syntax==
==Syntax==
  FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType)
  FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType)
==Parameters==
==Parameters==
;flag  
;flag:Is a bit mask controlling copy
:Is a bit mask controlling copy  
:0x0001 specifies that an existing target file/directory should be replaced
 
:0x0002 specifies that a source file will be appended to the destination file.
:0x0001 specifies that an existing target file/directory should be replaced  
:All other bits are reserved.
:0x0002 specifies that a source file will be appended to the destination file .  
:(See the description of the DosCopy function call in the ''OS/2 Version 2.0 Control Program Programming Reference''.)
:All other bits are reserved.  
;pcdfsi:Is a pointer to the file-system-independent working directory structure.
 
;pcdfsd:Is a pointer to the file-system-dependent working directory structure.
:(See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference.)  
;pSrc:Is a pointer to the ASCIIZ name of the source file/directory.
 
;iSrcCurDirEnd:Is the index of the end of the current directory in pSrc. If = -1, there is no current directory relevant to the source name.
;pcdfsi  
;pDst:Is a pointer to the ASCIIZ name of the destination file/directory.
:Is a pointer to the file-system-independent working directory structure.  
;iDstCurDirEnd:Is the index of the end of the current directory in pDst. If = -1, there is no current directory relevant to the destination name.
 
;nameType:Indicates the destination name type.
;pcdfsd  
:NameType == 0x0040 indicates non-8.3 filename format. All other values are reserved.
:Is a pointer to the file-system-dependent working directory structure .  
 
;pSrc  
:Is a pointer to the ASCIIZ name of the source file/directory.  


;iSrcCurDirEnd
==Calling Sequence==
:Is the index of the end of the current directory in pSrc. If = -1, there is no current directory relevant to the source name. 
 
;pDst
:Is a pointer to the ASCIIZ name of the destination file/directory. 
 
;iDstCurDirEnd
:Is the index of the end of the current directory in pDst. If = -1, there is no current directory relevant to the destination name. 
 
;nameType
:Indicates the destination name type. 
:NameType == 0x0040 indicates non-8.3 filename format. All other values are reserved.
==Returns==
==Sample==
Calling Sequence
<PRE>
<PRE>
int far pascal FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst,
int far pascal FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst,
Line 48: Line 32:
char far * pDst; unsigned short iDstCurDirEnd;
char far * pDst; unsigned short iDstCurDirEnd;
unsigned short nameType;
unsigned short nameType;
</PRE>


</PRE>
==Remarks==
==Remarks==
The file specified in the source file name should be copied to the target file if possible.  
The file specified in the source file name should be copied to the target file if possible.


The files specified may not be currently open. File system drivers must assure consistency of file allocation information and directory entries.  
The files specified may not be currently open. File system drivers must assure consistency of file allocation information and directory entries.


The file system driver returns the special CANNOT COPY error if it cannot perform the copy because:  
The file system driver returns the special CANNOT COPY error if it cannot perform the copy because:
*it does not know how
*the source and target are on different volumes
*of any other reason for which it would make sense for its caller to perform the copy operation manually.
Returning ERROR_CANNOT_COPY indicates to its caller that it should attempt to perform the copy operation manually. Any other error will be returned directly to the caller of DosCopy. See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference for other error codes that can be returned.


oit does not know how
FS_COPY needs to check that certain types of illegal copying operations are not performed. A directory cannot be copied to itself or to one of its subdirectories. This is especially critical in situations where two different fully- qualified pathnames can refer to the same file or directory. For example, if X: is redirected to \\SERVER\SHARE, the X:\PATH and \\ SERVER\SHARE\PATH refer to the same object.
othe source and target are on different volumes
oof any other reason for which it would make sense for its caller to perform the copy operation manually.  


Returning ERROR_CANNOT_COPY indicates to its caller that it should attempt to perform the copy operation manually. Any other error will be returned directly to the caller of DosCopy. See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference for other error codes that can be returned.  
The behavior of FS_COPY should match the behavior of the generic DosCopy routine.


FS_COPY needs to check that certain types of illegal copying operations are not performed. A directory cannot be copied to itself or to one of its subdirectories. This is especially critical in situations where two different fully- qualified pathnames can refer to the same file or directory. For example, if X: is redirected to \\SERVER\SHARE, the X:\PATH and \\ SERVER\SHARE\PATH refer to the same object. 
The non-8.3 filename format attribute in the directory entry for the destination name should be set according to the value in nameType.
 
The behavior of FS_COPY should match the behavior of the generic DosCopy routine. 
 
The non-8.3 filename format attribute in the directory entry for the destination name should be set according to the value in nameType.  


[[Category:IFS Interfaces]]
[[Category:IFS Interfaces]]
{{DISPLAYTITLE:FS_COPY}}

Latest revision as of 01:37, 9 February 2020

Copy a specified file or subdirectory to a specified target.

Syntax

FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst, iDstCurDirEnd, nameType)

Parameters

flag
Is a bit mask controlling copy
0x0001 specifies that an existing target file/directory should be replaced
0x0002 specifies that a source file will be appended to the destination file.
All other bits are reserved.
(See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference.)
pcdfsi
Is a pointer to the file-system-independent working directory structure.
pcdfsd
Is a pointer to the file-system-dependent working directory structure.
pSrc
Is a pointer to the ASCIIZ name of the source file/directory.
iSrcCurDirEnd
Is the index of the end of the current directory in pSrc. If = -1, there is no current directory relevant to the source name.
pDst
Is a pointer to the ASCIIZ name of the destination file/directory.
iDstCurDirEnd
Is the index of the end of the current directory in pDst. If = -1, there is no current directory relevant to the destination name.
nameType
Indicates the destination name type.
NameType == 0x0040 indicates non-8.3 filename format. All other values are reserved.

Calling Sequence

int far pascal FS_COPY(flag, pcdfsi, pcdfsd, pSrc, iSrcCurDirEnd, pDst,
                       iDstCurDirEnd, nameType)

unsigned short flag;
struct cdfsi far * pcdfsi;
struct cdfsd far * pcdfsd;
char far * pSrc;
unsigned short iSrcCurDirEnd;
char far * pDst; unsigned short iDstCurDirEnd;
unsigned short nameType;

Remarks

The file specified in the source file name should be copied to the target file if possible.

The files specified may not be currently open. File system drivers must assure consistency of file allocation information and directory entries.

The file system driver returns the special CANNOT COPY error if it cannot perform the copy because:

  • it does not know how
  • the source and target are on different volumes
  • of any other reason for which it would make sense for its caller to perform the copy operation manually.

Returning ERROR_CANNOT_COPY indicates to its caller that it should attempt to perform the copy operation manually. Any other error will be returned directly to the caller of DosCopy. See the description of the DosCopy function call in the OS/2 Version 2.0 Control Program Programming Reference for other error codes that can be returned.

FS_COPY needs to check that certain types of illegal copying operations are not performed. A directory cannot be copied to itself or to one of its subdirectories. This is especially critical in situations where two different fully- qualified pathnames can refer to the same file or directory. For example, if X: is redirected to \\SERVER\SHARE, the X:\PATH and \\ SERVER\SHARE\PATH refer to the same object.

The behavior of FS_COPY should match the behavior of the generic DosCopy routine.

The non-8.3 filename format attribute in the directory entry for the destination name should be set according to the value in nameType.