fallocate
fallocate exposes an interface to fallocate(2), posix_fallocate(3) and posix_fadvise(3).
Under Mac OS X the fallocate() method will use the apple equivalent of fallocate(2). Note that this might not be exactly the same.
When using the wrapper functions around the fallocate(2) call the arguments given to the function are slightly different then the c call.
This module has the arguments like:
fallocate(fd, offset, length, mode=0)
While in C the function looks like:
fallocate(fd, mode, offset, length)
The main reason for this is that the mode argument tends not to be used much and thus having the default as a keyword argument is much easier then having to specify 0 everytime.
Usage
Funcation: fallocate(fd, offset, len, [mode=0])
Calls fallocate() on the file object or file descriptor. This allows the caller to directly manipulate the allocated disk space for the file referred to by fd for the byte range starting at offset and continuing for len bytes.
mode is only available in Linux.
It should always be 0 unless one of the following possible flags are specified
FALLOC_FL_KEEP_SIZE - do not grow file, default is extend size FALLOC_FL_PUNCH_HOLE - punches a hole in file, de-allocates range FALLOC_FL_COLLAPSE_SIZE - remove a range of a file without leaving a hole
Note: FALLOC_FL_COLLAPSE_SIZE was introduced in Linux kernel v3.15 and is only available on certain filesystems (e.g. ext4, xfs, etc). In order to get access to it, you must build and run on a kernel and filesystem that both support it.
Example:
# preallocate using fallocate a 1kb file
with open("/tmp/test.file", "w+b") as f:
fallocate(f, 0, 1024)
Metadata
Release files for fallocate 1.6.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fallocate-1.6.4.tar.gz | 8.9 kB | Without provenance | Details for fallocate-1.6.4.tar.gz |
Release files / fallocate-1.6.4.tar.gz
| Download URL | fallocate-1.6.4.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85ebeb2786761fbe80d88c52590a610bd3425fc89e188c208a3f261a5bd6acb3
|
|
BLAKE2b-256 checksum How to use checksums |
50a1bf19d1bde4833d3dce97ed8f78c20035b1b83c4d79f033a7f00d2ba1fad1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Security for fallocate 1.6.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.