Christian Ebner and Dietmar Maurer
d21ae955a6
src/pxar/fuse.rs: impl getattr callback for fuse
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-06 12:24:14 +02:00
Christian Ebner and Dietmar Maurer
ec04ea81f2
src/pxar/fuse.rs: Refactor run_in_context and remove inode_to_offset and offset_to_inode
...
as their functionality is used only once so it makes more sense to keep them
inline.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-06 12:22:53 +02:00
Christian Ebner and Dietmar Maurer
8413083fc5
src/pxar/fuse.rs: Improve comments, add rustfmt skip tag and reafctor
...
Also, removes an unused println statement in the decoder callback function and
fixes a typo.
Further, use ABI compatible Option<&T> for FFI to avoid use of raw pointers.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-06 12:22:17 +02:00
Christian Ebner and Dietmar Maurer
bbd055bf45
src/pxar/decoder.rs: impl functionality needed for fuse implementation
...
Implements functions attributes, open, read, read_link and get_dir
to be used by the fuse implementation which uses file offsets within the archive
as inodes to reference the archives items.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-06 07:18:14 +02:00
Christian Ebner and Dietmar Maurer
132cb0d0db
src/pxar/decoder.rs: Add comment for unsolved issue and refactor if statement.
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-06 07:16:31 +02:00
Christian Ebner and Dietmar Maurer
70b03a07c8
src/pxar/sequential_decoder.rs: make functions needed in non-sequential decoder accessible from within crate
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-04 06:15:05 +02:00
Christian Ebner and Dietmar Maurer
f92e8266ae
src/pxar/format_definitions.rs: move header type in PxarHeader and hash in PxarGoodbyeItem to top of struct
...
By this it is possible to read and check just the first u64 of the corresponding
structs in order to identify the items.
This is needed for the fuse implementation in order to get entries based on the
archive offset, used as inode.
Directories are referenced by the offset to the goodbye tail while other items
are referenced by the offset of the filename followed by the entry.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-04 06:14:30 +02:00
Christian Ebner and Dietmar Maurer
75933d1e83
src/pxar/fuse.rs: add function to map offset to inode and vice versa
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-04 06:13:59 +02:00
Christian Ebner and Dietmar Maurer
c7fee396c6
src/pxar/decoder.rs: add getter functions to obtain start/end offsets for directories
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-04 06:10:56 +02:00
Christian Ebner and Dietmar Maurer
3626ac611f
src/pxar/decoder.rs: rustfmt fixups
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-09-04 06:09:17 +02:00
Christian Ebner and Wolfgang Bumiller
bcb664cb69
pxar/fuse: add pxar cli flag to set single- or multi-threaded session loop
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:43:14 +02:00
Christian Ebner and Wolfgang Bumiller
de2791868a
src/pxar/sequentail_decoder.rs: followup: cleanup S_IFMT masking
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:42:22 +02:00
Christian Ebner and Wolfgang Bumiller
9cb9e1b7db
src/pxar/sequential_decoder.rs: style fixups
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:42:19 +02:00
Christian Ebner and Wolfgang Bumiller
dac88033ba
src/pxar/dir_stack.rs: style fixups
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:39:14 +02:00
Christian Ebner and Wolfgang Bumiller
b69169e7be
src/pxar/fuse.rs: style fixups
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:37:58 +02:00
Christian Ebner and Wolfgang Bumiller
d792dc3cd2
src/pxar/match_pattern.rs: style fixups
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:37:56 +02:00
Christian Ebner and Wolfgang Bumiller
4ea22b68d9
src/pxar/format_definition.rs: style fixup
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-23 09:37:53 +02:00
Christian Ebner and Wolfgang Bumiller
35dfd3ceb7
src/pxar/encoder.rs: style fixups by rustfmt
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-22 13:29:11 +02:00
Christian Ebner and Wolfgang Bumiller
1af30bc2fe
(pxar: replace deprecated std::mem::uninitialized()
...
... and use std::mem::MaybeUninit or proxmox::tools::vec::uninitialized() instead.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-22 13:27:25 +02:00
Christian Ebner and Wolfgang Bumiller
e5471b4836
pxar/decoder: avoid failing on hardlinks and return corresponding target file entry
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
[Fixup: remove unnecessary 'mut']
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-21 09:32:52 +02:00
Christian Ebner and Wolfgang Bumiller
58262f40f7
src/pxar/decoder.rs: get correct stats for root directory
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-21 09:31:41 +02:00
Christian Ebner and Wolfgang Bumiller
7d26720e79
src/pxar/decoder.rs: move GOODBYE_ITEM_SIZE from function to module scope.
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com >
2019-08-21 09:31:39 +02:00
Dietmar Maurer
9d135fe617
src/backup/catalog_blob.rs: moved catalog impl. from pxar
...
And avoid loading catalog into memory.
2019-08-16 12:27:17 +02:00
Christian Ebner and Dietmar Maurer
ac0b435344
src/pxar/fuse.rs: fix compiler warnings
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-14 15:14:57 +02:00
Christian Ebner and Dietmar Maurer
41d08aa6de
src/pxar/fuse.rs: enable libfuse debug output in verbose mode
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-14 08:59:15 +02:00
Christian Ebner and Dietmar Maurer
742e64ea0b
src/pxar/fuse.rs: cleanup callback interface and store decoder within session context
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-14 08:58:44 +02:00
Christian Ebner and Dietmar Maurer
7750b7f2b7
pxar: decoder: take ownership of underlying reader
...
By taking ownership it is easier to move the decoder into another struct,
e.g. into a session context in fuse.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-14 08:55:08 +02:00
Christian Ebner and Dietmar Maurer
f50b4fd6a0
src/pxar/decoder.rs: cleanup s/CaDirectoryEntry/DirectoryEntry
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-14 08:54:08 +02:00
Christian Ebner and Dietmar Maurer
c50f87442c
pxar: add basic code for FUSE implementation.
...
This adds the basic code in order to create a fuse session and mount an archive.
It adds libfuse3-3 as runtime dependency and libfuse3-dev as build dependency.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-09 16:42:31 +02:00
Dietmar Maurer
9049a8cfe6
src/bin/proxmox-backup-client.rs: implement catalog command
2019-08-09 11:36:33 +02:00
Dietmar Maurer
2761d6a4f3
src/pxar/encoder.rs: use BackupCatalogWriter
2019-08-09 09:46:49 +02:00
Dietmar Maurer
aea0815d32
src/pxar/catalog.rs: new catalog helper
2019-08-09 09:41:43 +02:00
Christian Ebner and Dietmar Maurer
eecb182845
pxar: add initial docs for MatchPattern
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-06 09:03:02 +02:00
Christian Ebner and Dietmar Maurer
43e892d293
pxar: add error handling for MatchPattern::matches_filename()
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-06 09:02:44 +02:00
Dietmar Maurer
b86f263ced
use new proxmox::sys::linux::magic
2019-08-03 09:28:57 +02:00
Christian Ebner and Dietmar Maurer
4ea0f7d95b
pxar: remove flag to change digest algorithm
...
The flag CA_FORMAT_SHA512_256 is used to switch between sha512 and sha256 to
calculate digest in casync.
As we use sha256, we can get rid of this flag for now.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:57:53 +02:00
Christian Ebner and Dietmar Maurer
4d142ea79e
pxar: cleanup: refactor and rename exclude pattern
...
The original name PxarExcludePattern makes no sense anymore as the patterns are
also used to match filenames during restore of the archive.
Therefore, exclude_pattern.rs is moved to match_pattern.rs and PxarExcludePattern
rename to MatchPattern.
Further, since it makes more sense the MatchTypes are now declared as None,
Positive, Negative, PartialPositive or PartialNegative, as this makes more sense
and seems more readable.
Positive matches are those without '!' prefix, Negatives with '!' prefix.
This makes also the filename matching in the encoder/decoder more intuitive and
the logic was adapted accordingly.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:52:32 +02:00
Christian Ebner and Dietmar Maurer
fe076c8259
pxar: cleanup: s/PxarDirBuf/PxarDirStack/g and move dir_buffer.rs to dir_stack.rs
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:52:10 +02:00
Christian Ebner and Dietmar Maurer
ead7546a96
pxar: change uid and gid to u32 instead of u64
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:51:51 +02:00
Christian Ebner and Dietmar Maurer
5e50c606b0
pxar: cleanup: s/CA_FORMAT/PXAR/g and s/CaFormat/Pxar/g
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:51:33 +02:00
Christian Ebner and Dietmar Maurer
47651f9530
pxar: cleanup: move feature flags to src/pxar/flags.rs and omit CA_FORMAT prefix on all of them
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:51:06 +02:00
Christian Ebner and Dietmar Maurer
91451c4355
pxar: cleanup: move filesystem related magic numbers to tools/fs/magic.rs
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-03 08:48:12 +02:00
Christian Ebner and Dietmar Maurer
81a9905e0a
pxar: implement feature flag support for device nodes, fifos and sockets
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:55:17 +02:00
Christian Ebner and Dietmar Maurer
8abc95a145
pxar: remove some unused feature flags from format definition
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:54:46 +02:00
Christian Ebner and Dietmar Maurer
3a905cac2b
src/pxar/sequential_decoder.rs: remove of obsolete function dir_mkdirat
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:52:49 +02:00
Christian Ebner and Dietmar Maurer
beffac999f
src/pxar/sequentail_decoder.rs: fix issue when restoring with glob pattern.
...
Partial extraction of an archive with a glob pattern, e.g. '**/*.conf' lead to
the unexpected behaviour of restoring all partially matched directories (in this
example all of them).
This patch fixes this unexpected behaviour by only restoring those directories
were the directory or one of its sub-items fully matched the pattern and should
therefore be restored.
To achive this behavoiur, directory metadata is pushed onto a stack and restored
on demand.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:49:47 +02:00
Christian Ebner and Dietmar Maurer
51ac99c314
src/pxar/exclude_pattern.rs: add Clone and Copy trait to MatchType
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:49:47 +02:00
Christian Ebner and Dietmar Maurer
6a584cfd76
pxar: add PxarDir and PxarDirBuf to buffer directory metadata
...
In order to restore only directories when some of their content fully matched
a match pattern on partial restores, these directories and their metadata are
pushed onto this buffer and only restored successivley on demand.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:45:12 +02:00
Dietmar Maurer
27e6e180b6
src/pxar/format_definition.rs - PxarAttributes: derive Default
...
And remove unnecessary impl new().
2019-08-02 07:16:10 +02:00
Christian Ebner and Dietmar Maurer
a92e6c9011
src/pxar/sequential_decoder.rs: split read and restore of attributes into separate functions
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com >
2019-08-02 07:11:38 +02:00