use mkdosfs -F16 instead of libparted to create fat16 filesystems

* src/fat16: use mkdosfs -F16 instead of libparted to create fat16 filesystems
This commit is contained in:
Bart Hakvoort 2004-12-10 11:49:27 +00:00
parent c7f04242a3
commit 0e03819afc
2 changed files with 10 additions and 31 deletions

View File

@ -1,3 +1,7 @@
2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* src/fat16: use mkdosfs -F16 instead of libparted to create fat16 filesystems
2004-12-09 Bart Hakvoort <gparted@users.sf.net> 2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* src/ext2.cc, * src/ext2.cc,

View File

@ -27,6 +27,9 @@ FS fat16::get_filesystem_support( )
fs .filesystem = "fat16" ; fs .filesystem = "fat16" ;
fs .read = true ; //provided by libparted fs .read = true ; //provided by libparted
//find out if we can create fat16 filesystems
if ( ! system( "which mkdosfs 1>/dev/null 2>/dev/null" ) )
fs .create = true ; fs .create = true ;
if ( ! system( "which dosfsck 1>/dev/null 2>/dev/null" ) ) if ( ! system( "which dosfsck 1>/dev/null 2>/dev/null" ) )
@ -41,7 +44,7 @@ FS fat16::get_filesystem_support( )
fs .MIN = 32 ; fs .MIN = 32 ;
fs .MAX = 1023 ; fs .MAX = 4096 ;
return fs ; return fs ;
} }
@ -77,35 +80,7 @@ void fat16::Set_Used_Sectors( Partition & partition )
bool fat16::Create( const Glib::ustring device_path, const Partition & new_partition ) bool fat16::Create( const Glib::ustring device_path, const Partition & new_partition )
{ {
bool return_value = false ; return ! Execute_Command( "mkdosfs -F16 " + new_partition .partition ) ;
if ( open_device_and_disk( device_path, device, disk ) )
{
PedPartition *c_part = NULL ;
PedFileSystemType *fs_type = NULL ;
PedFileSystem *fs = NULL ;
c_part = ped_disk_get_partition_by_sector( disk, (new_partition .sector_end + new_partition .sector_start) / 2 ) ;
if ( c_part )
{
fs_type = ped_file_system_type_get( "fat16" ) ;
if ( fs_type )
{
fs = ped_file_system_create( & c_part ->geom, fs_type, NULL );
if ( fs )
{
if ( ped_partition_set_system(c_part, fs_type ) )
return_value = Commit( disk ) ;
ped_file_system_close( fs );
}
}
}
close_device_and_disk( device, disk) ;
}
return return_value ;
} }
bool fat16::Resize( const Partition & partition_new, bool fill_partition ) bool fat16::Resize( const Partition & partition_new, bool fill_partition )