Changeset 9e3dc95 in mainline for uspace/srv/fs/minixfs/mfs_super.c
- Timestamp:
- 2011-03-01T22:10:16Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9a9a58e
- Parents:
- 819450a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs_super.c
r819450a r9e3dc95 31 31 */ 32 32 33 #include <libfs.h> 34 #include <stdlib.h> 35 #include <libblock.h> 36 #include <errno.h> 37 #include <str.h> 33 38 #include "mfs_super.h" 39 #include "mfs_utils.h" 40 #include "../../vfs/vfs.h" 41 42 static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version); 34 43 35 44 void mfs_mounted(ipc_callid_t rid, ipc_call_t *request) … … 38 47 enum cache_mode cmode; 39 48 struct mfs_superblock *sp; 49 bool native; 50 mfs_version_t version; 40 51 41 52 /* Accept the mount options */ … … 73 84 /* get the buffer with the superblock */ 74 85 sp = block_bb_get(devmap_handle); 86 87 if (!check_magic_number(sp->s_magic, &native, &version)) { 88 /*Magic number is invalid!*/ 89 block_fini(devmap_handle); 90 async_answer_0(rid, ENOTSUP); 91 return; 92 } 93 } 94 95 static bool check_magic_number(int16_t magic, bool *native, mfs_version_t *version) 96 { 97 *native = true; 98 99 repeat_check: 100 101 switch (*native ? magic : conv16(false, magic)) { 102 case MFS_MAGIC_V1: 103 *version = MFS_VERSION_V1; 104 return true; 105 case MFS_MAGIC_V2: 106 *version = MFS_VERSION_V2; 107 return true; 108 case MFS_MAGIC_V3: 109 *version = MFS_VERSION_V3; 110 return true; 111 default: 112 ; 113 } 114 115 if (*native) { 116 *native = false; 117 goto repeat_check; 118 } else { 119 return false; 120 } 121 122 /*Should never happens*/ 123 return false; 75 124 } 76 125
Note:
See TracChangeset
for help on using the changeset viewer.