]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: move NOP destructors into shared code
authorLennart Poettering <lennart@poettering.net>
Thu, 18 Mar 2021 21:47:24 +0000 (22:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 19 Apr 2021 21:16:02 +0000 (23:16 +0200)
src/partition/repart.c
src/shared/cryptsetup-util.h

index 46da0d04edc6587c78db910b09599b3921c1b1fd..0be7acf42e872a9b7ddb1f57d065819422f2ae5a 100644 (file)
 /* LUKS2 takes off 16M of the partition size with its metadata by default */
 #define LUKS2_METADATA_SIZE (16*1024*1024)
 
-#if !HAVE_LIBCRYPTSETUP
-struct crypt_device;
-static inline void sym_crypt_free(struct crypt_device* cd) {}
-static inline void sym_crypt_freep(struct crypt_device** cd) {}
-#endif
-
 /* Note: When growing and placing new partitions we always align to 4K sector size. It's how newer hard disks
  * are designed, and if everything is aligned to that performance is best. And for older hard disks with 512B
  * sector size devices were generally assumed to have an even number of sectors, hence at the worst we'll
index 5ebb0ac576ad4ecfb5f86a2fa6804687d61e25e2..855997f3354c26383fad1b5801b1a813bd52b7ff 100644 (file)
@@ -61,4 +61,12 @@ int cryptsetup_get_token_as_json(struct crypt_device *cd, int idx, const char *v
 int cryptsetup_get_keyslot_from_token(JsonVariant *v);
 int cryptsetup_add_token_json(struct crypt_device *cd, JsonVariant *v);
 
+#else
+
+/* If libcryptsetup is not available, let's at least define the basic type and NOP destructors for it, to
+ * make a little bit less #ifdeferry necessary in main programs. */
+struct crypt_device;
+static inline void sym_crypt_free(struct crypt_device* cd) {}
+static inline void sym_crypt_freep(struct crypt_device** cd) {}
+
 #endif