Changeset 8ceba1e in mainline for uspace/srv/fs/minixfs/mfs_super.c


Ignore:
Timestamp:
2011-03-09T22:02:53Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c4c7f5a
Parents:
b00a2f2
Message:

Improve minixfs server check_magic_number() function

File:
1 edited

Legend:

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

    rb00a2f2 r8ceba1e  
    4040#include "../../vfs/vfs.h"
    4141
    42 static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version);
     42static bool check_magic_number(uint16_t magic, bool *native,
     43                                mfs_version_t *version, bool *longfilenames);
    4344
    4445void mfs_mounted(ipc_callid_t rid, ipc_call_t *request)
     
    4748        enum cache_mode cmode; 
    4849        struct mfs3_superblock *sp;
    49         bool native;
     50        bool native, longnames;
    5051        mfs_version_t version;
    5152
     
    8586        sp = block_bb_get(devmap_handle);
    8687
    87         if (!check_magic_number(sp->s_magic, &native, &version)) {
     88        if (!check_magic_number(sp->s_magic, &native, &version, &longnames)) {
    8889                /*Magic number is invalid!*/
    8990                block_fini(devmap_handle);
     
    9394}
    9495
    95 static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version)
     96static bool check_magic_number(uint16_t magic, bool *native,
     97                                mfs_version_t *version, bool *longfilenames)
    9698{
     99        *longfilenames = false;
     100
    97101        if (magic == MFS_MAGIC_V1 || magic == MFS_MAGIC_V1R) {
    98102                *native = magic == MFS_MAGIC_V1;
    99103                *version = MFS_VERSION_V1;
    100104                return true;
     105        } else if (magic == MFS_MAGIC_V1L || magic == MFS_MAGIC_V1LR) {
     106                *native = magic == MFS_MAGIC_V1L;
     107                *version = MFS_VERSION_V1;
     108                *longfilenames = true;
     109                return true;
    101110        } else if (magic == MFS_MAGIC_V2 || magic == MFS_MAGIC_V2R) {
    102111                *native = magic == MFS_MAGIC_V2;
    103112                *version = MFS_VERSION_V2;
     113                return true;
     114        } else if (magic == MFS_MAGIC_V2L || magic == MFS_MAGIC_V2LR) {
     115                *native = magic == MFS_MAGIC_V2L;
     116                *version = MFS_VERSION_V2;
     117                *longfilenames = true;
    104118                return true;
    105119        } else if (magic == MFS_MAGIC_V3 || magic == MFS_MAGIC_V3R) {
Note: See TracChangeset for help on using the changeset viewer.