BTRFS support

This commit is contained in:
Jamie Cameron
2013-01-30 15:12:48 -08:00
parent ffc412a3a6
commit d0ef80fe4e
3 changed files with 28 additions and 25 deletions

View File

@@ -809,7 +809,7 @@ if ($has_parted) {
@rv = ( "vfat" );
}
elsif ($tag =~ /^ext/ || $tag eq "raid") {
@rv = ( "ext3", "ext4", "ext2", "xfs", "reiserfs" );
@rv = ( "ext3", "ext4", "ext2", "xfs", "reiserfs", "btrfs" );
}
elsif ($tag eq "hfs" || $tag eq "HFS") {
@rv = ( "hfs" );
@@ -839,7 +839,7 @@ else {
@rv = ( "vfat" );
}
elsif ($tag eq "83") {
@rv = ( "ext3", "ext4", "ext2", "xfs", "reiserfs" );
@rv = ( "ext3", "ext4", "ext2", "xfs", "reiserfs", "btrfs" );
}
elsif ($tag eq "82") {
@rv = ( "swap" );
@@ -865,16 +865,7 @@ return $text{"fs_".$_[0]};
sub mkfs_options
{
if ($_[0] eq "ext2") {
&opt_input("ext2_b", $text{'bytes'}, 1);
&opt_input("ext2_f", $text{'bytes'}, 0);
&opt_input("ext2_i", "", 1);
&opt_input("ext2_m", "%", 0);
&opt_input("ext2_g", "", 1);
print &ui_table_row($text{'ext2_c'},
&ui_yesno_radio("ext2_c", 0));
}
elsif ($_[0] eq "msdos" || $_[0] eq "vfat") {
if ($_[0] eq "msdos" || $_[0] eq "vfat") {
&opt_input("msdos_ff", "", 1);
print &ui_table_row($text{'msdos_F'},
&ui_select("msdos_F", undef,
@@ -928,6 +919,11 @@ elsif ($_[0] eq "fatx") {
# Has no options!
print &ui_table_row(undef, $text{'fatx_none'}, 4);
}
elsif ($_[0] eq "btrfs") {
&opt_input("btrfs_l", $text{'bytes'}, 0);
&opt_input("btrfs_n", $text{'bytes'}, 0);
&opt_input("btrfs_s", $text{'bytes'}, 0);
}
}
# mkfs_parse(type, device)
@@ -936,18 +932,7 @@ elsif ($_[0] eq "fatx") {
sub mkfs_parse
{
local($cmd);
if ($_[0] eq "ext2") {
$cmd = "mkfs -t ext2";
$cmd .= &opt_check("ext2_b", '\d+', "-b");
$cmd .= &opt_check("ext2_f", '\d+', "-f");
$cmd .= &opt_check("ext2_i", '\d{4,}', "-i");
$cmd .= &opt_check("ext2_m", '\d+', "-m");
$cmd .= &opt_check("ext2_g", '\d+', "-g");
$cmd .= $in{'ext2_c'} ? " -c" : "";
$cmd .= " -q";
$cmd .= " $_[1]";
}
elsif ($_[0] eq "msdos" || $_[0] eq "vfat") {
if ($_[0] eq "msdos" || $_[0] eq "vfat") {
$cmd = "mkfs -t $_[0]";
$cmd .= &opt_check("msdos_ff", '[1-2]', "-f");
if ($in{'msdos_F'} eq '*') {
@@ -1026,6 +1011,13 @@ elsif ($_[0] eq "jfs") {
elsif ($_[0] eq "fatx") {
$cmd = "mkfs -t $_[0] $_[1]";
}
elsif ($_[0] eq "btrfs") {
$cmd = "mkfs -t $_[0]";
$cmd .= " -l $in{'btrfs_l'}" if (!$in{'btrfs_l_def'});
$cmd .= " -n $in{'btrfs_n'}" if (!$in{'btrfs_n_def'});
$cmd .= " -s $in{'btrfs_s'}" if (!$in{'btrfs_s_def'});
$cmd .= " $_[1]";
}
if (&has_command("partprobe")) {
$cmd = "partprobe ; $cmd";
}
@@ -1486,6 +1478,7 @@ push(@fstypes, "reiserfs") if (&has_command("mkreiserfs"));
push(@fstypes, "xfs") if (&has_command("mkfs.xfs"));
push(@fstypes, "jfs") if (&has_command("mkfs.jfs"));
push(@fstypes, "fatx") if (&has_command("mkfs.fatx"));
push(@fstypes, "btrfs") if (&has_command("mkfs.btrfs"));
push(@fstypes, "msdos");
push(@fstypes, "vfat");
push(@fstypes, "minix");

View File

@@ -200,6 +200,10 @@ xfs_b=Block size
jfs_s=Log size
jfs_c=Check for bad blocks?
btrfs_l=Leaf size
btrfs_n=Node size
btrfs_s=Sector size
fatx_none=No options are available for FATX filesystems.
acl_disks=Disks this user can partition and format
@@ -257,6 +261,7 @@ fs_ext3=Linux Native
fs_ext4=New Linux Native
fs_xfs=SGI
fs_jfs=IBM Journalling
fs_btrfs=BTR
delete_title=Delete Partition
delete_rusure=Are you sure you want to delete $1 ( $2 ) ? Data on this partition may be lost forever.

View File

@@ -38,6 +38,9 @@ if (!$no_check_support) {
if (&has_command("mkfs.jfs")) {
$jfs_support = 1;
}
if (&has_command("mkfs.btrfs")) {
$btrfs_support = 1;
}
}
# We always need to check this, to fix up LABEL= mounts
@@ -871,7 +874,7 @@ elsif ($_[0] eq $smbfs_fs)
{ return ($smbfs_support >= 3 ? 2 : 0, 1, 0, 0); }
elsif ($_[0] eq "cifs") { return (2, 1, 0, 0); }
elsif ($_[0] =~ /^ext\d+$/ || $_[0] eq "minix" ||
$_[0] eq "xiafs" || $_[0] eq "xfs" || $_[0] eq "jfs")
$_[0] eq "xiafs" || $_[0] eq "xfs" || $_[0] eq "jfs" || $_[0] eq "btrfs")
{ return (2, 1, 1, 0); }
else
{ return (2, 1, 0, 0); }
@@ -926,6 +929,7 @@ push(@sup, "tmpfs") if ($tmpfs_support);
push(@sup, "ext3") if ($ext3_support);
push(@sup, "ext4") if ($ext4_support);
push(@sup, "xfs") if ($xfs_support);
push(@sup, "btrfs") if ($btrfs_support);
push(@sup, "jfs") if ($jfs_support);
push(@sup, "bind") if ($bind_support);
push(@sup, "swap");
@@ -976,6 +980,7 @@ local(%fsmap);
"bind","Loopback Filesystem",
"hfs","Apple Filesystem",
"fatx","XBOX Filesystem",
"btrfs","BTR Filesystem",
);
return $config{long_fstypes} && $fsmap{$_[0]} ? $fsmap{$_[0]} : uc($_[0]);
}