Add non-exclusive override to interface definition, add regression test
authorClemens Fruhwirth <clemens@endorphin.org>
Mon, 30 Jun 2008 12:21:06 +0000 (12:21 +0000)
committerClemens Fruhwirth <clemens@endorphin.org>
Mon, 30 Jun 2008 12:21:06 +0000 (12:21 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@26 36d66b0a-2a48-0410-832c-cd162a569da5

lib/libcryptsetup.h
luks/Makefile.am

index e2db46a..f87b736 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef _LIBCRYPTSETUP_H
 #define _LIBCRYPTSETUP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include <stdint.h>
 
@@ -17,6 +20,7 @@ struct interface_callbacks {
 #define CRYPT_FLAG_READONLY            (1 << 1)
 #define        CRYPT_FLAG_VERIFY_IF_POSSIBLE   (1 << 2)
 #define        CRYPT_FLAG_VERIFY_ON_DELKEY     (1 << 3)
+#define        CRYPT_FLAG_NON_EXCLUSIVE_ACCESS (1 << 4)
 
 struct crypt_options {
        const char      *name;
@@ -65,4 +69,7 @@ void crypt_get_error(char *buf, size_t size);
 void crypt_put_options(struct crypt_options *options);
 const char *crypt_get_dir(void);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _LIBCRYPTSETUP_H */
index b4b3709..fdbab67 100644 (file)
@@ -125,6 +125,16 @@ test:
        @../src/cryptsetup -v remove dummy
        @echo "success"
 
+# Non-Exclusive Open test
+       @echo Case: Non-Exclusive Open
+       echo "key0" | ../src/cryptsetup -v --readonly luksOpen $(LOOPDEV) dummy1 2>/dev/null
+# must fail
+       echo "key0" | ../src/cryptsetup -v --readonly luksOpen $(LOOPDEV) dummy2 2>/dev/null || true 
+       echo "key0" | ../src/cryptsetup -v --non-exclusive --readonly luksOpen $(LOOPDEV) dummy2 2>/dev/null
+       @../src/cryptsetup -v remove dummy1
+       @../src/cryptsetup -v remove dummy2
+
+
 # Key Slot 1 and key material section 1 must change, the rest must not
        @echo Case: add key test for key files
        @cp $(IMG) $(ORIG_IMG)