Ondrej Kozina
1894d6e6ff
Add devno comparison for bdevs in device_is_identical().
2018-12-12 15:07:33 +01:00
Ondrej Kozina
1cc722d0cc
Simplify device_is_identical.
...
If any argument is null return false (with higher
priority than trivial identity check).
Also device_path can't return null if device struct gets
allocated succesfully.
2018-12-12 15:06:59 +01:00
Milan Broz
2a1d58ed22
Check data device offset if it fits data device size in luksFormat.
2018-12-11 21:59:49 +01:00
Milan Broz
991ab5de64
Fixe more context propagation paths.
2018-11-27 16:09:45 +01:00
Milan Broz
7812214db6
Add context to device handling functions.
2018-11-27 14:19:57 +01:00
Milan Broz
a5a8467993
Use context in debug log messages.
...
To use per-context logging even for debug messages
we need to use the same macro as for error logging.
2018-11-27 13:37:20 +01:00
Milan Broz
7f0df99511
Properly parse errno to error message for devices.
2018-10-12 12:03:56 +02:00
Milan Broz
f01d044618
Print file name size instead of a loop device in error messages.
2018-10-11 15:40:22 +02:00
Milan Broz
7514786b20
Add an error message if device is unusable.
2018-10-04 20:00:12 +02:00
Milan Broz
69a844c654
Remove O_SYNC from device open and use fsync().
...
This speed up wipe operation considerably.
2018-08-09 12:01:20 +02:00
Rafael Fontenelle
f35ec9771e
Fix typos
...
A bunch of typos reported by codespell, most of them comments in the code
2018-07-21 07:24:25 -03:00
Ondrej Kozina
1bf5ff3e6e
Open files in read-write mode for posix_fallocate.
...
Unfortunately there exists some weird NFS variations requiring read
permissions for fallocate.
2018-07-07 10:25:01 +02:00
Milan Broz
b00a87d8fa
Remove trailing EOL for verbose and error messages.
2018-04-26 10:38:17 +02:00
Milan Broz
874c573bd4
Do not allow used block size larger than page size.
...
Some filesystems (NFS) returns bogus blocksize (1MB).
Page-size io should always work and avoids increasing IO beyond aligned LUKS header.
2018-04-24 16:36:11 +02:00
Milan Broz
23b01621ff
Print better debug message for open with write mode.
2018-04-10 15:33:30 +02:00
Milan Broz
1fe014dbae
Update copyright year.
2018-01-20 17:55:21 +01:00
Milan Broz
1ca439f4e0
Fix some warnings found during static analysis.
2018-01-20 14:42:05 +01:00
Milan Broz
b80278c04f
Ignore device opt-io alignment if it is not multiple of minimal-io.
...
Some USB enclosures seems to report bogus topology info.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1513820
2017-11-21 15:39:36 +01:00
Milan Broz
12908709bb
Resize loop device after fallocate.
...
On old systems we have a loop mapped so the loop must be resized as well.
2017-10-10 19:48:29 +02:00
Milan Broz
b42d183b08
Create LUKS header file in luksFormat if it does not exist.
2017-10-10 13:52:50 +02:00
Milan Broz
de2f07b82f
Do not try to load LUKS2 header if backup_file is LUKS1.
...
Also do not allow header restore if a different version is requested.
2017-10-06 12:28:59 +02:00
Milan Broz
3ccbb8fe84
Fix some problems found by Coverity analysis.
2017-09-27 10:18:38 +02:00
Milan Broz
5536b3a58d
Add implementation of device/file locking for metadata.
...
To be used later.
2017-09-24 19:49:46 +02:00
Milan Broz
4bcba41d77
Fix crypt_init(cd, NULL) case in the previous commit.
2017-07-27 13:36:53 +02:00
Milan Broz
12040570ca
Allow to open device without read check.
...
In some specific situation we do not want to read the devices
before initialization.
Here it is integrity checking that will produce warning, because
the device is not yet initialized.
Used only in wipe function (here we must use direct-io anyway)
and expect the device is capable of direct-io.
2017-07-27 12:56:07 +02:00
Milan Broz
5824e8d242
Simplify device block size check.
2017-07-26 14:53:37 +02:00
Milan Broz
d7a0d860b9
Use getvfs for block size of filesytem if available.
2017-07-26 14:32:21 +02:00
Milan Broz
29681c0aa7
Fix access to devices under non-root user.
...
We cannot allocate loop device early in luksFormat,
use only device access check here.
2017-06-28 14:24:39 +02:00
Milan Broz
c7de6939ae
Fix ioctl argument for block size check.
2017-06-09 10:33:57 +02:00
Milan Broz
2059266a24
Never decrease device block size (for example after attaching loop device).
2017-06-08 16:22:53 +02:00
Milan Broz
73030aa5fb
Make block size size_t type.
...
And fix all related comparisons and functions.
2017-06-08 14:39:54 +02:00
Milan Broz
34bf809e51
Use device alignment wrapper.
...
And cache the value to not call ioctl on every block read/write.
2017-06-08 09:30:53 +02:00
Milan Broz
3a27c84d98
Rewrite and export crypt_wipe function.
...
The crypt_wipe can be used to wipe any part of the device,
and also to initialize integrity based device (to reset checksum).
2017-06-07 15:31:13 +02:00
Milan Broz
98368c4770
Update copyright years.
2017-03-12 13:17:15 +01:00
Milan Broz
ef7ecb5567
Fix race while allocating free loop device.
...
Fixes Issue #314 .
Thanks to Martin Jeřábek for the report.
2017-01-20 15:27:40 +01:00
Milan Broz
807cedf4f3
Check for data device and hash device area overlap in veritysetup.
...
Thanks Michal Virgovic for tests.
2016-12-13 13:52:05 +01:00
Milan Broz
d7a224e47a
Disable DIRECT_IO for LUKS header with unaligned keyslots.
...
Fixes issue#287.
Such a header is very rare, it is not worth to do more detection here.
2016-03-23 13:44:37 +01:00
Athira Rajeev
8e4e898ce5
Fix device_block_size_fd to return bsize correctly incase of files.
...
This patch is for issue #287
In the code for returning block size ( device_block_size_fd in lib/utils_device.c ),
always returns zero in case of files and device_read_test is not executed.
This patch is to fix device_block_size_fd to return block size correctly incase of files.
Signed-off-by: Athira Rajeevatrajeev@linux.vnet.ibm.com
2016-03-19 18:57:45 +05:30
Milan Broz
3adfe80601
Test device read only once for O_DIRECT.
...
Also do not report error for disappeared device (it is reported later on real access).
2015-03-19 09:39:36 +01:00
Milan Broz
0bc437d92c
Detect if O_DIRECT is usable on device allocation.
...
Try to read the first sector of a device when allocating
device context.
Should fix issue#247.
2015-03-18 15:01:53 +01:00
Milan Broz
31a4d552a2
Support keyfile offset and keyfile size option even for plain volumes.
...
For historic reasons, in the plain mode the hashing is not used
if keyfile is used (with exception of --key-file=-).
Print warning if the parameters are ignored.
For other cases, uses keyfile offset, keyfile size and hash
as psecified on commandline.
Partially fixes issue#243
2015-02-20 12:55:21 +01:00
Milan Broz
89f795d7b4
Fix keyslot device access for devices not supporting O_DIRECT.
2014-08-08 14:49:38 +02:00
Milan Broz
bb8dbfdf5b
Update author name.
2014-06-23 21:40:12 +02:00
Milan Broz
004dc271a4
Fix wrong block size if used on 4k block fs through loop device.
...
Always use page size if running through loop device.
2013-12-08 16:09:25 +01:00
Milan Broz
6190ad928d
Support device/file images if O_DIRECT cannot be used (1.5.1).
...
On some filesystems (like tmpfs) O_DIRECT cannot be used.
So just try to open device without O_DIRECT in the second try.
2012-12-29 15:33:20 +01:00
Milan Broz
29f21208a0
Change License from GPLv2 only to GPLv2+ ("or any later").
...
Agreed by all copyright authors.
2012-12-29 11:33:54 +01:00
Milan Broz
83f02e6682
Add copyright line for files I have written or modified.
2012-12-21 16:40:33 +01:00
Milan Broz
a83cc1dbf4
Fix time of check/use Coverity report (and ignore another) in device utils.
2012-12-17 15:19:57 +01:00
Milan Broz
4882f70040
Replace round_up macro with function.
2012-08-28 13:11:02 +02:00
Milan Broz
1d5788f779
Set context for DM log for all DM backend entries.
...
Try to handle error if run as non-root user better.
2012-08-14 19:17:13 +02:00