Changeset 9e3dc95 in mainline
- 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
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/Makefile
r819450a r9e3dc95 34 34 35 35 SOURCES = \ 36 mfs.c 36 mfs.c \ 37 mfs_super.c \ 38 mfs_utils.c 37 39 38 40 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/fs/minixfs/mfs_const.h
r819450a r9e3dc95 38 38 #include <bool.h> 39 39 40 #define MFS_MAGIC_V1 0x137F41 #define MFS_MAGIC_V2 0x246842 #define MFS_MAGIC_V3 0x4D5A43 44 40 #define MFS_ROOT_INO 1 45 41 #define MFS_SUPER_BLOCK 0 -
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 -
uspace/srv/fs/minixfs/mfs_super.h
r819450a r9e3dc95 37 37 #include "../../vfs/vfs.h" 38 38 39 #define MFS_MAGIC_V1 0x137F 40 #define MFS_MAGIC_V2 0x2468 41 #define MFS_MAGIC_V3 0x4D5A 42 39 43 struct mfs_superblock { 40 44 /*Total number of inodes on the device*/ … … 67 71 } __attribute__ ((packed)); 68 72 73 typedef enum { 74 MFS_VERSION_V1 = 1, 75 MFS_VERSION_V2, 76 MFS_VERSION_V3 77 } mfs_version_t; 78 69 79 void mfs_mounted(ipc_callid_t rid, ipc_call_t *request); 70 80 -
uspace/srv/fs/minixfs/mfs_utils.c
r819450a r9e3dc95 38 38 return n; 39 39 40 return r =(n << 8) | (n >> 8);40 return (n << 8) | (n >> 8); 41 41 } 42 42
Note:
See TracChangeset
for help on using the changeset viewer.