Add crypt_get_device_name() to API (get underlying device name).
authorMilan Broz <gmazyland@gmail.com>
Mon, 18 Oct 2010 14:47:06 +0000 (14:47 +0000)
committerMilan Broz <gmazyland@gmail.com>
Mon, 18 Oct 2010 14:47:06 +0000 (14:47 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@342 36d66b0a-2a48-0410-832c-cd162a569da5

ChangeLog
lib/libcryptsetup.h
lib/libcryptsetup.sym
lib/setup.c
tests/api-test.c

index 1580366..55e6ce9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 2010-10-17  Milan Broz  <mbroz@redhat.com>
+       * Add crypt_get_device_name() to API (get underlying device name).
        * Change detection for static libraries.
        * Fix pkg-config use in automake scripts.
        * Build statically linked binary (cryptsetup.static) together with shared build
index c2cf5fb..0db338b 100644 (file)
@@ -437,12 +437,14 @@ int crypt_dump(struct crypt_device *cd);
  * cipher - used cipher, e.g. "aes" or NULL otherwise
  * cipher_mode - used cipher mode including IV, e.g. "xts-plain" or NULL otherwise
  * uuid - device UUID or NULL if not set
+ * device_name - underlying device name or NULL if not yet set
  * data_offset - device offset in sectors where real data starts on underlying device)
  * volume_key_size - size (in bytes) of volume key for crypt device
  */
 const char *crypt_get_cipher(struct crypt_device *cd);
 const char *crypt_get_cipher_mode(struct crypt_device *cd);
 const char *crypt_get_uuid(struct crypt_device *cd);
+const char *crypt_get_device_name(struct crypt_device *cd);
 uint64_t crypt_get_data_offset(struct crypt_device *cd);
 int crypt_get_volume_key_size(struct crypt_device *cd);
 
index d4ed0dc..61fd17a 100644 (file)
@@ -35,6 +35,7 @@ CRYPTSETUP_1.0 {
                crypt_get_uuid;
                crypt_get_data_offset;
                crypt_get_volume_key_size;
+               crypt_get_device_name;
 
                crypt_keyslot_status;
                crypt_get_error;
index bf9da03..2f7026e 100644 (file)
@@ -2020,6 +2020,9 @@ int crypt_dump(struct crypt_device *cd)
                else 
                        log_std(cd, "Key Slot %d: DISABLED\n", i);
        }
+
+       log_std(cd, "DNAME: %s\n", crypt_get_device_name(cd) ?: "");
+
        return 0;
 }
 
@@ -2053,6 +2056,11 @@ const char *crypt_get_uuid(struct crypt_device *cd)
        return NULL;
 }
 
+const char *crypt_get_device_name(struct crypt_device *cd)
+{
+       return cd->device;
+}
+
 int crypt_get_volume_key_size(struct crypt_device *cd)
 {
        if (isPLAIN(cd->type))
index 3063dce..6a967ed 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * cryptsetup library API check functions
  *
- * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2010 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -731,6 +731,7 @@ static void AddDeviceLuks(void)
        OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
        EQ_(key_size, crypt_get_volume_key_size(cd));
        EQ_(4096, crypt_get_data_offset(cd));
+       OK_(strcmp(DEVICE_2, crypt_get_device_name(cd)));
 
        reset_log();
        crypt_set_log_callback(cd, &new_log, NULL);