mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-06 13:27:43 +00:00
fix(utils): map verified Linux filesystem magic values (#3051)
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
/// "61756673" => "AUFS",
|
||||
/// "ef51" => "EXT2OLD",
|
||||
/// "2fc12fc1" => "zfs",
|
||||
/// "ff534d42" => "cifs",
|
||||
/// "53464846" => "wslfs",
|
||||
pub(crate) fn get_fs_type(fs_type: u64) -> &'static str {
|
||||
// Magic numbers for various filesystems.
|
||||
@@ -37,6 +36,16 @@ pub(crate) fn get_fs_type(fs_type: u64) -> &'static str {
|
||||
0x52654973 => "REISERFS",
|
||||
0x58465342 => "XFS",
|
||||
0x9123683E => "BTRFS",
|
||||
0x00c36400 => "CEPH",
|
||||
0x2011BAB0 => "EXFAT",
|
||||
0xE0F5E1E2 => "EROFS",
|
||||
0xF2F52010 => "F2FS",
|
||||
0x9660 => "ISOFS",
|
||||
0x65735546 => "FUSE",
|
||||
0x73717368 => "SQUASHFS",
|
||||
0xFF534D42 => "CIFS",
|
||||
0xFE534D42 => "SMB2",
|
||||
0xca451a4e => "BCACHEFS",
|
||||
_ => "UNKNOWN",
|
||||
}
|
||||
}
|
||||
@@ -50,4 +59,18 @@ mod tests {
|
||||
assert_eq!(get_fs_type(0x58465342), "XFS");
|
||||
assert_eq!(get_fs_type(0x9123683E), "BTRFS");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn map_verified_linux_uapi_filesystem_magic_numbers() {
|
||||
assert_eq!(get_fs_type(0x00c36400), "CEPH");
|
||||
assert_eq!(get_fs_type(0x2011BAB0), "EXFAT");
|
||||
assert_eq!(get_fs_type(0xE0F5E1E2), "EROFS");
|
||||
assert_eq!(get_fs_type(0xF2F52010), "F2FS");
|
||||
assert_eq!(get_fs_type(0x9660), "ISOFS");
|
||||
assert_eq!(get_fs_type(0x65735546), "FUSE");
|
||||
assert_eq!(get_fs_type(0x73717368), "SQUASHFS");
|
||||
assert_eq!(get_fs_type(0xFF534D42), "CIFS");
|
||||
assert_eq!(get_fs_type(0xFE534D42), "SMB2");
|
||||
assert_eq!(get_fs_type(0xca451a4e), "BCACHEFS");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(any(target_os = "linux", test))]
|
||||
mod fs_type;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
|
||||
Reference in New Issue
Block a user