Support XFS5
This commit is contained in:
parent
8cd58b321c
commit
eb48734418
5 changed files with 33 additions and 26 deletions
|
@ -119,6 +119,7 @@ static int is_linux(const partition_t *partition)
|
|||
case UP_XFS2:
|
||||
case UP_XFS3:
|
||||
case UP_XFS4:
|
||||
case UP_XFS5:
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -271,6 +271,7 @@ enum upart_type {
|
|||
UP_XFS2,
|
||||
UP_XFS3,
|
||||
UP_XFS4,
|
||||
UP_XFS5,
|
||||
UP_ZFS};
|
||||
typedef enum upart_type upart_type_t;
|
||||
enum status_type { STATUS_DELETED, STATUS_PRIM, STATUS_PRIM_BOOT, STATUS_LOG, STATUS_EXT, STATUS_EXT_IN_EXT};
|
||||
|
|
|
@ -137,6 +137,7 @@ static const struct systypes none_sys_types[] = {
|
|||
{UP_XFS2, "XFS 2"},
|
||||
{UP_XFS3, "XFS 3"},
|
||||
{UP_XFS4, "XFS 4"},
|
||||
{UP_XFS5, "XFS 5"},
|
||||
{UP_ZFS, "ZFS"},
|
||||
{ 0,NULL }
|
||||
};
|
||||
|
@ -451,6 +452,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
|
|||
case UP_XFS2:
|
||||
case UP_XFS3:
|
||||
case UP_XFS4:
|
||||
case UP_XFS5:
|
||||
ret=check_xfs(disk_car,partition,verbose);
|
||||
break;
|
||||
case UP_ZFS:
|
||||
|
|
54
src/xfs.c
54
src/xfs.c
|
@ -38,8 +38,8 @@
|
|||
#include "log.h"
|
||||
#include "guid_cpy.h"
|
||||
|
||||
static int set_xfs_info(const struct xfs_sb *sb, partition_t *partition);
|
||||
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose);
|
||||
static void set_xfs_info(const struct xfs_sb *sb, partition_t *partition);
|
||||
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, const partition_t *partition, const int verbose);
|
||||
|
||||
int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose)
|
||||
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, const partition_t *partition, const int verbose)
|
||||
{
|
||||
if(sb->sb_magicnum!=be32(XFS_SB_MAGIC) ||
|
||||
(uint16_t)be16(sb->sb_sectsize) != (1U << sb->sb_sectlog) ||
|
||||
|
@ -69,20 +69,13 @@ static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t
|
|||
switch(be16(sb->sb_versionnum) & XFS_SB_VERSION_NUMBITS)
|
||||
{
|
||||
case XFS_SB_VERSION_1:
|
||||
partition->upart_type = UP_XFS;
|
||||
break;
|
||||
case XFS_SB_VERSION_2:
|
||||
partition->upart_type = UP_XFS2;
|
||||
break;
|
||||
case XFS_SB_VERSION_3:
|
||||
partition->upart_type = UP_XFS3;
|
||||
break;
|
||||
case XFS_SB_VERSION_4:
|
||||
partition->upart_type = UP_XFS4;
|
||||
case XFS_SB_VERSION_5:
|
||||
break;
|
||||
default:
|
||||
log_error("Unknown XFS version %x\n",be16(sb->sb_versionnum)& XFS_SB_VERSION_NUMBITS);
|
||||
partition->upart_type = UP_XFS4;
|
||||
log_error("Unknown XFS version 0x%x\n",be16(sb->sb_versionnum)& XFS_SB_VERSION_NUMBITS);
|
||||
break;
|
||||
}
|
||||
if(verbose>0)
|
||||
|
@ -102,43 +95,52 @@ int recover_xfs(disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition
|
|||
dump_log(sb,DEFAULT_SECTOR_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
set_xfs_info(sb, partition);
|
||||
partition->part_size = (uint64_t)be64(sb->sb_dblocks) * be32(sb->sb_blocksize);
|
||||
partition->part_type_i386=P_LINUX;
|
||||
partition->part_type_mac=PMAC_LINUX;
|
||||
partition->part_type_sun=PSUN_LINUX;
|
||||
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_DATA;
|
||||
set_xfs_info(sb, partition);
|
||||
guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb->sb_uuid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_xfs_info(const struct xfs_sb *sb, partition_t *partition)
|
||||
static void set_xfs_info(const struct xfs_sb *sb, partition_t *partition)
|
||||
{
|
||||
partition->blocksize=be32(sb->sb_blocksize);
|
||||
partition->fsname[0]='\0';
|
||||
partition->info[0]='\0';
|
||||
switch(partition->upart_type)
|
||||
switch(be16(sb->sb_versionnum) & XFS_SB_VERSION_NUMBITS)
|
||||
{
|
||||
case UP_XFS:
|
||||
case XFS_SB_VERSION_1:
|
||||
partition->upart_type = UP_XFS;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS <=6.1 blocksize=%u", partition->blocksize);
|
||||
"XFS <=6.1, blocksize=%u", partition->blocksize);
|
||||
break;
|
||||
case UP_XFS2:
|
||||
case XFS_SB_VERSION_2:
|
||||
partition->upart_type = UP_XFS2;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS 6.2 - attributes blocksize=%u", partition->blocksize);
|
||||
"XFS 6.2 - attributes, blocksize=%u", partition->blocksize);
|
||||
break;
|
||||
case UP_XFS3:
|
||||
case XFS_SB_VERSION_3:
|
||||
partition->upart_type = UP_XFS3;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS 6.2 - new inode version blocksize=%u", partition->blocksize);
|
||||
"XFS 6.2 - new inode version, blocksize=%u", partition->blocksize);
|
||||
break;
|
||||
case UP_XFS4:
|
||||
case XFS_SB_VERSION_4:
|
||||
partition->upart_type = UP_XFS4;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS 6.2+ - bitmap version blocksize=%u", partition->blocksize);
|
||||
"XFS 6.2+ - bitmap version, blocksize=%u", partition->blocksize);
|
||||
break;
|
||||
case XFS_SB_VERSION_5:
|
||||
partition->upart_type = UP_XFS5;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS CRC enabled, blocksize=%u", partition->blocksize);
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
snprintf(partition->info, sizeof(partition->info),
|
||||
"XFS unknown version %u\n", be16(sb->sb_versionnum)& XFS_SB_VERSION_NUMBITS);
|
||||
break;
|
||||
}
|
||||
set_part_name(partition,sb->sb_fname,12);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ extern "C" {
|
|||
#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */
|
||||
#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */
|
||||
#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */
|
||||
#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */
|
||||
#define XFS_SB_VERSION_NUMBITS 0x000f
|
||||
|
||||
typedef uint32_t xfs_extlen_t; /* extent length in blocks */
|
||||
|
|
Loading…
Reference in a new issue