Changeset 57640e7 in mainline


Ignore:
Timestamp:
2011-03-02T19:26:54Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
954bf385
Parents:
9a9a58e
Message:

Replace check_magin_number() with a more efficient version

Location:
uspace/srv/fs/minixfs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/minixfs/mfs_super.c

    r9a9a58e r57640e7  
    9595static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version)
    9696{
    97         *native = true;
    98 
    99 repeat_check:
    100 
    101         switch (*native ? magic : conv16(false, magic)) {
    102         case MFS_MAGIC_V1:
     97        if (magic == MFS_MAGIC_V1 || magic == MFS_MAGIC_V1R) {
     98                *native = magic == MFS_MAGIC_V1;
    10399                *version = MFS_VERSION_V1;
    104100                return true;
    105         case MFS_MAGIC_V2:
     101        } else if (magic == MFS_MAGIC_V2 || magic == MFS_MAGIC_V2R) {
     102                *native = magic == MFS_MAGIC_V2;
    106103                *version = MFS_VERSION_V2;
    107104                return true;
    108         case MFS_MAGIC_V3:
     105        } else if (magic == MFS_MAGIC_V3 || magic == MFS_MAGIC_V3R) {
     106                *native = magic == MFS_MAGIC_V3;
    109107                *version = MFS_VERSION_V3;
    110108                return true;
    111         default:
    112                 ;
    113109        }
    114110
    115         if (*native) {
    116                 *native = false;
    117                 goto repeat_check;
    118         } else {
    119                 return false;
    120         }
    121 
    122         /*Should never happens*/
    123111        return false;
    124112}
  • uspace/srv/fs/minixfs/mfs_super.h

    r9a9a58e r57640e7  
    3838
    3939#define MFS_MAGIC_V1            0x137F
     40#define MFS_MAGIC_V1R           0x7F13
     41
    4042#define MFS_MAGIC_V2            0x2468
     43#define MFS_MAGIC_V2R           0x6824
     44
    4145#define MFS_MAGIC_V3            0x4D5A
     46#define MFS_MAGIC_V3R           0x5A4D
    4247
    4348struct mfs_superblock {
Note: See TracChangeset for help on using the changeset viewer.