Backing Up and Restoring POSIX File Links
A backup application can use the
BackupWrite function to recreate POSIX file links.
The
BackupRead function does not return POSIX file link data. A backup application must
maintain the link information itself. The following pseudocode presents algorithms
for backing up and restoring POSIX file link data along with other file
information.
PseudoCode Algorithm for Backing Up POSIX File Links
- Initialize and empty a list of known links.
- While there are more files to back up
- Read the disk and get the next file.
- Open the file for read.
- Call GetFileInformationByHandle() to get the
NumberOfLinks and the FileIndex.
- If the NumberOfLinks is greater than 1
- Search the list of know links looking for
the same FileIndex.
- If a match is NOT found
- add the full path of the file and the
FileIndex to the list.
- Call BackupRead() to copy all data to
your backup media.
10. Else
- Mark the data as a LINK on your backup media
11. store the full path from the list
to your backup media.
- Endif
- Else
- Call BackupRead() to copy all data to your
backup media.
- Endif
- EndWhile
PseudoCode Algorithm for Restoring POSIX File Links
- While there are more files to restore
- If the file is a LINK
- use the full path which was saved as data
to open the file.
- Initialize a WIN32_STREAM_ID structure with
dwStreamId equal to BACKUP_LINK.
- Initialize the dwStreamAttributes to 0.
- Initialize the dwStreamNameSize to 0.
- Initialize a buffer containing the full path
of the file you are restoring in UNICODE.
- Initialize the dwStreamSizeHigh to 0.
- Initialize the dwStreamSizeLow to the size
in bytes of the buffer containing the full path.
- Call BackupWrite() with the WIN32_STREAM_ID
- Call BackupWrite() with the buffer containing
the full path.
13. Else
14. Call BackupWrite() with the data stored on
your backup media.
15. Endif
16. EndWhile
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database