Libraries |
|
Cpio | Source Code |
|
|
Types | ||||
|
cpioArchive
const type: cpioArchive
-
FileSys implementation type to access a CPIO archive. File paths in a CPIO archive can be absolute (they start with a slash) or relative (they do not start with a slash). The cpio file system does not support the concept of a current working directory. The functions chdir and getcwd are not supported by the cpio file system. Absolute and relative paths in a CPIO archive can be accessed directly. Since "/" is just a normal path in a CPIO archive the root path of a cpio file system is "". Possible usages of cpio file system functions are:
getMTime(aCpioArchive, "src/drivers") # Relative path in the archive. fileType(aCpioArchive, "/usr/include") # Absolute path in the archive. fileSize(aCpioArchive, "/image") # Absolute path in the archive. readDir(aCpioArchive, "") # Return e.g.: "src" and "/" readDir(aCpioArchive, "/") # Return e.g.: "usr" and "image"
Function Summary | |||||
fileSys |
| ||||
fileSys |
| ||||
void |
| ||||
array string |
| ||||
array string |
| ||||
fileType |
| ||||
fileType |
| ||||
fileMode |
| ||||
void |
| ||||
integer |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
fileMode |
| ||||
time |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
file |
|
Function Detail |
openCpio
const func fileSys: openCpio (inout file: cpioFile)
-
Open a CPIO archive with the given cpioFile.
- Parameters:
- cpioFile - File that contains a CPIO archive.
- Returns:
- a file system that accesses the CPIO archive, or fileSys.value if it could not be opened.
openCpio
const func fileSys: openCpio (in string: cpioFileName)
-
Open a CPIO archive with the given cpioFileName.
- Parameters:
- cpioFileName - Name of the CPIO archive to be opened.
- Returns:
- a file system that accesses the CPIO archive, or fileSys.value if it could not be opened.
close
const proc: close (inout cpioArchive: cpio)
-
Close a CPIO archive. The CPIO file below stays open.
readDir
const func array string: readDir (inout cpioArchive: cpio, in string: dirPath)
-
Determine the file names in a directory inside a CPIO archive. Note that the function returns only the file names. Additional information must be obtained with other calls.
- Parameters:
- cpio - Open CPIO archive.
- dirPath - Path of a directory in the CPIO archive.
- Returns:
- an array with the file names.
- Raises:
- RANGE_ERROR - dirPath does not use the standard path representation.
- FILE_ERROR - dirPath is not present in the CPIO archive.
readDir
const func array string: readDir (inout cpioArchive: cpio, RECURSIVE)
-
Determine the file paths in a CPIO archive. Note that the function returns only the file paths. Additional information must be obtained with other calls.
- Parameters:
- cpio - Open CPIO archive.
- Returns:
- an array with the file paths.
fileType
const func fileType: fileType (inout cpioArchive: cpio, in var string: filePath)
-
Determine the type of a file in a CPIO archive. The function follows symbolic links. If the chain of symbolic links is too long the function returns FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.
- Returns:
- the type of the file.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
fileTypeSL
const func fileType: fileTypeSL (inout cpioArchive: cpio, in string: filePath)
-
Determine the type of a file in a CPIO archive. The function does not follow symbolic links. Therefore it may return FILE_SYMLINK. A return value of FILE_ABSENT does not imply that a file with this name can be created, since missing directories and invalid file names cause also FILE_ABSENT.
- Returns:
- the type of the file.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
getFileMode
const func fileMode: getFileMode (inout cpioArchive: cpio, in string: filePath)
-
Determine the file mode (permissions) of a file in a CPIO archive. The function follows symbolic links.
- Returns:
- the file mode.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
setFileMode
const proc: setFileMode (inout cpioArchive: cpio, in string: filePath, in fileMode: mode)
-
Change the file mode (permissions) of a file in a CPIO archive. The function follows symbolic links.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
fileSize
const func integer: fileSize (inout cpioArchive: cpio, in string: filePath)
-
Determine the size of a file in a CPIO archive. The file size is measured in bytes. For directories a size of 0 is returned. The function follows symbolic links.
- Returns:
- the size of the file.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
getMTime
const func time: getMTime (inout cpioArchive: cpio, in string: filePath)
-
Determine the modification time of a file in a CPIO archive. The function follows symbolic links.
- Returns:
- the modification time of the file.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
setMTime
const proc: setMTime (inout cpioArchive: cpio, in string: filePath, in time: modificationTime)
-
Set the modification time of a file in a CPIO archive. The function follows symbolic links.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- RANGE_ERROR - modificationTime is invalid or cannot be converted to the system file time.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
getOwner
const func string: getOwner (inout cpioArchive: cpio, in string: filePath)
-
Determine the name of the owner (UID) of a file in a CPIO archive. The function follows symbolic links.
- Returns:
- the name of the file owner.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
setOwner
const proc: setOwner (inout cpioArchive: cpio, in string: filePath, in string: owner)
-
Set the owner of a file in a CPIO archive. The function follows symbolic links. The CPIO archive format allows only a numeric UID. The owner "root" is mapped to the UID 0. Other owner names raise a RANGE_ERROR.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation, or the owner cannot be mapped to a UID.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
getGroup
const func string: getGroup (inout cpioArchive: cpio, in string: filePath)
-
Determine the name of the group (GID) of a file in a CPIO archive. The function follows symbolic links.
- Returns:
- the name of the file group.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
setGroup
const proc: setGroup (inout cpioArchive: cpio, in string: filePath, in string: group)
-
Set the group of a file in a CPIO archive. The function follows symbolic links. The CPIO archive format allows only a numeric GID. The group "root" is mapped to the GID 0. Other group names raise a RANGE_ERROR.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation, or the group cannot be mapped to a GID.
- FILE_ERROR - filePath is not present in the CPIO archive, or the chain of symbolic links is too long.
getFileMode
const func fileMode: getFileMode (inout cpioArchive: cpio, in string: filePath, SYMLINK)
-
Determine the file mode (permissions) of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the file mode.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
getMTime
const func time: getMTime (inout cpioArchive: cpio, in string: filePath, SYMLINK)
-
Determine the modification time of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the modification time of the symbolic link.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
setMTime
const proc: setMTime (inout cpioArchive: cpio, in string: filePath, in time: modificationTime, SYMLINK)
-
Set the modification time of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- RANGE_ERROR - modificationTime is invalid or it cannot be converted to the system file time.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
getOwner
const func string: getOwner (inout cpioArchive: cpio, in string: filePath, SYMLINK)
-
Determine the name of the owner (UID) of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the name of the file owner.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
setOwner
const proc: setOwner (inout cpioArchive: cpio, in string: filePath, in string: owner, SYMLINK)
-
Set the owner of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link. The CPIO archive format allows only a numeric UID. The owner "root" is mapped to the UID 0. Other owner names raise a RANGE_ERROR.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation, or the owner cannot be mapped to a UID.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
getGroup
const func string: getGroup (inout cpioArchive: cpio, in string: filePath, SYMLINK)
-
Determine the name of the group (GID) of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link.
- Returns:
- the name of the file group.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
setGroup
const proc: setGroup (inout cpioArchive: cpio, in string: filePath, in string: group, SYMLINK)
-
Set the group of a symbolic link in a CPIO archive. The function only works for symbolic links and does not follow the symbolic link. The CPIO archive format allows only a numeric GID. The group "root" is mapped to the GID 0. Other group names raise a RANGE_ERROR.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation, or the group cannot be mapped to a GID.
- FILE_ERROR - The file described with filePath is not present in the CPIO archive, or it is not a symbolic link.
readLink
const func string: readLink (inout cpioArchive: cpio, in string: filePath)
-
Reads the destination of a symbolic link in a CPIO archive.
- Returns:
- The destination referred by the symbolic link.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or is not a symbolic link.
makeLink
const proc: makeLink (inout cpioArchive: cpio, in string: symlinkPath, in string: targetPath)
-
Create a symbolic link in a CPIO archive. The symbolic link symlinkPath will refer to targetPath afterwards. The function does not follow symbolic links.
- Parameters:
- cpio - Open CPIO archive.
- symlinkPath - Name of the symbolic link to be created.
- targetPath - String to be contained in the symbolic link.
- Raises:
- RANGE_ERROR - targetPath or symlinkPath does not use the standard path representation.
- FILE_ERROR - A system function returns an error.
getFile
const func string: getFile (inout cpioArchive: cpio, in string: filePath)
-
Get the contents of a file in a CPIO archive. The function follows symbolic links.
- Returns:
- the specified file as string.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - filePath is not present in the CPIO archive, or is not a regular file, or the chain of symbolic links is too long.
putFile
const proc: putFile (inout cpioArchive: cpio, in var string: filePath, in string: data)
-
Write data to a CPIO archive with the given filePath. If the file exists already, it is overwritten. The function follows symbolic links.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file exists, but it is not a regular file.
makeDir
const proc: makeDir (inout cpioArchive: cpio, in string: dirPath)
-
Create a new directory in a CPIO archive. The function does not follow symbolic links.
- Parameters:
- cpio - Open CPIO archive.
- dirPath - Name of the directory to be created.
- Raises:
- RANGE_ERROR - dirPath does not use the standard path representation.
- FILE_ERROR - The file dirPath already exists.
removeFile
const proc: removeFile (inout cpioArchive: cpio, in string: filePath)
-
Remove any file except non-empty directories from a CPIO archive. The function does not follow symbolic links. An attempt to remove a directory that is not empty triggers FILE_ERROR.
- Parameters:
- cpio - Open CPIO archive.
- filePath - Name of the file to be removed.
- Raises:
- RANGE_ERROR - filePath does not use the standard path representation.
- FILE_ERROR - The file does not exist or it is a directory that is not empty.
for
const proc: for (inout string: filePath) range (inout cpioArchive: cpio) do (in proc: statements) end for
-
For-loop which loops recursively over the paths in a CPIO archive.
open
const func file: open (inout cpioArchive: cpio, in string: filePath, in string: mode)
-
Open a file with filePath and mode in in a CPIO archive.
|
|