chiark / gitweb /
[PATCH] udev_volume_id: volume_id v35
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Wed, 23 Feb 2005 01:58:31 +0000 (02:58 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:36:13 +0000 (23:36 -0700)
49 files changed:
extras/volume_id/udev_volume_id.c
extras/volume_id/volume_id/Makefile.inc
extras/volume_id/volume_id/cramfs.c [moved from extras/volume_id/volume_id/cramfs/cramfs.c with 96% similarity]
extras/volume_id/volume_id/cramfs.h [moved from extras/volume_id/volume_id/cramfs/cramfs.h with 100% similarity]
extras/volume_id/volume_id/dasd.c [moved from extras/volume_id/volume_id/dasd/dasd.c with 99% similarity]
extras/volume_id/volume_id/dasd.h [moved from extras/volume_id/volume_id/dasd/dasd.h with 100% similarity]
extras/volume_id/volume_id/ext.c [moved from extras/volume_id/volume_id/ext/ext.c with 97% similarity]
extras/volume_id/volume_id/ext.h [moved from extras/volume_id/volume_id/ext/ext.h with 100% similarity]
extras/volume_id/volume_id/fat.c [moved from extras/volume_id/volume_id/fat/fat.c with 99% similarity]
extras/volume_id/volume_id/fat.h [moved from extras/volume_id/volume_id/fat/fat.h with 100% similarity]
extras/volume_id/volume_id/hfs.c [moved from extras/volume_id/volume_id/hfs/hfs.c with 99% similarity]
extras/volume_id/volume_id/hfs.h [moved from extras/volume_id/volume_id/hfs/hfs.h with 100% similarity]
extras/volume_id/volume_id/highpoint.c [moved from extras/volume_id/volume_id/highpoint/highpoint.c with 96% similarity]
extras/volume_id/volume_id/highpoint.h [moved from extras/volume_id/volume_id/highpoint/highpoint.h with 100% similarity]
extras/volume_id/volume_id/hpfs.c [moved from extras/volume_id/volume_id/hpfs/hpfs.c with 96% similarity]
extras/volume_id/volume_id/hpfs.h [moved from extras/volume_id/volume_id/hpfs/hpfs.h with 100% similarity]
extras/volume_id/volume_id/iso9660.c [moved from extras/volume_id/volume_id/iso9660/iso9660.c with 97% similarity]
extras/volume_id/volume_id/iso9660.h [moved from extras/volume_id/volume_id/iso9660/iso9660.h with 100% similarity]
extras/volume_id/volume_id/jfs.c [moved from extras/volume_id/volume_id/jfs/jfs.c with 96% similarity]
extras/volume_id/volume_id/jfs.h [moved from extras/volume_id/volume_id/jfs/jfs.h with 100% similarity]
extras/volume_id/volume_id/linux_raid.c [moved from extras/volume_id/volume_id/linux_raid/linux_raid.c with 97% similarity]
extras/volume_id/volume_id/linux_raid.h [moved from extras/volume_id/volume_id/linux_raid/linux_raid.h with 100% similarity]
extras/volume_id/volume_id/linux_swap.c [moved from extras/volume_id/volume_id/linux_swap/linux_swap.c with 96% similarity]
extras/volume_id/volume_id/linux_swap.h [moved from extras/volume_id/volume_id/linux_swap/linux_swap.h with 100% similarity]
extras/volume_id/volume_id/luks.c [new file with mode: 0644]
extras/volume_id/volume_id/luks.h [new file with mode: 0644]
extras/volume_id/volume_id/lvm.c [moved from extras/volume_id/volume_id/lvm/lvm.c with 97% similarity]
extras/volume_id/volume_id/lvm.h [moved from extras/volume_id/volume_id/lvm/lvm.h with 100% similarity]
extras/volume_id/volume_id/mac.c [moved from extras/volume_id/volume_id/mac/mac.c with 98% similarity]
extras/volume_id/volume_id/mac.h [moved from extras/volume_id/volume_id/mac/mac.h with 100% similarity]
extras/volume_id/volume_id/msdos.c [moved from extras/volume_id/volume_id/msdos/msdos.c with 98% similarity]
extras/volume_id/volume_id/msdos.h [moved from extras/volume_id/volume_id/msdos/msdos.h with 100% similarity]
extras/volume_id/volume_id/ntfs.c [moved from extras/volume_id/volume_id/ntfs/ntfs.c with 98% similarity]
extras/volume_id/volume_id/ntfs.h [moved from extras/volume_id/volume_id/ntfs/ntfs.h with 100% similarity]
extras/volume_id/volume_id/reiserfs.c [moved from extras/volume_id/volume_id/reiserfs/reiserfs.c with 97% similarity]
extras/volume_id/volume_id/reiserfs.h [moved from extras/volume_id/volume_id/reiserfs/reiserfs.h with 100% similarity]
extras/volume_id/volume_id/romfs.c [moved from extras/volume_id/volume_id/romfs/romfs.c with 96% similarity]
extras/volume_id/volume_id/romfs.h [moved from extras/volume_id/volume_id/romfs/romfs.h with 100% similarity]
extras/volume_id/volume_id/sysv.c [moved from extras/volume_id/volume_id/sysv/sysv.c with 97% similarity]
extras/volume_id/volume_id/sysv.h [moved from extras/volume_id/volume_id/sysv/sysv.h with 100% similarity]
extras/volume_id/volume_id/udf.c [moved from extras/volume_id/volume_id/udf/udf.c with 98% similarity]
extras/volume_id/volume_id/udf.h [moved from extras/volume_id/volume_id/udf/udf.h with 100% similarity]
extras/volume_id/volume_id/ufs.c [moved from extras/volume_id/volume_id/ufs/ufs.c with 98% similarity]
extras/volume_id/volume_id/ufs.h [moved from extras/volume_id/volume_id/ufs/ufs.h with 100% similarity]
extras/volume_id/volume_id/util.c
extras/volume_id/volume_id/volume_id.c
extras/volume_id/volume_id/volume_id.h
extras/volume_id/volume_id/xfs.c [moved from extras/volume_id/volume_id/xfs/xfs.c with 96% similarity]
extras/volume_id/volume_id/xfs.h [moved from extras/volume_id/volume_id/xfs/xfs.h with 100% similarity]

index 843b70baf5672c95113f4c33e4819b5228d33d3c..c36b89f8bd4d8d443cdde11ff6400226e22fbf0e 100644 (file)
@@ -31,7 +31,7 @@
 #include "../../udev_utils.h"
 #include "../../logging.h"
 #include "volume_id/volume_id.h"
 #include "../../udev_utils.h"
 #include "../../logging.h"
 #include "volume_id/volume_id.h"
-#include "volume_id/dasd/dasd.h"
+#include "volume_id/dasd.h"
 
 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
 
 
 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
 
index d010f7778e160f89bcf444064d4e8ea960482fcf..9cadec20cc291d1a0ef343527369df0293d62cf2 100644 (file)
@@ -1,48 +1,50 @@
-VOLUME_ID_OBJS=                                                \
-       $(VOLUME_ID_BASE)/ext/ext.o                     \
-       $(VOLUME_ID_BASE)/fat/fat.o                     \
-       $(VOLUME_ID_BASE)/hfs/hfs.o                     \
-       $(VOLUME_ID_BASE)/highpoint/highpoint.o         \
-       $(VOLUME_ID_BASE)/iso9660/iso9660.o             \
-       $(VOLUME_ID_BASE)/jfs/jfs.o                     \
-       $(VOLUME_ID_BASE)/linux_raid/linux_raid.o       \
-       $(VOLUME_ID_BASE)/linux_swap/linux_swap.o       \
-       $(VOLUME_ID_BASE)/lvm/lvm.o                     \
-       $(VOLUME_ID_BASE)/mac/mac.o                     \
-       $(VOLUME_ID_BASE)/msdos/msdos.o                 \
-       $(VOLUME_ID_BASE)/ntfs/ntfs.o                   \
-       $(VOLUME_ID_BASE)/reiserfs/reiserfs.o           \
-       $(VOLUME_ID_BASE)/udf/udf.o                     \
-       $(VOLUME_ID_BASE)/ufs/ufs.o                     \
-       $(VOLUME_ID_BASE)/xfs/xfs.o                     \
-       $(VOLUME_ID_BASE)/cramfs/cramfs.o               \
-       $(VOLUME_ID_BASE)/hpfs/hpfs.o                   \
-       $(VOLUME_ID_BASE)/romfs/romfs.o                 \
-       $(VOLUME_ID_BASE)/sysv/sysv.o                   \
-       $(VOLUME_ID_BASE)/dasd/dasd.o                   \
-       $(VOLUME_ID_BASE)/volume_id.o                   \
+VOLUME_ID_OBJS=                                        \
+       $(VOLUME_ID_BASE)/ext.o                 \
+       $(VOLUME_ID_BASE)/fat.o                 \
+       $(VOLUME_ID_BASE)/hfs.o                 \
+       $(VOLUME_ID_BASE)/highpoint.o           \
+       $(VOLUME_ID_BASE)/iso9660.o             \
+       $(VOLUME_ID_BASE)/jfs.o                 \
+       $(VOLUME_ID_BASE)/linux_raid.o          \
+       $(VOLUME_ID_BASE)/linux_swap.o          \
+       $(VOLUME_ID_BASE)/lvm.o                 \
+       $(VOLUME_ID_BASE)/mac.o                 \
+       $(VOLUME_ID_BASE)/msdos.o               \
+       $(VOLUME_ID_BASE)/ntfs.o                \
+       $(VOLUME_ID_BASE)/reiserfs.o            \
+       $(VOLUME_ID_BASE)/udf.o                 \
+       $(VOLUME_ID_BASE)/ufs.o                 \
+       $(VOLUME_ID_BASE)/xfs.o                 \
+       $(VOLUME_ID_BASE)/cramfs.o              \
+       $(VOLUME_ID_BASE)/hpfs.o                \
+       $(VOLUME_ID_BASE)/romfs.o               \
+       $(VOLUME_ID_BASE)/sysv.o                \
+       $(VOLUME_ID_BASE)/dasd.o                \
+       $(VOLUME_ID_BASE)/luks.o                \
+       $(VOLUME_ID_BASE)/volume_id.o           \
        $(VOLUME_ID_BASE)/util.o
 
        $(VOLUME_ID_BASE)/util.o
 
-VOLUME_ID_HEADERS=                                     \
-       $(VOLUME_ID_BASE)/ext/ext.h                     \
-       $(VOLUME_ID_BASE)/fat/fat.h                     \
-       $(VOLUME_ID_BASE)/hfs/hfs.h                     \
-       $(VOLUME_ID_BASE)/highpoint/highpoint.h         \
-       $(VOLUME_ID_BASE)/iso9660/iso9660.h             \
-       $(VOLUME_ID_BASE)/jfs/jfs.h                     \
-       $(VOLUME_ID_BASE)/linux_raid/linux_raid.h       \
-       $(VOLUME_ID_BASE)/linux_swap/linux_swap.h       \
-       $(VOLUME_ID_BASE)/lvm/lvm.h                     \
-       $(VOLUME_ID_BASE)/mac/mac.h                     \
-       $(VOLUME_ID_BASE)/msdos/msdos.h                 \
-       $(VOLUME_ID_BASE)/ntfs/ntfs.h                   \
-       $(VOLUME_ID_BASE)/reiserfs/reiserfs.h           \
-       $(VOLUME_ID_BASE)/udf/udf.h                     \
-       $(VOLUME_ID_BASE)/ufs/ufs.h                     \
-       $(VOLUME_ID_BASE)/xfs/xfs.h                     \
-       $(VOLUME_ID_BASE)/cramfs/cramfs.h               \
-       $(VOLUME_ID_BASE)/sysv/sysv.h                   \
-       $(VOLUME_ID_BASE)/romfs/romfs.h                 \
-       $(VOLUME_ID_BASE)/dasd/dasd.h                   \
-       $(VOLUME_ID_BASE)/volume_id.h                   \
+VOLUME_ID_HEADERS=                             \
+       $(VOLUME_ID_BASE)/ext.h                 \
+       $(VOLUME_ID_BASE)/fat.h                 \
+       $(VOLUME_ID_BASE)/hfs.h                 \
+       $(VOLUME_ID_BASE)/highpoint.h           \
+       $(VOLUME_ID_BASE)/iso9660.h             \
+       $(VOLUME_ID_BASE)/jfs.h                 \
+       $(VOLUME_ID_BASE)/linux_raid.h          \
+       $(VOLUME_ID_BASE)/linux_swap.h          \
+       $(VOLUME_ID_BASE)/lvm.h                 \
+       $(VOLUME_ID_BASE)/mac.h                 \
+       $(VOLUME_ID_BASE)/msdos.h               \
+       $(VOLUME_ID_BASE)/ntfs.h                \
+       $(VOLUME_ID_BASE)/reiserfs.h            \
+       $(VOLUME_ID_BASE)/udf.h                 \
+       $(VOLUME_ID_BASE)/ufs.h                 \
+       $(VOLUME_ID_BASE)/xfs.h                 \
+       $(VOLUME_ID_BASE)/cramfs.h              \
+       $(VOLUME_ID_BASE)/sysv.h                \
+       $(VOLUME_ID_BASE)/romfs.h               \
+       $(VOLUME_ID_BASE)/dasd.h                \
+       $(VOLUME_ID_BASE)/luks.h                \
+       $(VOLUME_ID_BASE)/volume_id.h           \
        $(VOLUME_ID_BASE)/util.h
        $(VOLUME_ID_BASE)/util.h
similarity index 96%
rename from extras/volume_id/volume_id/cramfs/cramfs.c
rename to extras/volume_id/volume_id/cramfs.c
index a1d51f107d2bea7b6e6715e2dc45b06980f078c3..a8058646d12686c19246ac89436b20b764193d3e 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "cramfs.h"
 
 struct cramfs_super {
 #include "cramfs.h"
 
 struct cramfs_super {
similarity index 99%
rename from extras/volume_id/volume_id/dasd/dasd.c
rename to extras/volume_id/volume_id/dasd.c
index 2df6a09e8106a460ce6337cdf65feae2c73b1c18..6f403cb9283d66c9c2e30961d9fe919fdf0a7b58 100644 (file)
@@ -34,9 +34,9 @@
 #include <sys/ioctl.h>
 #include <asm/types.h>
 
 #include <sys/ioctl.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "dasd.h"
 
 static unsigned char EBCtoASC[256] =
 #include "dasd.h"
 
 static unsigned char EBCtoASC[256] =
similarity index 97%
rename from extras/volume_id/volume_id/ext/ext.c
rename to extras/volume_id/volume_id/ext.c
index 0940e452fc6e656305e1fc98a9d6c058a34cf773..b7bdf05d97997ff7db2f7e6c24136cb561375f28 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../util.h"
-#include "../logging.h"
+#include "volume_id.h"
+#include "util.h"
+#include "logging.h"
 #include "ext.h"
 
 struct ext2_super_block {
 #include "ext.h"
 
 struct ext2_super_block {
similarity index 99%
rename from extras/volume_id/volume_id/fat/fat.c
rename to extras/volume_id/volume_id/fat.c
index 7c658fe5f41ced7891d7b9c62a2938fbe73e7fc6..58aa2aba058a7c5567e6cd43595b173f4a65eb73 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "fat.h"
 
 #define FAT12_MAX                      0xff5
 #include "fat.h"
 
 #define FAT12_MAX                      0xff5
similarity index 99%
rename from extras/volume_id/volume_id/hfs/hfs.c
rename to extras/volume_id/volume_id/hfs.c
index 905471cb357a2afae80bfdc1975121337e19a1e2..327461c676f1675b5b94022f74dec3f362e0cc41 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "hfs.h"
 
 struct hfs_finder_info{
 #include "hfs.h"
 
 struct hfs_finder_info{
similarity index 96%
rename from extras/volume_id/volume_id/highpoint/highpoint.c
rename to extras/volume_id/volume_id/highpoint.c
index b3014500869b5f496f731db32692ccbdcfec9899..e13fd6de618d5df0a35dd93590155d242bfa561f 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "highpoint.h"
 
 struct hpt37x {
 #include "highpoint.h"
 
 struct hpt37x {
similarity index 96%
rename from extras/volume_id/volume_id/hpfs/hpfs.c
rename to extras/volume_id/volume_id/hpfs.c
index 212e74ee41c44a284764fd62fc666185669028dc..a8daea7892568a5501b22d8d0cc9cb78c81da98e 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "hpfs.h"
 
 struct hpfs_super
 #include "hpfs.h"
 
 struct hpfs_super
similarity index 97%
rename from extras/volume_id/volume_id/iso9660/iso9660.c
rename to extras/volume_id/volume_id/iso9660.c
index 1d7cfd50371d3ed0714af8232cd6d5087f230f81..ffccf609dc50e5f80604f1774773faf8d93853c1 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "iso9660.h"
 
 #define ISO_SUPERBLOCK_OFFSET          0x8000
 #include "iso9660.h"
 
 #define ISO_SUPERBLOCK_OFFSET          0x8000
similarity index 96%
rename from extras/volume_id/volume_id/jfs/jfs.c
rename to extras/volume_id/volume_id/jfs.c
index ab0b83081c4259f8b8169dc352e1460c82b432b8..ac4eab502da1702b3cf447a0f9b6cd4c1d59f880 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "jfs.h"
 
 struct jfs_super_block {
 #include "jfs.h"
 
 struct jfs_super_block {
similarity index 97%
rename from extras/volume_id/volume_id/linux_raid/linux_raid.c
rename to extras/volume_id/volume_id/linux_raid.c
index ca03030ee4803c253d1bfc77f9c3c9d98856d1cc..0ea8596ad67cd1bd0804f9a4462b16ef10d8b60f 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "linux_raid.h"
 
 struct mdp_super_block {
 #include "linux_raid.h"
 
 struct mdp_super_block {
similarity index 96%
rename from extras/volume_id/volume_id/linux_swap/linux_swap.c
rename to extras/volume_id/volume_id/linux_swap.c
index 2fb16377a82f886216959781c8688ef25084b955..39a2c4aab3ff19f8e2f866492a01a033ea841862 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "linux_swap.h"
 
 struct swap_header_v1_2 {
 #include "linux_swap.h"
 
 struct swap_header_v1_2 {
diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c
new file mode 100644 (file)
index 0000000..2001692
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
+ *
+ *     This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU Lesser General Public
+ *     License as published by the Free Software Foundation; either
+ *     version 2.1 of the License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *     Lesser General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Lesser General Public
+ *     License along with this library; if not, write to the Free Software
+ *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <asm/types.h>
+
+#include "volume_id.h"
+#include "util.h"
+#include "logging.h"
+#include "luks.h"
+
+/* from cryptsetup-luks internal.h */
+#define SECTOR_SHIFT            9
+#define SECTOR_SIZE             (1 << SECTOR_SHIFT)
+
+/* from cryptsetup-luks luks.h */
+#define LUKS_CIPHERNAME_L 32
+#define LUKS_CIPHERMODE_L 32
+#define LUKS_HASHSPEC_L 32
+#define LUKS_DIGESTSIZE 20 /* since SHA1 */
+#define LUKS_SALTSIZE 32
+#define LUKS_NUMKEYS 8
+
+/* from cryptsetup-luks luks.h */
+const unsigned char LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
+#define LUKS_MAGIC_L 6
+
+/* from cryptsetup-luks luks.h */
+#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
+
+/* from cryptsetup-luks luks.h */
+#define UUID_STRING_L 40
+
+int volume_id_probe_luks(struct volume_id *id, __u64 off)
+{
+       /* from cryptsetup-luks luks.h */
+       struct luks_phdr {
+               char            magic[LUKS_MAGIC_L];
+               uint16_t        version;
+               char            cipherName[LUKS_CIPHERNAME_L];
+               char            cipherMode[LUKS_CIPHERMODE_L];
+               char            hashSpec[LUKS_HASHSPEC_L];
+               uint32_t        payloadOffset;
+               uint32_t        keyBytes;
+               char            mkDigest[LUKS_DIGESTSIZE];
+               char            mkDigestSalt[LUKS_SALTSIZE];
+               uint32_t        mkDigestIterations;
+               char            uuid[UUID_STRING_L];
+               struct {
+                       uint32_t active;
+
+                       /* parameters used for password processing */
+                       uint32_t passwordIterations;
+                       char     passwordSalt[LUKS_SALTSIZE];
+
+                       /* parameters used for AF store/load */
+                       uint32_t keyMaterialOffset;
+                       uint32_t stripes;
+               } keyblock[LUKS_NUMKEYS];
+       } *header;
+
+       header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE);
+
+       if (header == NULL)
+               return -1;
+
+       if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L))
+               return -1;
+
+       volume_id_set_usage(id, VOLUME_ID_CRYPTO);
+       volume_id_set_uuid(id, header->uuid, UUID_DCE);
+       id->type = "crypto_LUKS";
+
+       return 0;
+}
diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h
new file mode 100644 (file)
index 0000000..180336f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * volume_id - reads filesystem label and uuid
+ *
+ * Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
+ *
+ *     This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU Lesser General Public
+ *     License as published by the Free Software Foundation; either
+ *     version 2.1 of the License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *     Lesser General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Lesser General Public
+ *     License along with this library; if not, write to the Free Software
+ *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _VOLUME_ID_LUKS_
+#define _VOLUME_ID_LUKS_
+
+extern int volume_id_probe_luks(struct volume_id *id, __u64 off);
+
+#endif
similarity index 97%
rename from extras/volume_id/volume_id/lvm/lvm.c
rename to extras/volume_id/volume_id/lvm.c
index ed1a83aeb4c9b517244006ba1898d872e4b3765a..bfc2ef2343f27fea051604667102a13acc99b565 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "lvm.h"
 
 struct lvm1_super_block {
 #include "lvm.h"
 
 struct lvm1_super_block {
similarity index 98%
rename from extras/volume_id/volume_id/mac/mac.c
rename to extras/volume_id/volume_id/mac.c
index 895316d26c64408e24494c615651785084775783..2e2db486f20e7c7ed8bd4af41986c68da491933d 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "mac.h"
 
 struct mac_driver_desc {
 #include "mac.h"
 
 struct mac_driver_desc {
similarity index 98%
rename from extras/volume_id/volume_id/msdos/msdos.c
rename to extras/volume_id/volume_id/msdos.c
index a90b9efc333010a79a371d77eb726cf8ab9b366f..fc2f99d4d00ea1b4058b43aee10bfa28a0588b2b 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "msdos.h"
 
 struct msdos_partition_entry {
 #include "msdos.h"
 
 struct msdos_partition_entry {
similarity index 98%
rename from extras/volume_id/volume_id/ntfs/ntfs.c
rename to extras/volume_id/volume_id/ntfs.c
index e46bc64bb267fe553f5f767dfde23b84db771c71..84d6fbb84381249047716b067f0a85b90bf9e913 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "ntfs.h"
 
 struct ntfs_super_block {
 #include "ntfs.h"
 
 struct ntfs_super_block {
similarity index 97%
rename from extras/volume_id/volume_id/reiserfs/reiserfs.c
rename to extras/volume_id/volume_id/reiserfs.c
index d54013e4c556d54c875efd32dbb1c2a9f2401d60..b74b8ae5760bb2d64713bedeff35017e8140b350 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "reiserfs.h"
 
 struct reiserfs_super_block {
 #include "reiserfs.h"
 
 struct reiserfs_super_block {
similarity index 96%
rename from extras/volume_id/volume_id/romfs/romfs.c
rename to extras/volume_id/volume_id/romfs.c
index c04dc98f10f8771e0b44a2dab60e1a1e95684cdd..fe5e5a4827cae93521c6e8e161001e13fa5edbb7 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "romfs.h"
 
 struct romfs_super {
 #include "romfs.h"
 
 struct romfs_super {
similarity index 97%
rename from extras/volume_id/volume_id/sysv/sysv.c
rename to extras/volume_id/volume_id/sysv.c
index 313ac1732a33c77f0b2db2e18f94a6f4b7b36e0b..6c4408d80cb4f4434ea95318113c07716409a57a 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "sysv.h"
 
 #define SYSV_NICINOD                   100
 #include "sysv.h"
 
 #define SYSV_NICINOD                   100
similarity index 98%
rename from extras/volume_id/volume_id/udf/udf.c
rename to extras/volume_id/volume_id/udf.c
index 79d25ad89027a5efe32103dfbc3f00de2399e2dd..06b521545fcfd345d285f88c5ade1f0a3aacbd9e 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "udf.h"
 
 struct volume_descriptor {
 #include "udf.h"
 
 struct volume_descriptor {
similarity index 98%
rename from extras/volume_id/volume_id/ufs/ufs.c
rename to extras/volume_id/volume_id/ufs.c
index 12672ffe01589d320a7dab344c265c4891570987..37e74aee6f94fdc340be9403a1a09c914e2b07e1 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "ufs.h"
 
 struct ufs_super_block {
 #include "ufs.h"
 
 struct ufs_super_block {
index 0cd2eadec1313ee00bf7a80907759bca7ab77d43..6159a5992800edcf9415555eb8f9e0391b79c1e2 100644 (file)
@@ -53,6 +53,8 @@ static char *usage_to_string(enum volume_id_usage usage_id)
                return "raid";
        case VOLUME_ID_DISKLABEL:
                return "disklabel";
                return "raid";
        case VOLUME_ID_DISKLABEL:
                return "disklabel";
+       case VOLUME_ID_CRYPTO:
+               return "crypto";
        case VOLUME_ID_UNPROBED:
                return "unprobed";
        case VOLUME_ID_UNUSED:
        case VOLUME_ID_UNPROBED:
                return "unprobed";
        case VOLUME_ID_UNUSED:
index 95f7f5b12712f9753040ea6abcb139bf828c30ab..f93cc91161100ba3faf8d028b6a12257c9ffbc22 100644 (file)
 #include "logging.h"
 #include "util.h"
 
 #include "logging.h"
 #include "util.h"
 
-#include "ext/ext.h"
-#include "reiserfs/reiserfs.h"
-#include "fat/fat.h"
-#include "hfs/hfs.h"
-#include "jfs/jfs.h"
-#include "xfs/xfs.h"
-#include "ufs/ufs.h"
-#include "ntfs/ntfs.h"
-#include "iso9660/iso9660.h"
-#include "udf/udf.h"
-#include "highpoint/highpoint.h"
-#include "linux_swap/linux_swap.h"
-#include "linux_raid/linux_raid.h"
-#include "lvm/lvm.h"
-#include "cramfs/cramfs.h"
-#include "hpfs/hpfs.h"
-#include "romfs/romfs.h"
-#include "mac/mac.h"
-#include "msdos/msdos.h"
+#include "ext.h"
+#include "reiserfs.h"
+#include "fat.h"
+#include "hfs.h"
+#include "jfs.h"
+#include "xfs.h"
+#include "ufs.h"
+#include "ntfs.h"
+#include "iso9660.h"
+#include "udf.h"
+#include "luks.h"
+#include "highpoint.h"
+#include "linux_swap.h"
+#include "linux_raid.h"
+#include "lvm.h"
+#include "cramfs.h"
+#include "hpfs.h"
+#include "romfs.h"
+#include "sysv.h"
+#include "luks.h"
+#include "mac.h"
+#include "msdos.h"
 
 int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size)
 {
 
 int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size)
 {
@@ -79,6 +82,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l
        if (volume_id_probe_highpoint_ataraid(id, off) == 0)
                goto exit;
 
        if (volume_id_probe_highpoint_ataraid(id, off) == 0)
                goto exit;
 
+       if (volume_id_probe_luks(id, off) == 0)
+               goto exit;
+
        /* signature in the first block, only small buffer needed */
        if (volume_id_probe_vfat(id, off) == 0)
                goto exit;
        /* signature in the first block, only small buffer needed */
        if (volume_id_probe_vfat(id, off) == 0)
                goto exit;
@@ -128,6 +134,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l
        if (volume_id_probe_hpfs(id, off) == 0)
                goto exit;
 
        if (volume_id_probe_hpfs(id, off) == 0)
                goto exit;
 
+       if (volume_id_probe_sysv(id, off) == 0)
+               goto exit;
+
        return -1;
 
 exit:
        return -1;
 
 exit:
index 5b845602c6f49b352fa08f98817d83c169beaf45..c22a5e60ae9c80257712d772a2d107bd17bc1d84 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION              34
+#define VOLUME_ID_VERSION              35
 
 #define VOLUME_ID_LABEL_SIZE           64
 #define VOLUME_ID_UUID_SIZE            16
 
 #define VOLUME_ID_LABEL_SIZE           64
 #define VOLUME_ID_UUID_SIZE            16
@@ -38,6 +38,7 @@ enum volume_id_usage {
        VOLUME_ID_PARTITIONTABLE,
        VOLUME_ID_RAID,
        VOLUME_ID_DISKLABEL,
        VOLUME_ID_PARTITIONTABLE,
        VOLUME_ID_RAID,
        VOLUME_ID_DISKLABEL,
+       VOLUME_ID_CRYPTO,
 };
 
 struct volume_id_partition {
 };
 
 struct volume_id_partition {
similarity index 96%
rename from extras/volume_id/volume_id/xfs/xfs.c
rename to extras/volume_id/volume_id/xfs.c
index efbe06ec58f8814fe7468cd201b69e0f9f16a464..12a89aafcb207c8ec7f3689d8ae2266a3dca1e95 100644 (file)
@@ -34,9 +34,9 @@
 #include <ctype.h>
 #include <asm/types.h>
 
 #include <ctype.h>
 #include <asm/types.h>
 
-#include "../volume_id.h"
-#include "../logging.h"
-#include "../util.h"
+#include "volume_id.h"
+#include "logging.h"
+#include "util.h"
 #include "xfs.h"
 
 struct xfs_super_block {
 #include "xfs.h"
 
 struct xfs_super_block {