Skip to content

Commit

Permalink
ext2/ext3/ext4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagamma committed Aug 3, 2024
1 parent 98df7d5 commit 5628ba4
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/filesystem.btrfs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemBTRFS.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.btrfs');
Result.CanLabel := ProgramExists('btrfs');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.exfat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemExFat.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.exfat');
Result.CanLabel := ProgramExists('exfatlabel');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
39 changes: 37 additions & 2 deletions src/filesystem.ext.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ TPartedFileSystemExt = class(TPartedFileSystem)
procedure DoResize(const PartAfter, PartBefore: PPartedPartition); override;
end;

TPartedFileSystemExt2 = class(TPartedFileSystemExt)
public
function GetSupport: TPartedFileSystemSupport; override;
end;

TPartedFileSystemExt3 = class(TPartedFileSystemExt)
public
function GetSupport: TPartedFileSystemSupport; override;
end;

TPartedFileSystemExt4 = class(TPartedFileSystemExt)
public
function GetSupport: TPartedFileSystemSupport; override;
end;

implementation

uses
Expand All @@ -48,7 +63,7 @@ implementation
function TPartedFileSystemExt.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result.CanFormat := ProgramExists('mkfs.ext2') and ProgramExists('mkfs.ext3') and ProgramExists('mkfs.ext4');
Result.CanFormat := False;
Result.CanLabel := ProgramExists('e2label');
Result.CanMove := ProgramExists('sfdisk');
Result.CanShrink := ProgramExists('resize2fs') and ProgramExists('e2fsck');
Expand Down Expand Up @@ -124,7 +139,27 @@ procedure TPartedFileSystemExt.DoResize(const PartAfter, PartBefore: PPartedPart
end;
end;

function TPartedFileSystemExt2.GetSupport: TPartedFileSystemSupport;
begin
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.ext2');
end;

function TPartedFileSystemExt3.GetSupport: TPartedFileSystemSupport;
begin
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.ext3');
end;

function TPartedFileSystemExt4.GetSupport: TPartedFileSystemSupport;
begin
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.ext4');
end;

initialization
RegisterFileSystem(TPartedFileSystemExt, ['ext2', 'ext3', 'ext4'], [1, 1, 1]);
RegisterFileSystem(TPartedFileSystemExt2, ['ext2'], [1]);
RegisterFileSystem(TPartedFileSystemExt2, ['ext3'], [1]);
RegisterFileSystem(TPartedFileSystemExt3, ['ext4'], [1]);

end.
2 changes: 1 addition & 1 deletion src/filesystem.f2fs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemF2FS.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.f2fs');
Result.CanLabel := ProgramExists('f2fslabel');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.fat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ implementation

function TPartedFileSystemFat.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.fat');
Result.CanLabel := ProgramExists('fatlabel');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.jfs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemJfs.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.jfs');
Result.CanLabel := ProgramExists('jfs_tune');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.ntfs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemNTFS.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.ntfs');
Result.CanLabel := ProgramExists('ntfslabel');
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.swap.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemSwap.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkswap');
Result.CanLabel := False;
Result.CanMove := ProgramExists('sfdisk');
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.xfs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ implementation

function TPartedFileSystemXfs.GetSupport: TPartedFileSystemSupport;
begin
inherited;
Result := inherited;
Result.CanFormat := ProgramExists('mkfs.xfs');
Result.CanLabel := ProgramExists('xfs_admin');
Result.CanMove := ProgramExists('sfdisk');
Expand Down

0 comments on commit 5628ba4

Please sign in to comment.