Wolfgang Bumiller
39c5d8641b
take a reference to the dirfd in Fd::openat
...
Otherwise we cannot pass references to it unless the AsRawFd
implementation was made for the reference itself rather than
the type.
Note that while this changes the public API, we have no
users outside of this crate yet and no public releases,
so I'm not doing a major version bump.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-14 11:24:32 +01:00
Fabian Grünbichler
f667873d70
tools: remove accidentally commited debian/files
...
it's a build artifact, no need to version control it.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-03 07:28:24 +01:00
Wolfgang Bumiller
43682dd416
version bump
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 14:42:28 +01:00
Fabian Grünbichler
94168b94c2
proxmox-tools: reference valgrind_request via git
...
to allow using 'cargo XXX' with cargo config pointing to packaged
sources instead of crates.io
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-02 14:00:27 +01:00
Wolfgang Bumiller
09345ac8c5
bump proxmox-tools to 0.1.1-dev.1
...
We now use this between package releases.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 11:32:21 +01:00
Wolfgang Bumiller
f90cbb7edd
tools: fs: default to 644 for mode in replace_file
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 10:06:40 +01:00
Fabian Grünbichler
fa4f892c19
proxmox-tools: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
a33d9a35db
proxmox-tools: update regex and lazy_static
...
to those versions available in Debian unstable
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:15:24 +01:00
Wolfgang Bumiller
2abdbb5113
add a top level doc comment to fs submodule
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 12:01:36 +01:00
Wolfgang Bumiller
ef612103f2
bump nix to 0.16
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 09:27:41 +01:00
Wolfgang Bumiller
1e7467ee11
cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:41:17 +01:00
Wolfgang Bumiller
85742a0d57
tools: create_path: return whether the dir was created
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:40:12 +01:00
Wolfgang Bumiller
867a530724
tools: create_dir: pass EEXIST to the caller
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:37:10 +01:00
Wolfgang Bumiller
3c284b131d
tools: fix create_path: don't use O_PATH
...
open(2) says file descriptors opened with O_PATH cannot be
passed to fchmod(), fchown(), etc.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:20:58 +01:00
Wolfgang Bumiller
81cac5fc29
replace create_dir_chown with create_dir using CreateOptions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 11:09:23 +01:00
Wolfgang Bumiller
ffcbcc117a
deprecate file_set_contents{,_full}
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:46:28 +01:00
Wolfgang Bumiller
4bce3d76a2
tools: replace_file, make options not an option...
...
CreateOptions::new() creates an all-None option set anyway
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:04:22 +01:00
Wolfgang Bumiller
2387f9ef2b
tools: introduce replace_file
...
nicer api with CreateOptions
see doc-comments for more info
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:01:46 +01:00
Wolfgang Bumiller
b489c2ceeb
import the new api definitions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:30:28 +01:00
Wolfgang Bumiller
729fed5eac
tools: add identity macro
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 10:24:27 +01:00
Wolfgang Bumiller
3cc4bcd78e
tools: uuid: don't use uuid_parse
...
The manpage states that it requires a terminating null byte.
We don't have that. Also, the uuid crate also accepted
non-hyphenated hex strings, so we do that as well.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 10:13:08 +01:00
Wolfgang Bumiller
6cf330c9d2
add tools::parse submodule, move hex_nibble to it
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 09:59:04 +01:00
Wolfgang Bumiller
85a9752ea2
tools: uuid: fix doc comments
...
(at least use the correct format)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 09:48:08 +01:00
Wolfgang Bumiller
b53b621cd8
add Uuid replacement
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-13 14:49:11 +01:00
Wolfgang Bumiller
fd03b808ab
tools: io::read: introduce read_host_value_boxed
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-11 14:40:42 +02:00
Wolfgang Bumiller
5c5db5ccc1
tools: tests for static_assert_size macro
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
2019-08-23 16:47:27 +02:00
Wolfgang Bumiller
f1351e7e41
tools: add a static size assertion
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-23 11:26:57 +02:00
Wolfgang Bumiller
e1ebf9b67e
tools: borrow: use ManuallyDrop
...
While Option serves a similar purpose, ManuallyDrop is an
api more directed at what we're actually doing here.
Note that Option<Box<>> is sort of guaranteed to have the
same layout as Box<> mostly due to the fact that Box<>
cannot be null, whereas ManuallyDrop is always guaranteed to
be the same layout as the inner type.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:53:40 +02:00
Wolfgang Bumiller
09d84f6634
[clippy] tools: lifetimes and constants
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:42:05 +02:00
Wolfgang Bumiller
45b5839e7e
replace std::mem::uninitialized
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 16:49:12 +02:00
Wolfgang Bumiller
e59456e0b7
tools: fs: rename CreateOptions::empty to new
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 12:01:43 +02:00
Wolfgang Bumiller
47fdbc6a32
tools: fs: add create_path and CreateOptions
...
To allow creating paths recursively with options. (Basically
extends `std::fs::create_dir_all`.)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
aadb47a292
update nix to 0.15 for mkdirat
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
4a1c914827
tools: fd: improve drop handler and add some helpers
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 11:51:45 +02:00
Wolfgang Bumiller
acbf549bf0
tools: fs: import unistd::{Uid,Gid} fully
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-21 10:15:21 +02:00
Wolfgang Bumiller
abc32ba70f
cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-16 13:15:39 +02:00
Wolfgang Bumiller
2ecd147036
tools: add borrow::Tied with example docs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-16 12:36:27 +02:00
Wolfgang Bumiller
ccce46eba4
formatting fixup
...
make fmt
(cargo fmt --all)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:14:23 +02:00
Wolfgang Bumiller
863a16a5bc
whitespace cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:13:37 +02:00
Wolfgang Bumiller
4c9a8b5c88
cleanup use statements
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 14:12:49 +02:00
Wolfgang Bumiller
63b17d4eb5
tools: Cargo.toml: cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 12:36:35 +02:00
Wolfgang Bumiller
97f41473db
rename tools::raw to tools::fd
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 12:36:24 +02:00
Dietmar Maurer
3497f97a7d
proxmox-tools/src/lib.rs: fix doc test
2019-08-05 10:12:08 +02:00
Wolfgang Bumiller
d78142302c
formatting fixup
...
add #[rustfmt::skip] to our macros...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 09:45:14 +02:00
Dietmar Maurer
d6d65be42e
add nodename helper (copied from proxmox-backup)
2019-08-03 17:00:02 +02:00
Dietmar Maurer
51d891af5d
new helper create_dir_chown
...
moved from proxmox-backup.
2019-08-03 12:21:20 +02:00
Dietmar Maurer
9f63a6506e
src/fs.rs: new module for fs related helpers
2019-08-03 11:49:14 +02:00
Wolfgang Bumiller
26e4b205ac
tools: add remaining common regexps
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-31 11:45:45 +02:00
Wolfgang Bumiller
1bc52e2482
tools: add common_regex with IP_REGEX for now
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-31 11:45:22 +02:00
Wolfgang Bumiller
da40267188
api-server, tools: formatting cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-18 10:47:56 +02:00