SMREmulator 1.0
ShingledMagneticRecordingEmulator

ediversion.c

Go to the documentation of this file.
00001 
00011 #include <stdlib.h>
00012 #include <string.h>
00013 
00014 #include <ediversion.h>
00015 
00016 
00017 
00018 /* -- External References -- */
00019 extern edi_vops_t* ediv0_init();
00020 
00021 
00022 
00023 /* -- Function Implementations -- */
00024 
00034 int ediv_init() {
00035         int retval = 0;
00036 
00037 
00038         /* Initialize the data structures */
00039         memset(&edi_versions, 0, sizeof(edi_vops_t*) * (MAX_EDI_VERSION + 1));
00040 
00041 
00042         /* Initialize each version supported by the Emulator Versioning module */
00043         /* =================================================================== */
00044         dbg("Initializing versions...\n");
00045 
00046         /* Version 0 */
00047         if ((edi_versions[0] = ediv0_init()) == NULL) {
00048                 dbg("Version 0 initialization failed!\n");
00049                 retval = -1;
00050         }
00051         dbg("Version 0 initialized\n");
00052 
00053 
00054         /* TODO Add initialization for future versions here */
00055 
00056         return retval;
00057 }
00058 
00059 
00060 
00068 int ediv_is_valid(uint32_t version) {
00069         /* Ensure that the version is less than the Max version supported */
00070         return (version <= MAX_EDI_VERSION);
00071 }