[Forensics-changes] [SCM] Guess PC disk partition table, find lost partitions branch, debian, updated. debian/0.1h-8-2-gdc80d1b

Daniel Baumann daniel at debian.org
Sat May 30 18:26:08 UTC 2009


The following commit has been merged in the debian branch:
commit 56ad82f0c07d004763abe09dcbf83ea7cd0df844
Author: Daniel Baumann <daniel at debian.org>
Date:   Sat May 30 20:17:53 2009 +0200

    Adding patch from Josef Spillner <2005 at kuarepoti-dju.net> to add support for image files.

diff --git a/debian/patches/04-imagefile.patch b/debian/patches/04-imagefile.patch
new file mode 100644
index 0000000..e6a1942
--- /dev/null
+++ b/debian/patches/04-imagefile.patch
@@ -0,0 +1,59 @@
+Author: Josef Spillner <2005 at kuarepoti-dju.net>
+Description: Adding support for image files.
+
+diff -Naurp gpart.orig/src/disku.c gpart/src/disku.c
+--- gpart.orig/src/disku.c	2009-05-28 23:02:25.000000000 +0200
++++ gpart/src/disku.c	2009-05-30 20:15:58.000000000 +0200
+@@ -31,6 +31,7 @@
+ #include <sys/disklabel.h>
+ #endif
+ 
++#include <unistd.h>
+ 
+ 
+ /*
+@@ -41,11 +42,35 @@
+ struct disk_geom *disk_geometry(disk_desc *d)
+ {
+ 	static struct disk_geom	g;
++	long			nsects;
+ 
+ #if defined(__linux__)
+ 	struct hd_geometry	hg;
+-	long			nsects;
++#endif
++#if defined(__FreeBSD__)
++	struct disklabel	dl;
++#endif
+ 
++	struct stat st;
++	int ret;
++	long lba;
++	ret = stat(d->d_dev, &st);
++	if (ret == 0)
++	{
++		if (S_ISREG(st.st_mode))
++		{
++			nsects = st.st_size / 512;
++			if (nsects == 0)
++				pr(FATAL, EM_FATALERROR, "Not a block device image file");
++			lba = nsects - 1;
++			g.d_h = (lba / 63) % 255;
++			g.d_s = lba % 63 + 1;
++			g.d_c = lba / (255 * 63);
++			return (&g);
++		}
++	}
++
++#if defined(__linux__)
+ 	if (ioctl(d->d_fd,HDIO_GETGEO,&hg) == -1)
+ 		pr(FATAL,EM_IOCTLFAILED,"HDIO_GETGEO",strerror(errno));
+ #ifdef BLKGETSIZE
+@@ -61,7 +86,6 @@ struct disk_geom *disk_geometry(disk_des
+ #endif
+ 
+ #if defined(__FreeBSD__)
+-	struct disklabel	dl;
+ 	if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
+ 		pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
+ 	g.d_c = dl.d_ncylinders;
diff --git a/debian/patches/series b/debian/patches/series
index 853ff37..1998baa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01-conglomeration.patch
 02-ntfs-winxp.patch
 03-open-mode.patch
+04-imagefile.patch

-- 
Guess PC disk partition table, find lost partitions



More information about the forensics-changes mailing list