Skip to content

Commit

Permalink
Add btrfs support.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisp committed Apr 5, 2009
1 parent 4bb2e91 commit cf07009
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
4 changes: 2 additions & 2 deletions HISTORY
@@ -1,4 +1,4 @@
$Id: HISTORY,v 1.34 2009/04/05 07:43:03 chrisp Exp $ -*- text -*-
$Id: HISTORY,v 1.35 2009/04/05 10:55:10 chrisp Exp $ -*- text -*-

disktype History
==================
Expand Down Expand Up @@ -107,7 +107,7 @@ Improved other structures: Amiga "Rigid Disk" partitioning, LILO,
Version 10 was released on Xxx x, 2009. It features the following
improvements:

Added file systems: ext4.
Added file systems: ext4, btrfs.
Added other structures: NetBSD boot loader.
Improved file systems: -
Improved other structures: -
Expand Down
12 changes: 6 additions & 6 deletions README
@@ -1,4 +1,4 @@
$Id: README,v 1.19 2009/04/05 07:43:03 chrisp Exp $ -*- text -*-
$Id: README,v 1.20 2009/04/05 10:55:11 chrisp Exp $ -*- text -*-

disktype 10
=============
Expand Down Expand Up @@ -56,11 +56,11 @@ for some example command lines.
The following formats are recognized by this version of disktype.

File systems: FAT12/FAT16/FAT32, NTFS, HPFS, MFS, HFS, HFS Plus,
ISO9660, ext2/ext3/ext4, Minix, ReiserFS, Reiser4, Linux romfs,
Linux cramfs, Linux squashfs, UFS (some variations), SysV FS (some
variations), JFS, XFS, Amiga FS/FFS, Amiga SFS, Amiga PFS, BeOS BFS,
QNX4 FS, UDF, 3DO CD-ROM file system, Veritas VxFS, Xbox DVD file
system.
ISO9660, ext2/ext3/ext4, btrfs, Minix, ReiserFS, Reiser4, Linux
romfs, Linux cramfs, Linux squashfs, UFS (some variations), SysV FS
(some variations), JFS, XFS, Amiga FS/FFS, Amiga SFS, Amiga PFS,
BeOS BFS, QNX4 FS, UDF, 3DO CD-ROM file system, Veritas VxFS, Xbox
DVD file system.

Partitioning: DOS/PC style, EFI GPT, Apple, Amiga "Rigid Disk", ATARI
ST (AHDI3), BSD disklabel, Linux RAID physical disks, Linux LVM1
Expand Down
2 changes: 2 additions & 0 deletions detect.c
Expand Up @@ -60,6 +60,7 @@ void detect_udf(SECTION *section, int level);

/* in linux.c */
void detect_ext234(SECTION *section, int level);
void detect_btrfs(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);
Expand Down Expand Up @@ -137,6 +138,7 @@ DETECTOR detectors[] = {
detect_cdrom_misc,
detect_iso,
detect_ext234,
detect_btrfs,
detect_reiser,
detect_reiser4,
detect_linux_raid,
Expand Down
27 changes: 27 additions & 0 deletions linux.c
Expand Up @@ -93,6 +93,33 @@ void detect_ext234(SECTION *section, int level)
}
}

/*
* btrfs file system
*/

void detect_btrfs(SECTION *section, int level)
{
unsigned char *buf;
char s[258];

if (get_buffer(section, 64 * 1024, 1024, (void **)&buf) < 1024)
return;

if (memcmp(buf + 64, "_BHRfS_M", 8) == 0) {
print_line(level, "Btrfs file system");

get_string(buf + 299, 256, s);
if (s[0])
print_line(level + 1, "Volume name \"%s\"", s);

format_uuid(buf + 32, s);
print_line(level + 1, "UUID %s", s);

format_size(s, get_le_quad(buf + 0x70));
print_line(level + 1, "Volume size %s", s);
}
}

/*
* ReiserFS file system
*/
Expand Down

0 comments on commit cf07009

Please sign in to comment.