Commit Graph

41 Commits

Author SHA1 Message Date
Milan Broz
e5405f2fd8 Use #if for HAVE*_H defines. 2025-01-27 11:05:08 +00:00
Milan Broz
8364178b38 Update copyright year. 2025-01-15 23:09:36 +01:00
Milan Broz
5873a65183 Do not use O_EXCL for allocated backing loop device.
Exclusive flag is defined only when creating a file,
for opening existing file it is undefinded operation.

Remove it from crypt_loop_attach as it was wrong since
the initial commit.
2024-07-24 08:28:32 +00:00
Milan Broz
661f57def4 Use SPDX license identifiers.
This patch switches code to SPDX one-line license identifiers according to
https://spdx.dev/learn/handling-license-info/
and replacing long license text headers.

I used C++ format on the first line in style
// SPDX-License-Identifier: <id>
except exported libcryptsetup.h, when only C comments are used.

The only additional changes are:
- switch backend utf8.c from LGPL2+ to LGPL2.1+ (as in systemd)
- add some additional formatting lines.
2024-06-03 16:38:15 +00:00
Milan Broz
bd0ef58b3a Update copyright notice to include 2024 year. 2024-01-23 16:10:44 +01:00
Milan Broz
cfdb1b93af Fix signed (error) return from read in loop utils. 2024-01-17 12:19:55 +01:00
Milan Broz
72f799b393 Update Copyright year. 2023-02-09 17:11:18 +01:00
Milan Broz
e4091fe8a5 Fix some benign warnings with gcc-12.
The string buffer is large enough, but gcc do not understant it.
Easy to avoid these warnings with a larger buffer here.
2022-02-06 18:03:49 +01:00
Milan Broz
ab975bc1c4 Update copyright year.
And unify format in several places.
2022-01-29 10:43:02 +01:00
Milan Broz
90bba399ab Fix LOOP_CONFIGURE incompatibility is some kernels.
Kernels with 32bit userspace can return ENOTTY,
we should use fallback to old code in this case.

For more info see
  583990d25b
2021-07-29 10:32:13 +02:00
Milan Broz
4cdd826282 Check exit value for snprintf where it makes sense. 2021-05-18 22:07:47 +02:00
Ondrej Kozina
ce80f7c5b1 Add support for larger block size in loop. 2021-03-23 16:40:57 +01:00
Milan Broz
ca2e1fc956 Fix some includes. 2021-02-27 21:14:38 +01:00
Milan Broz
d1d9dd8e20 Update Copyright year. 2021-01-25 22:00:25 +01:00
Sinan Kaya
8ff3b0cd63 Support LOOP_CONFIGURE ioctl to improve speed
More data about the new IOCTL is here:
https://lwn.net/Articles/818870/

We see 200-500ms boot speed improvement on our platform.

Prefer to define IOCTL when kernel is older version. Also eliminate
duplication since as a result of introduced ifdef.

Signed-off-by: Sinan Kaya <sinan.kaya@microsoft.com>
2020-09-21 10:54:55 -04:00
Milan Broz
080566a1fd Update copyright year. 2020-01-03 13:04:55 +01:00
Ondrej Kozina
62b580904b Move check for loop device inside crypt_loop_backing_file.
It also fixes minor regression where we return backing file
for partition on top of loop device when prompting for passphrase.
Partition on loop has different major number so it should not be
considered loop device at all.
2019-10-04 13:46:13 +02:00
Milan Broz
a6f5ce8c7b Update copyright year.
And unify name copyright format.
2019-01-25 09:45:57 +01:00
Milan Broz
1fe014dbae Update copyright year. 2018-01-20 17:55:21 +01:00
Milan Broz
6e057c010f Revert "Set block size for loop device if supported by kernel (4.13+)."
This reverts commit 4e2deadba7.

There is too many cases with 4k unaligned images that this optimization
adds more problems than it solves. Revert it for now.
2017-08-23 08:07:27 +02:00
Milan Broz
4e2deadba7 Set block size for loop device if supported by kernel (4.13+). 2017-08-22 13:45:59 +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
683e4db48b Fix warnings reported by static analysis.
- ensure that strings are \0 terminated (most of this is already
handled on higher level anyway)

- fix resource leak in error path in tcrypt.c

- fix time of check/time of use race in sysfs path processing

- insruct Coverity scanner to ignore constant expression in random.c
(it is intented to stop compile-time misconfiguration of RNG that would be fatal)
2016-04-24 12:07:31 +02:00
Milan Broz
54c4b1656f Include sys/sysmacros.h if present.
Needed for major/minor definitions.

Thanks Mike Frysinger for pointing this out.
2016-04-19 10:57:45 +02:00
Milan Broz
1aba9ab444 Cryptsetup resize will try resize also underlying device.
If encrypted device is file-backed, resize should try to resize
underlying loop device as well.
2015-08-19 14:16:42 +02: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
1e3ba81613 Fix time of check/use Coverity report (and ignore another) in loop/wipe utils. 2012-12-17 15:35:33 +01:00
Milan Broz
e510dd9c60 Add sys/types.h for loop wrapper (required on new systems). 2012-11-30 15:08:39 +01:00
Milan Broz
a718369374 Fix loop mapping on readonly file. 2012-05-02 00:52:37 +02:00
Milan Broz
ee8425b836 Version 1.4.2.
Add header and copyright for header files.
2012-04-02 22:03:05 +02:00
Milan Broz
7835b365a7 Fix FSF address in license text according to
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@671 36d66b0a-2a48-0410-832c-cd162a569da5
2011-11-02 22:35:21 +00:00
Milan Broz
4d99773009 Remove internal loop definitions from header file.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@606 36d66b0a-2a48-0410-832c-cd162a569da5
2011-08-26 19:46:04 +00:00
Milan Broz
f3ed801e8b Use /dev/loop-control if possible (kernel 3.1).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@605 36d66b0a-2a48-0410-832c-cd162a569da5
2011-08-22 22:33:24 +00:00
Milan Broz
6361e86daf Add loop control stub for testing new loop device interface.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@587 36d66b0a-2a48-0410-832c-cd162a569da5
2011-08-01 10:40:45 +00:00
Milan Broz
e905a36561 Prefer sysfs when reading backing file.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@457 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-13 23:51:33 +00:00
Milan Broz
01e03f7002 Use loop functions even in api test.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@448 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-12 22:29:14 +00:00
Milan Broz
5ca29818e9 Require loop autoclear support.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@446 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-12 21:05:47 +00:00
Milan Broz
be3448fb8a Separate loop handling from internal code.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@444 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-12 20:23:16 +00:00
Milan Broz
d9ba34693f Add support for automatic loop device use (image infile etc).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@443 36d66b0a-2a48-0410-832c-cd162a569da5
2011-03-11 19:04:37 +00:00