assign2/cmpsc311_assocarr.h #ifndef CMPSC311_ASSOCARR_INCLUDED #define CMPSC311_ASSOCARR_INCLUDED //////////////////////////////////////////////////////////////////////////////// // // File :...

How long will you take to finish this?


assign2/cmpsc311_assocarr.h #ifndef CMPSC311_ASSOCARR_INCLUDED #define CMPSC311_ASSOCARR_INCLUDED //////////////////////////////////////////////////////////////////////////////// // // File : cmpsc311_assocarr.h // Description : This is the header file for the implementation of the // CMPSC311 associative array support library. Here the // array contains UNIQUE keys mapping to values (which may // or may not be unique). // // Author : Patrick McDaniel // Change Log : // // 01/25/20 - Created the intial version of the associate array // implementation // // Type definitions // Call back for the comparison of the keys and values typedef int (*compareCallback)(void *, void *); // Associate array element structure typedef struct aaElement { void *key; // THe key for this element void *value; // The value for this element struct aaElement *next; // Pointer to next element in array } AssocArrayElement; // Associative array structure typedef struct { compareCallback keyCompare; // Function pointer for compare keys compareCallback valCompare; // Function pointer for value compares int noElements; // Number of elements AssocArrayElement *elements; // The elements of the array AssocArrayElement *iterator; // The iterator for the array } AssocArray; // // Interfaces for the associatuve array int init_assoc( AssocArray *arr, compareCallback kcb, compareCallback vcb ); // Initialize the array structure int insert_assoc( AssocArray *ar, void *key, void *val ); // Insert a K/V into the associative array int delete_assoc( AssocArray *ar, void *key ); // Remove a key/value pair by key void * find_assoc( AssocArray *ar, void *key ); // Find a value by the key in the table int clear_assoc( AssocArray *ar, int freeKeys, int freeValues ); // Clear out the entire array int nextIterator( AssocArray *ar, void **key, void **value, int reset ); // Get the next value in the interator (see .c for important note) /* Generic Callback Functions */ int int32CompareCallback( void *arga, void *argb ); // Usable callback for 32-bit integer keys/values int uint32CompareCallback( void *arga, void *argb ); // Usable callback for 32-bit integer keys/values int int8CompareCallback( void *arga, void *argb ); // Usable callback for 32-bit integer keys/values int uint8CompareCallback( void *arga, void *argb ); // Usable callback for 32-bit integer keys/values int stringCompareCallback( void *arga, void *argb ); // Usable callback for "C" string keys/values int pointerCompareCallback( void *arga, void *argb ); // Usable callback for generic pointers (order by address) /* Unit tests */ int unit_test_assoc( void ); // Unit test the associative array implementation #endif assign2/lcloud_filesys.c //////////////////////////////////////////////////////////////////////////////// // // File : lcloud_filesys.c // Description : This is the implementation of the Lion Cloud device // filesystem interfaces. // // Author : *** INSERT YOUR NAME *** // Last Modified : *** DATE *** // // Include files #include #include #include // Project include files #include #include // // File system interface implementation //////////////////////////////////////////////////////////////////////////////// // // Function : lcopen // Description : Open the file for for reading and writing // // Inputs : path - the path/filename of the file to be read // Outputs : file handle if successful test, -1 if failure LcFHandle lcopen( const char *path ) { return( 0 ); // Likely wrong } //////////////////////////////////////////////////////////////////////////////// // // Function : lcread // Description : Read data from the file // // Inputs : fh - file handle for the file to read from // buf - place to put the data // len - the length of the read // Outputs : number of bytes read, -1 if failure int lcread( LcFHandle fh, char *buf, size_t len ) { return( 0 ); } //////////////////////////////////////////////////////////////////////////////// // // Function : lcwrite // Description : write data to the file // // Inputs : fh - file handle for the file to write to // buf - pointer to data to write // len - the length of the write // Outputs : number of bytes written if successful test, -1 if failure int lcwrite( LcFHandle fh, char *buf, size_t len ) { return( 0 ); } //////////////////////////////////////////////////////////////////////////////// // // Function : lcseek // Description : Seek to a specific place in the file // // Inputs : fh - the file handle of the file to seek in // off - offset within the file to seek to // Outputs : 0 if successful test, -1 if failure int lcseek( LcFHandle fh, size_t off ) { return( 0 ); } //////////////////////////////////////////////////////////////////////////////// // // Function : lcclose // Description : Close the file // // Inputs : fh - the file handle of the file to close // Outputs : 0 if successful test, -1 if failure int lcclose( LcFHandle fh ) { return( 0 ); } //////////////////////////////////////////////////////////////////////////////// // // Function : lcshutdown // Description : Shut down the filesystem // // Inputs : none // Outputs : 0 if successful test, -1 if failure int lcshutdown( void ) { return( 0 ); } assign2/cmpsc311-assign2-sample-output.txt Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LionCloud simulation opened manifest [cmpsc311-assign2-manifest.txt] Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LionCloud new device added [id=5, sec=10, blks=64] Mon Feb 10 10:16:36 2020 [INFO] Opened workload for reading, [cmpsc311-assign2-workload.txt]. Mon Feb 10 10:16:36 2020 [LCLOUD_SIMULATOR] CMPSC311 lcloud : executing workload [cmpsc311-assign2-workload.txt] Mon Feb 10 10:16:36 2020 [LCLOUD_SIMULATOR] CMPSCS311 workload op: sample-filesystem-file.txt OPEN Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Initialzing Lion Cloud system ... Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Received LC request [0] Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] OPCODE VALUE Lion Cloud System { Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C2 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] }; Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Device [5] powered on ... Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LC system powered on/off. Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Sending LC response [1100000000000000] Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] OPCODE VALUE Lion Cloud System { Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B0 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B1 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C2 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] }; Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Received LC request [1000000000000] Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] OPCODE VALUE Lion Cloud System { Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C0 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C2 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D0 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_D1 = 0 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] }; Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LC device process completed. Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] Sending LC response [1101000000200000] Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] OPCODE VALUE Lion Cloud System { Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B0 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_B1 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER] LCLOUD_REG_C0 = 1 Mon Feb 10 10:16:36 2020 [LCLOUD_CONTROLLER]
Feb 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here