White space tidy-up of Utils::get_filesystem_maxlength()

Use smart tab alignment; indent with tabs and align with spaces.  Also
remove entries for lvm2 pv and minix which don't support labels, adding
a comment as to why.
This commit is contained in:
Mike Fleetwood 2024-04-12 08:22:15 +01:00
parent f5b70fbfab
commit 8f3395ffb0
1 changed files with 42 additions and 42 deletions

View File

@ -255,53 +255,53 @@ int Utils::get_max_partition_name_length( Glib::ustring & tabletype )
int Utils::get_filesystem_label_maxlength(FSType fstype) int Utils::get_filesystem_label_maxlength(FSType fstype)
{ {
// Only file systems which can have labels, either set when created or changed
// afterwards, need a maximum length defining.
switch (fstype) switch (fstype)
{ {
//All file systems commented out are not supported for labelling case FS_BTRFS: return 255;
// by either the new partition or label partition operations. case FS_EXFAT: return 11;
case FS_BTRFS : return 255 ; case FS_EXT2: return 16;
case FS_EXFAT : return 11; case FS_EXT3: return 16;
case FS_EXT2 : return 16 ; case FS_EXT4: return 16;
case FS_EXT3 : return 16 ;
case FS_EXT4 : return 16 ;
// mkfs.f2fs supports labels up to 512 characters, however only blkid is // mkfs.f2fs supports labels up to 512 characters, however only blkid is
// used to read the label and that only displays the first 127 characters. // used to read the label and that only displays the first 127 characters.
case FS_F2FS : return 127; case FS_F2FS: return 127;
case FS_FAT16 : return 11 ; case FS_FAT16: return 11;
case FS_FAT32 : return 11 ; case FS_FAT32: return 11;
//mkfs.hfsplus can create hfs and hfs+ file systems with labels up to 255
// mkfs.hfsplus can create hfs and hfs+ file systems with labels up to 255
// characters. However there is no specific tool to read the labels and // characters. However there is no specific tool to read the labels and
// blkid, the only tool currently available, only display the first 27 // blkid, the only tool currently available, only display the first 27 and
// and 63 character respectively. // 63 character respectively.
// Reference: // Reference:
// util-linux-2.20.1/libblkid/src/superblocks/hfs.c:struct hfs_mdb // util-linux-2.20.1/libblkid/src/superblocks/hfs.c:struct hfs_mdb
case FS_HFS : return 27 ; case FS_HFS: return 27;
case FS_HFSPLUS : return 63 ; case FS_HFSPLUS: return 63;
//mkfs.jfs and jfs_tune can create and update labels to 16 characters but
// mkfs.jfs and jfs_tune can create and update labels to 16 characters but
// only displays the first 11 characters. This is because version 1 jfs // only displays the first 11 characters. This is because version 1 jfs
// file systems only have an 11 character field for the label but version // file systems only have an 11 character field for the label but version
// 2 jfs has extra fields containing a 16 character label. mkfs.jfs // 2 jfs has extra fields containing a 16 character label. mkfs.jfs
// writes the extra fields containing the 16 character label, but then // writes the extra fields containing the 16 character label, but then
// sets it to version 1 jfs. It does this to be backwardly compatible // sets it to version 1 jfs. It does this to be backwardly compatible
// with jfs before 1.0.18, released May 2002. Blkid does display the // with jfs before 1.0.18, released May 2002. Blkid does display the full
// full 16 character label by just ignoring the file system version. // 16 character label by just ignoring the file system version. As using
// As using jfs_tune to get the label stick with an 11 character limit. // jfs_tune to read the label stick with an 11 character limit.
// References: // References:
// jfsutils-1.1.15/tune/tune.c:main() // jfsutils-1.1.15/tune/tune.c:main()
// jfsutils-1.1.15/mkfs/mkfs.c:create_aggregate() // jfsutils-1.1.15/mkfs/mkfs.c:create_aggregate()
// http://jfs.cvs.sourceforge.net/viewvc/jfs/jfsutils/NEWS?revision=HEAD // http://jfs.cvs.sourceforge.net/viewvc/jfs/jfsutils/NEWS?revision=HEAD
case FS_JFS : return 11 ; case FS_JFS: return 11;
case FS_LINUX_SWAP : return 15 ; case FS_LINUX_SWAP: return 15;
//case FS_LVM2_PV : return ; case FS_NILFS2: return 80;
case FS_MINIX : return 0; // MINIX doesn't support labelling. case FS_NTFS: return 128;
case FS_NILFS2 : return 80 ; case FS_REISER4: return 16;
case FS_NTFS : return 128 ; case FS_REISERFS: return 16;
case FS_REISER4 : return 16 ; case FS_UDF: return 126; // and only 63 if label contains character above U+FF
case FS_REISERFS : return 16 ; case FS_XFS: return 12;
case FS_UDF : return 126; // and only 63 if label contains character above U+FF default: return 30;
case FS_XFS : return 12 ;
default : return 30 ;
} }
} }