This commit is contained in:
Ertuğrul Erata
2015-05-17 20:03:20 +03:00
parent 176567ccd2
commit 41b4c09fe5
48 changed files with 3569 additions and 113 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
def build():
shelltools.export("CCACHE_DIR", "%s" % get.workDIR())
autotools.make('CFLAGS="%s -fno-stack-protector -fno-strict-aliasing"' % get.CFLAGS())
def install():
pisitools.dobin("disktype")
pisitools.doman("disktype.1")
pisitools.dodoc("README", "HISTORY", "TODO")
@@ -0,0 +1,80 @@
diff -ur disktype-9.orig/linux.c disktype-9/linux.c
--- disktype-9.orig/linux.c 2006-06-04 23:05:06.000000000 +0300
+++ disktype-9/linux.c 2007-02-14 14:34:36.749572288 +0200
@@ -43,11 +43,20 @@
if (get_le_short(buf + 56) == 0xEF53) {
if (get_le_long(buf + 96) & 0x0008) /* JOURNAL_DEV flag */
+ {
print_line(level, "Ext3 external journal");
+ print_line(level, "KERNELMODULE: ext3");
+ }
else if (get_le_long(buf + 92) & 0x0004) /* HAS_JOURNAL flag */
+ {
print_line(level, "Ext3 file system");
+ print_line(level, "KERNELMODULE: ext3");
+ }
else
+ {
print_line(level, "Ext2 file system");
+ print_line(level, "KERNELMODULE: ext2");
+ }
get_string(buf + 120, 16, s);
if (s[0])
@@ -93,19 +102,24 @@
/* check signature */
if (memcmp(buf + 52, "ReIsErFs", 8) == 0) {
print_line(level, "ReiserFS file system (old 3.5 format, standard journal, starts at %d KiB)", at);
+ print_line(level, "KERNELMODULE: reiserfs");
newformat = 0;
} else if (memcmp(buf + 52, "ReIsEr2Fs", 9) == 0) {
print_line(level, "ReiserFS file system (new 3.6 format, standard journal, starts at %d KiB)", at);
+ print_line(level, "KERNELMODULE: reiserfs");
newformat = 1;
} else if (memcmp(buf + 52, "ReIsEr3Fs", 9) == 0) {
newformat = get_le_short(buf + 72);
if (newformat == 0) {
print_line(level, "ReiserFS file system (old 3.5 format, non-standard journal, starts at %d KiB)", at);
+ print_line(level, "KERNELMODULE: reiserfs");
} else if (newformat == 2) {
print_line(level, "ReiserFS file system (new 3.6 format, non-standard journal, starts at %d KiB)", at);
+ print_line(level, "KERNELMODULE: reiserfs");
newformat = 1;
} else {
print_line(level, "ReiserFS file system (v3 magic, but unknown version %d, starts at %d KiB)", newformat, at);
+ print_line(level, "KERNELMODULE: reiserfs");
continue;
}
} else
diff -ur disktype-9.orig/Makefile disktype-9/Makefile
--- disktype-9.orig/Makefile 2006-01-12 19:55:15.000000000 +0200
+++ disktype-9/Makefile 2007-02-14 14:24:30.917995693 +0200
@@ -3,7 +3,7 @@
###
RM = rm -f
-CC = gcc
+CC = klcc
OBJS = main.o lib.o \
buffer.o file.o cdaccess.o cdimage.o vpc.o compressed.o \
diff -ur disktype-9.orig/unix.c disktype-9/unix.c
--- disktype-9.orig/unix.c 2003-12-30 12:10:41.000000000 +0200
+++ disktype-9/unix.c 2007-02-14 14:27:48.529848766 +0200
@@ -49,6 +49,7 @@
/* tell the user */
version = get_le_long(buf + 4);
print_line(level, "JFS file system, version %d", version);
+ print_line(level, "KERNELMODULE: jfs");
get_string(buf + 101, 11, s);
print_line(level + 1, "Volume name \"%s\"", s);
@@ -82,6 +83,7 @@
raw_version = get_be_short(buf + 0x64);
version = raw_version & 0x000f;
print_line(level, "XFS file system, version %d", version);
+ print_line(level, "KERNELMODULE: xfs");
get_string(buf + 0x6c, 12, s);
print_line(level + 1, "Volume name \"%s\"", s);
+112
View File
@@ -0,0 +1,112 @@
We first get some sane ext3 poperties and try to match the invert
of these with the filesystems related supoerblock sections. If we find
something not related to ext3 and have journal, we guess the filesystem
is of ext4 type. Then by checking EXT2_FLAGS_TEST_FILESYS in s_flags
section we distinguish ext4 and ext4dev. There may be a better way but
this is the way current e2fsprogs blkid probe does it. Ext4 sections
and flags are taken from the kernel headers of 2.6.25 where ext4 is
still marked as dev.
Onur Küçük <onur@pardus.org.tr>
diff -Nur disktype-9-old/detect.c disktype-9/detect.c
--- disktype-9-old/detect.c 2009-03-09 12:38:20.000000000 +0200
+++ disktype-9/detect.c 2009-03-09 12:38:33.000000000 +0200
@@ -59,7 +59,7 @@
void detect_udf(SECTION *section, int level);
/* in linux.c */
-void detect_ext23(SECTION *section, int level);
+void detect_ext234(SECTION *section, int level);
void detect_reiser(SECTION *section, int level);
void detect_reiser4(SECTION *section, int level);
void detect_linux_raid(SECTION *section, int level);
@@ -136,7 +136,7 @@
detect_udf,
detect_cdrom_misc,
detect_iso,
- detect_ext23,
+ detect_ext234,
detect_reiser,
detect_reiser4,
detect_linux_raid,
diff -Nur disktype-9-old/linux.c disktype-9/linux.c
--- disktype-9-old/linux.c 2009-03-09 12:38:20.000000000 +0200
+++ disktype-9/linux.c 2009-03-09 12:38:29.000000000 +0200
@@ -28,10 +28,43 @@
#include "global.h"
/*
- * ext2/ext3 file system
+ * ext2/ext3/ext4 file system
*/
-void detect_ext23(SECTION *section, int level)
+/* for s_flags */
+#define EXT2_FLAGS_TEST_FILESYS 0x0004
+
+/* for s_feature_compat */
+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
+
+/* for s_feature_ro_compat */
+#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
+#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
+#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
+#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
+#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
+
+/* for s_feature_incompat */
+#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
+#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
+#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
+#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040
+#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
+#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
+
+#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER | \
+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE | \
+ EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
+
+#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED ~(EXT2_FEATURE_INCOMPAT_FILETYPE | \
+ EXT3_FEATURE_INCOMPAT_RECOVER | \
+ EXT2_FEATURE_INCOMPAT_META_BG)
+
+void detect_ext234(SECTION *section, int level)
{
unsigned char *buf;
char s[256];
@@ -49,8 +82,26 @@
}
else if (get_le_long(buf + 92) & 0x0004) /* HAS_JOURNAL flag */
{
- print_line(level, "Ext3 file system");
- print_line(level, "KERNELMODULE: ext3");
+ /* Try to find if it is ext4 by checking if there are any unsupported features of ext3 */
+ if ((get_le_long(buf + 96) & EXT3_FEATURE_INCOMPAT_UNSUPPORTED) && (get_le_long(buf + 100) & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED))
+ {
+ /* We have ext4 but which version */
+ if (get_le_long(buf + 352) & EXT2_FLAGS_TEST_FILESYS)
+ {
+ print_line(level, "Ext4dev file system");
+ print_line(level, "KERNELMODULE: ext4dev");
+ }
+ else
+ {
+ print_line(level, "Ext4 file system");
+ print_line(level, "KERNELMODULE: ext4");
+ }
+ }
+ else
+ {
+ print_line(level, "Ext3 file system");
+ print_line(level, "KERNELMODULE: ext3");
+ }
}
else
{
+19
View File
@@ -0,0 +1,19 @@
diff -Nur disktype-9-old/dos.c disktype-9/dos.c
--- disktype-9-old/dos.c 2008-07-04 11:06:22.000000000 +0300
+++ disktype-9/dos.c 2008-07-04 11:22:59.000000000 +0300
@@ -485,6 +485,7 @@
strcpy(s, ", ATARI ST bootable");
print_line(level, "%s file system (hints score %d of %d%s)",
fatnames[fattype], score, 5, s);
+ print_line(level, "KERNELMODULE: vfat");
if (sectsize > 512)
print_line(level + 1, "Unusual sector size %lu bytes", sectsize);
@@ -551,6 +552,7 @@
/* tell the user */
print_line(level, "NTFS file system");
+ print_line(level, "KERNELMODULE: ntfs");
format_blocky_size(s, sectcount, sectsize, "sectors", NULL);
print_line(level + 1, "Volume size %s", s);
+60
View File
@@ -0,0 +1,60 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>disktype</Name>
<Homepage>http://disktype.sourceforge.net/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>BSD</License>
<IsA>app:console</IsA>
<Summary>Detect the content format of a disk or disk image</Summary>
<Description>The purpose of disktype is to detect the content format of a disk or disk image. It knows about common file systems, partition tables, and boot codes.The program is written in C and is designed to compile on any modern Unix flavour.</Description>
<Archive type="targz" sha1sum="5ccc55d1c47f9a37becce7336c4aa3a7a43cc89c">mirrors://sourceforge/disktype/disktype-9.tar.gz</Archive>
<Patches>
<Patch level="1">disktype.patch</Patch>
<Patch level="1">vfat.patch</Patch>
<Patch level="1">ext4.patch</Patch>
</Patches>
<BuildDependencies>
<Dependency>klibc</Dependency>
<Dependency>colorgcc</Dependency>
</BuildDependencies>
</Source>
<Package>
<Name>disktype</Name>
<Files>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="man">/usr/share/man</Path>
</Files>
</Package>
<History>
<Update release="3">
<Date>2015-04-01</Date>
<Version>9</Version>
<Comment>Release bump.</Comment>
<Name>Marcin Bojara</Name>
<Email>marcin@pisilinux.org</Email>
</Update>
<Update release="2">
<Date>2013-10-29</Date>
<Version>9</Version>
<Comment>Rebuild</Comment>
<Name>Yusuf Aydemir</Name>
<Email>yusuf.aydemir@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2012-08-23</Date>
<Version>9</Version>
<Comment>First release</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>disktype</Name>
<Summary xml:lang="tr">Disk veya disk görüntüsünün biçimsel içeriğini saptar</Summary>
<Description xml:lang="tr">Disktype'ın amacı disk veya disk görüntüsünün içerik yapısını denetlemektir. Yaygın dosya sistemlerini, bölümleme tablolarını ve önyükleme kodlarını bilir. C dilinde yazılmış, herhangi bir modern Unix derleme tadında tasarlanmıştır.</Description>
</Source>
</PISI>