Set dynamic UDF file system size limits (#787204)
UDF file system minimum and maximum size limits are defined in terms of numbers of file system blocks. So when resizing an existing file system compute the byte size limits from the existing UDF file system's block size. Alternatively when creating a new UDF file system use the device's sector size as the multiplier instead. Bug 787204 - Minimum and maximum size of the UDF partition/disk
This commit is contained in:
parent
668957c0a4
commit
ae2a8723b5
|
@ -33,6 +33,7 @@ public:
|
|||
udf() : old_mkudffs( false ) {};
|
||||
|
||||
FS get_filesystem_support();
|
||||
FS_Limits get_filesystem_limits( const Partition & partition ) const;
|
||||
void set_used_sectors( Partition & partition );
|
||||
void read_label( Partition & partition );
|
||||
bool write_label( const Partition & partition, OperationDetail & operationdetail );
|
||||
|
|
16
src/udf.cc
16
src/udf.cc
|
@ -28,9 +28,6 @@ namespace GParted
|
|||
const Byte_Value MIN_UDF_BLOCKS = 300;
|
||||
const Byte_Value MAX_UDF_BLOCKS = (1LL << 32) - 1;
|
||||
|
||||
const Byte_Value MIN_UDF_BLOCKSIZE = 512;
|
||||
const Byte_Value MAX_UDF_BLOCKSIZE = 4096;
|
||||
|
||||
FS udf::get_filesystem_support()
|
||||
{
|
||||
FS fs( FS_UDF );
|
||||
|
@ -64,12 +61,19 @@ FS udf::get_filesystem_support()
|
|||
fs.write_uuid = FS::EXTERNAL;
|
||||
}
|
||||
|
||||
fs_limits.min_size = MIN_UDF_BLOCKS * MIN_UDF_BLOCKSIZE;
|
||||
fs_limits.max_size = MAX_UDF_BLOCKS * MAX_UDF_BLOCKSIZE;
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
FS_Limits udf::get_filesystem_limits( const Partition & partition ) const
|
||||
{
|
||||
if ( partition.filesystem == FS_UDF && partition.fs_block_size > 0 )
|
||||
// Resizing existing UDF file system
|
||||
return FS_Limits( MIN_UDF_BLOCKS * partition.fs_block_size, MAX_UDF_BLOCKS * partition.fs_block_size );
|
||||
else
|
||||
// Creating new UDF file system
|
||||
return FS_Limits( MIN_UDF_BLOCKS * partition.sector_size , MAX_UDF_BLOCKS * partition.sector_size );
|
||||
}
|
||||
|
||||
void udf::set_used_sectors( Partition & partition )
|
||||
{
|
||||
exit_status = Utils::execute_command( "udfinfo --utf8 " + Glib::shell_quote( partition.get_path() ),
|
||||
|
|
Loading…
Reference in New Issue