Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (5 years ago)
Author:
bruno
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/util-linux/volume_id/ext.c

    r2725 r3232  
    2020
    2121#include "volume_id_internal.h"
     22#include "bb_e2fs_defs.h"
    2223
    23 struct ext2_super_block {
    24     uint32_t    inodes_count;
    25     uint32_t    blocks_count;
    26     uint32_t    r_blocks_count;
    27     uint32_t    free_blocks_count;
    28     uint32_t    free_inodes_count;
    29     uint32_t    first_data_block;
    30     uint32_t    log_block_size;
    31     uint32_t    dummy3[7];
    32     uint8_t magic[2];
    33     uint16_t    state;
    34     uint32_t    dummy5[8];
    35     uint32_t    feature_compat;
    36     uint32_t    feature_incompat;
    37     uint32_t    feature_ro_compat;
    38     uint8_t uuid[16];
    39     uint8_t volume_name[16];
    40 } PACKED;
    41 
    42 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL     0x00000004
    43 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV   0x00000008
    4424#define EXT_SUPERBLOCK_OFFSET           0x400
    4525
     
    5535        return -1;
    5636
    57     if (es->magic[0] != 0123 || es->magic[1] != 0357) {
     37    if (es->s_magic != cpu_to_le16(EXT2_SUPER_MAGIC)) {
    5838        dbg("ext: no magic found");
    5939        return -1;
     
    6242//  volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
    6343//  volume_id_set_label_raw(id, es->volume_name, 16);
    64     volume_id_set_label_string(id, es->volume_name, 16);
    65     volume_id_set_uuid(id, es->uuid, UUID_DCE);
     44    volume_id_set_label_string(id, (void*)es->s_volume_name, 16);
     45    volume_id_set_uuid(id, es->s_uuid, UUID_DCE);
    6646    dbg("ext: label '%s' uuid '%s'", id->label, id->uuid);
    6747
    68 //  if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0)
    69 //      id->type = "ext3";
    70 //  else
    71 //      id->type = "ext2";
    72 
     48#if ENABLE_FEATURE_BLKID_TYPE
     49    if ((es->s_feature_ro_compat & cpu_to_le32(EXT4_FEATURE_RO_COMPAT_HUGE_FILE | EXT4_FEATURE_RO_COMPAT_DIR_NLINK))
     50     || (es->s_feature_incompat & cpu_to_le32(EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_64BIT))
     51    ) {
     52        id->type = "ext4";
     53    }
     54    else if (es->s_feature_compat & cpu_to_le32(EXT3_FEATURE_COMPAT_HAS_JOURNAL))
     55        id->type = "ext3";
     56    else
     57        id->type = "ext2";
     58#endif
    7359    return 0;
    7460}
Note: See TracChangeset for help on using the changeset viewer.