Commit Graph

76 Commits

Author SHA1 Message Date
Wolfgang Bumiller
d3364e07fb sys: file locking depends on timer feature
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-22 11:58:18 +02:00
Wolfgang Bumiller
e2e7ea6d62 sys: introduce 'acl', 'crypt' and 'timer' features
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-21 15:42:11 +02:00
Wolfgang Bumiller
757031ef33 sys: clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-20 13:35:58 +02:00
Wolfgang Bumiller
67fbf2b2ee sys: make escape_unit() more flexible, add unescape_unit_path
This adds the ability to use these functions with non-utf8
strings as well.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-07 11:45:26 +02:00
Wolfgang Bumiller
b1a5daef61 sys: clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 09:58:34 +02:00
Dominik Csapak
1e2aa3eea4 partially fix #2915: proxmox-sys: scandir: stat if file_type is unknown
when using readdir/getdents the file type might be 'DT_UNKNOWN'
(depending on the filesystem). Do a fstatat in that case to
get the file type. Since maybe the callback wants to do
a stat anyway, pass it there (if done)

adds two new helpers:
'file_type_from_file_stat': uses a FileStat struct to get the file type
'get_file_type': calls fstatat to determine the file_type

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 09:34:34 +02:00
Fabian Grünbichler
97fd3a0a14 sys: feature-gate logrotate (and zstd)
it's not needed everywhere we pull in proxmox-sys.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-06-02 14:08:37 +02:00
Wolfgang Bumiller
376af82be7 update proxmox-sys to nix 0.24.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-02 13:34:09 +02:00
Thomas Lamprecht
4cdeee64dc sys: make acl constants rustfmt safe
there's not much better one can do here..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-10 17:39:31 +02:00
Thomas Lamprecht
0a651e00a9 sys: rust fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-10 17:39:31 +02:00
Wolfgang Bumiller
d663ff328a formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:49:48 +01:00
Dominik Csapak
d4b4115400 move io error helpers to proxmox-lang
this removes proxmox_sys as a dependecy for proxmox-async

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:35:14 +01:00
Fabian Grünbichler
ca563a8cfd misc clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-02-08 14:28:44 +01:00
Dominik Csapak
e428920a15 proxmox-sys: add FileSystemInformation struct and helper
code mostly copied from proxmox-backups 'disk_usage'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-02-01 12:26:14 +01:00
Dominik Csapak
131f3d9471 proxmox-sys: make some structs serializable
we already depend on serde anyway, and this makes gathering structs a
bit more comfortable

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-02-01 12:26:14 +01:00
Fabian Grünbichler
540fb905c2 sys: make xattr tests integration tests
these touch files, so should use the cargo-provided tmp dir, but that is
only available to benchmarks and integration tests, not unit tests.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-30 11:51:08 +01:00
Thomas Lamprecht
61cd0ac2ba proxmox-sys: fix glob-import of anyhow
will break usage of the `Result::Ok()' with anyhow 1.0.49+ as that
added a new Ok helper, so a glob-import would make that shadow the
core one.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-12-13 07:46:34 +01:00
Wolfgang Bumiller
59986f1195 sys: another minor clippy fix
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:43:28 +01:00
Wolfgang Bumiller
b213dbb7c8 sys: formatting
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:42:53 +01:00
Wolfgang Bumiller
c280f73793 sys: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:42:53 +01:00
Fabian Grünbichler
6bb932e604 use nix::unistd::fchown
instead of re-implementing it, now that we depend on >=0.19

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:04:55 +01:00
Fabian Grünbichler
1db9a5bc0e clippy: allow manual_range_contains
we use it quite often in this module, and it's more readable when split.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:04:55 +01:00
Fabian Grünbichler
e303ad8605 clippy: misc fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:00:52 +01:00
Wolfgang Bumiller
35ecf9a551 sys: deprecate the identity macro
to be removed with the next major version bump

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:31:39 +01:00
Wolfgang Bumiller
3891953724 proxmox-sys: fix a warning in io_bail_last macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-29 11:29:31 +01:00
Dietmar Maurer
248e888ae7 cleanup: avoid use anyhow::*
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-28 12:50:59 +01:00
Dietmar Maurer
80df41a887 proxmox-sys: import pipe() function from pbs-toos/src/io.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-25 10:34:33 +01:00
Dietmar Maurer
b06807532e proxmox-sys: add stortable-macro feature and remove it from proxmox
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ee4e56e372 proxmox-sys: moved nodename from proxmox crate
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ec3965fdad proxmox-sys: fix regression tests 2021-11-24 10:00:38 +01:00
Dietmar Maurer
21686c99e6 proxmox-sys: fixup worker task log macros 2021-11-24 10:00:38 +01:00
Dietmar Maurer
6efbe4e6e8 proxmox-sys: imported proxmox/src/tools/systemd.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
ba1f59c098 proxmox-sys: imported proxmox/src/tools/email.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
0806020ebf proxmox-sys: improve dev docs
And move WorkerTaskContext to top level.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
e011964f81 proxmox-sys: imported pbs-tools/src/command.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
4c7bd0ee50 proxmox-sys: imported pbs-tools/src/acl.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
66aea897b6 proxmox-sys: imported pbs-tool/src/xattr.rs 2021-11-24 10:00:38 +01:00
Dietmar Maurer
d98ed51fa8 proxmox-sys: move file_get_non_comment_lines to src/fs/file.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
92caf51634 proxmox-sys: split xattr code into extra file
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
d0b7e1e299 proxmox-sys: imported pbs-tools/src/fs.rs to src/fs/read_dir.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
32b69176dd proxmox-sys: imported proxmox tools/sys
And split some files into smaller parts.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
4d158ec1b3 proxmox-sys: fix test for wrong logrotate path
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-22 10:35:45 +01:00
Fabian Grünbichler
aedc5197f5 sys: add missing file
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-11-19 12:05:48 +01:00
Dietmar Maurer
20661f014d proxmox-sys: imported pbs-tools/src/task.rs (as worker_task_context.rs)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 10:05:06 +01:00
Dietmar Maurer
202641757e proxmox-sys: imported pbs-tools/src/logrotate.rs (with various cleanups)
- new: CreateOption s instead of owner string
- new: returns Result instead of Option
- new: add max_files  option
- remove new_with_user()

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:59 +01:00
Dietmar Maurer
8ac4c949bb proxmox-sys: imported pbs-tools/src/process_locker.rs
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:52 +01:00
Dietmar Maurer
840154f61b proxmox-sys: add new crate
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-19 09:28:32 +01:00
Wolfgang Bumiller
436bf05e0b merge api, sys and tools into proxmox directly
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-21 12:15:42 +01:00
Wolfgang Bumiller
2ef0e795a7 sys: double-parse fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-17 13:32:21 +01:00
Wolfgang Bumiller
df5eb296cc sys: mountinfo parsing fixups
* include the failing line on errors
* don't fail on the final empty line...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-17 13:30:28 +01:00