Changeset 57640e7 in mainline for uspace/srv/fs/minixfs/mfs_super.c


Ignore:
Timestamp:
2011-03-02T19:26:54Z (14 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

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.