Commit Graph

1438 Commits

Author SHA1 Message Date
Wolfgang Bumiller bd430c225b clippy: remove a loop{} which never actually loops
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:31:39 +02:00
Wolfgang Bumiller 44fed91e17 more clippy fixups
mostly indentation changes, view with `-w`

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:23:12 +02:00
Wolfgang Bumiller 653b1ca10e some clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 12:14:05 +02:00
Christian Ebner 03310bea12 src/pxar/fuse.rs: s/Buf/ReplyBuf/ and s/BufState/ReplyBufState/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-11 11:27:18 +02:00
Christian Ebner 48cc1b8234 src/pxar/fuse.rs: refactor stat and fix i-node mapping
The functionality of stat is split into smaller sub-functions, which allows
to reuse them more flexible, as the code flow is similar but not always the same.
By this, the ugly and incorrect re-setting of the i-node in the lookup callback
function is avoided.
The correct i-node is now calculated beforehand and stat simply creates a
`libc::stat` struct from the provided parameters.
Also, this fixes incorrect i-node assignments in the readdir callback function.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-11 11:26:55 +02:00
Christian Ebner 22eaa905a4 src/pxar/fuse.rs: impl readdir callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:38:58 +02:00
Christian Ebner 1652192f4d src/pxar/fuse.rs: impl readlink callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:38:48 +02:00
Christian Ebner 3710b23db5 src/pxar/decoder.rs: read_link has to read filename before entry.
The offset points to the start of the item, which is the filename

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:36:04 +02:00
Christian Ebner 7eb9848ba7 src/pxar/fuse.rs: impl opendir callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:35:13 +02:00
Christian Ebner 2c5fd378d3 src/pxar/fuse.rs: impl read callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:34:55 +02:00
Christian Ebner 97e4db9dd5 src/pxar/fuse.rs: impl open callback for fuse
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 11:34:18 +02:00
Christian Ebner b00689254a src/pxar/fuse.rs: impl lookup callback for fuse
The lookup call checks if the given filename is found in the directory referenced
by the i-node by calclulating the filenames hash and looking it up in the
directories goodbye table.
If found, the entries parameters are returned.
In order to be able to lookup the parent offset by a given file offset in the
readdir callback, this also stores the corresponding values in a HashMap.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:54:23 +02:00
Christian Ebner 1443927c02 src/pxar/decoder.rs: correctly handle hardlinks in `Decoder`s attribute function
If the attributes are then returned by seeking to the new offset.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:46:39 +02:00
Christian Ebner d00097a0e6 src/pxar/decoder.rs: split functionality of list_dir into list_dir and goodbye_table
In order to read the contents of the goodbye table while keeping the
functionality of list_dir in place as is.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:46:29 +02:00
Christian Ebner ac12570e99 src/pxar/decoder.rs: make read_directory_entry usable by fuse
... and thereby allow it to read a single directory entry based on the
start and end archive offsets.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:32:48 +02:00
Christian Ebner 3f7f4f34be src/pxar/decoder.rs: remove `DirectoryEntry` start_offset and end_offset functions
... as they are not needed with the latest iteration of the fuse callback
function impl (which never made it into the repos).

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:30:45 +02:00
Christian Ebner ac30bc3326 src/pxar/decoder.rs: correctly read, check and skip filename
The previous implementation simply skipped over `size` bytes, which is not
correct as size includes also the header.
By relying on `SequentailDecoder`s read_filename function, this is correctly
taken care of plus some more integrity checks.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-10 10:30:21 +02:00
Dietmar Maurer 4a7de56e2f avoid injecting ENV vars from Makefile
So that we can run "cargo build" without setting vars manually.
2019-09-09 10:51:08 +02:00
Christian Ebner 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 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 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
Dietmar Maurer 54a5a885a3 src/client/http_client.rs: use async for upload_speedtest() 2019-09-06 08:55:47 +02:00
Christian Ebner 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 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
Dietmar Maurer 2a05048b93 src/client/http_client.rs: simplify send_request 2019-09-05 15:07:37 +02:00
Dietmar Maurer 9edd3bf1b8 src/client/http_client.rs: use async for h2api_response() 2019-09-05 14:56:52 +02:00
Dietmar Maurer c18fddf80f src/client/http_client.rs - download_chunk_list: simplify async code 2019-09-05 14:16:45 +02:00
Dietmar Maurer 44f59dc731 src/client/http_client.rs - H2Client: fix error message in download() 2019-09-05 13:26:06 +02:00
Dietmar Maurer c2a5a9f353 src/client/http_client.rs: use async for download_chunk_list 2019-09-05 13:12:03 +02:00
Dietmar Maurer 2f831baec0 src/client/http_client.rs - BackupClient: use async 2019-09-05 12:55:22 +02:00
Dietmar Maurer 2a1e6d7dea src/client/http_client.rs - BackupClient: use async 2019-09-05 11:42:12 +02:00
Dietmar Maurer d4a085e564 src/client/http_client.rs - BackupReader: use async 2019-09-05 11:42:05 +02:00
Dietmar Maurer 9d456cf8ec src/backup/catalog_blob.rs: use write_all() instead of write()
To correctly handle interrupted system calls.
2019-09-05 11:40:48 +02:00
Dietmar Maurer 1a7a0e74c0 src/client/http_client.rs: use async for more functions 2019-09-04 13:48:16 +02:00
Dietmar Maurer 96f5e80abb src/client/http_client.rs: use async for login() 2019-09-04 10:01:46 +02:00
Dietmar Maurer 9d35dbbb8f src/client/http_client.rs: use async for credentials 2019-09-04 09:57:29 +02:00
Dietmar Maurer d2267b112d src/bin/proxmox-backup-client.rs: verify blob/catlog checksums 2019-09-04 08:47:14 +02:00
Christian Ebner 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 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 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 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 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 3fa71727ee src/bin/proxmox-backup-client.rs: refactoring of match statement
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-09-04 06:08:00 +02:00
Dietmar Maurer a40220c056 src/bin/proxmox-backup-client.rs: code cleanup - factor out some functions 2019-09-03 13:31:13 +02:00
Dietmar Maurer 36493d4d7e src/backup.rs: define INDEX_BLOB_NAME here 2019-09-03 13:15:44 +02:00
Dietmar Maurer df65bd3da6 src/bin/proxmox-backup-client.rs - restore: verify checksums 2019-09-03 13:12:16 +02:00
Dietmar Maurer 0a51fe0011 src/backup/fixed_index.rs: new helper to compute checksum and file size 2019-09-03 13:11:45 +02:00
Dietmar Maurer 82c85a21a1 src/backup/dynamic_index.rs: new helper to compute checksum and file size 2019-09-03 13:11:09 +02:00
Dietmar Maurer a3e032b754 src/client/http_client.rs: fix dynamic index checksum 2019-09-03 13:10:18 +02:00
Wolfgang Bumiller c77563146b comment fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-03 11:17:33 +02:00
Wolfgang Bumiller daef93f481 tools: add tokio::main() replacement
to deal with block_on() not allowing blocking()

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-03 11:16:30 +02:00
Wolfgang Bumiller 66fbf5bad0 add WrappedReaderStream test
Mostly to just document the rt.block_on() issue with
blocking().

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-03 10:05:45 +02:00
Wolfgang Bumiller 2b92971fba merge fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:22:36 +02:00
Wolfgang Bumiller 083ff3fd5d update to tokio 0.2.0-alpha.4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 1434f4f8df drop hyper_openssl
We can use .await now, which means the whole connection
state machine doesn't need to be typed out as "types"
anymore, so, at least until hyper_openssl gets updated to
proper dependencies, let's drop it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 556eb70ea3 add generic either-or AsyncRead/Write type
The HttpsConnector will use this. Instead of implementing a
specialized MaybeTlsStream, this is simply a generic "either
this or that kind of Async Read/Write type".

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller b30415d244 src/server/state.rs: update to tokio alpha.2
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller aadcf7c621 src/server/rest.rs: use tokio::timer::delay
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 0cdb8d9c5b src/tools/wrapped_reader_stream.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller e668912a99 src/tools/futures.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 0f5856acca src/tools/daemon.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 56e351c911 src/tools/broadcast_future.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 627bb7d114 src/tools/async_mutex.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 75fef4b463 src/server/worker_task.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller aa4110cc64 src/server/state.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 91e4587343 src/server/rest.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller b9b7f7ec1f src/server/h2service.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 160fc8147f src/server/command_socket.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 3c0facc787 src/client/remote_chunk_reader.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 369a87e3a2 src/client/pxar_backup_stream.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 2107bb40c1 src/client/pipe_to_stream.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 5b3911995b src/client/merge_known_chunks.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller a6782ca10b src/client/http_client.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller 8630557918 src/bin/upload-speed.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller cab6816969 src/bin/test_chunk_speed2.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller fda5797b8a src/bin/proxmox-backup-proxy.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller e9722f8bde src/bin/proxmox-backup-client.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:21:26 +02:00
Wolfgang Bumiller e76ac3a499 src/bin/proxmox-backup-api.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller e235c8f719 src/bin/h2s-server.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 74be6dc9b7 src/bin/h2server.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 55d8a631fc src/bin/h2s-client.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 15d0e4a3bd src/bin/h2client.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller b9203d87f4 src/bin/download-speed.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 745e652a7f src/backup/index.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 32bef1e2d1 src/backup/chunk_stream.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller f2d9b73c91 src/api_schema/router.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller ffb6434485 src/api2/reader.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 7622005574 src/api2/backup/upload_chunk.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 59b2baa0f6 src/api2/backup.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 6be147b78c src/api2/admin/datastore.rs: switch to async
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 5c1130df9f implement Sync for DynamicIndexReader and FixedIndexReader
hyper's wrap_stream now needs this

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Wolfgang Bumiller 236761a3e6 drop src/storage/futures.rs
it's unused and uses a tokio::Task I don't want to lookup
the std-future conversion for...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-02 15:17:58 +02:00
Dietmar Maurer 02fcf372e4 rc/bin/proxmox-backup-client.rs - restore: always download index.json.blob 2019-09-02 14:14:32 +02:00
Dietmar Maurer 0d9862803b src/bin/proxmox-backup-client.rs - reatore: avoid loading (large) blobs into memory 2019-09-02 14:13:31 +02:00
Christian Ebner 66c8eb9383 src/client/http_client.rs: Refactor handling Option and Result types
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-29 09:15:16 +02:00
Wolfgang Bumiller 40f8680e37 tools: remove SignalFd
We don't use it anymore and it'll just be more work when
switching to async-await.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-23 13:44:53 +02:00
Wolfgang Bumiller d21f8a5b5b backup/dynamic_index: explicitly zero-initialize the header
The writer.write_all() call accessed data marked as
undefined to valgrind. Note that we shouldn't write out
uninitialized memory for security reasons anyway.
(note that vec::undefined already did zero-initialize the
data, but also marked it as undefined for valgrind when
compiling with the valgrind feature)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-23 11:42:35 +02:00
Wolfgang Bumiller 990b930f22 backup/dynamic_index: use static assertion, fix size
The type was sized properly but the number was still wrong,
fixed this.
TODO! Once unions with non-Copy values are stable make this
a `union { full: [u8; 4096], data: TheActualHeader }`;

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-23 11:42:35 +02:00
Christian Ebner 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 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