Parts of the code was contributed by Jo Agila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
outFile.write(" interface LogRead[uint8_t volumeId]; \n")
outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
-# outFile.write(" interface Mount[uint8_t volumeId]; \n")
-# outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" interface Mount as ConfigMount[uint8_t volumeId]; \n")
+ outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
outFile.write(" } \n")
outFile.write("} \n")
outFile.write("\n")
outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
outFile.write("\n")
-# elif volumeTypes[volumeNames[i]] == "config":
-# outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ elif volumeTypes[volumeNames[i]] == "config":
+ outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigMount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
outFile.write("} \n")
outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
outFile.write(" interface LogRead[uint8_t volumeId]; \n")
outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
-# outFile.write(" interface Mount[uint8_t volumeId]; \n")
-# outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" interface Mount as ConfigMount[uint8_t volumeId]; \n")
+ outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
outFile.write(" } \n")
outFile.write("} \n")
outFile.write("\n")
outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
outFile.write("\n")
-# elif volumeTypes[volumeNames[i]] == "config":
-# outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ elif volumeTypes[volumeNames[i]] == "config":
+ outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigMount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
outFile.write("} \n")
outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
outFile.write(" interface LogRead[uint8_t volumeId]; \n")
outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
-# outFile.write(" interface Mount[uint8_t volumeId]; \n")
-# outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" interface Mount as ConfigMount[uint8_t volumeId]; \n")
+ outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
outFile.write(" } \n")
outFile.write("} \n")
outFile.write("\n")
outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
outFile.write("\n")
-# elif volumeTypes[volumeNames[i]] == "config":
-# outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
-# outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ elif volumeTypes[volumeNames[i]] == "config":
+ outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigMount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
outFile.write("} \n")
--- /dev/null
+/*
+ * Copyright (c) 2009 RWTH Aachen University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written
+ * agreement is hereby granted, provided that the above copyright
+ * notice, the (updated) modification history and the author appear in
+ * all copies of this source code.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
+ * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * @author J\97 çgila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
+ */
+
+configuration CConfigStorageC {}
+
+implementation {
+ components CConfigStorageP,
+ BlockingConfigStorageP,
+ VolumeMapC;
+
+ CConfigStorageP.BlockingConfig -> BlockingConfigStorageP;
+ CConfigStorageP.BlockingMount -> BlockingConfigStorageP;
+
+ BlockingConfigStorageP.ConfigMount -> VolumeMapC.ConfigMount;
+ BlockingConfigStorageP.ConfigStorage -> VolumeMapC.ConfigStorage;
+}
--- /dev/null
+/*
+ * Copyright (c) 2009 RWTH Aachen University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written
+ * agreement is hereby granted, provided that the above copyright
+ * notice, the (updated) modification history and the author appear in
+ * all copies of this source code.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
+ * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * @author J\97 çgila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
+ * @author Chieh-Jan Mike Liang <cliang4@cs.jhu.edu>
+ */
+
+module CConfigStorageP {
+ uses {
+ interface BlockingConfig[uint8_t volume_id];
+ interface BlockingMount[uint8_t volume_id];
+ }
+}
+
+implementation {
+ error_t volumeConfigMount(uint8_t volumeId) @C() AT_SPONTANEOUS {
+ return call BlockingMount.mount[volumeId]();
+ }
+
+ error_t volumeConfigRead(uint8_t volumeId, storage_addr_t addr, void* buf, storage_len_t* len) @C() AT_SPONTANEOUS {
+ return call BlockingConfig.read[volumeId](addr, buf, len);
+ }
+
+ error_t volumeConfigWrite(uint8_t volumeId, storage_addr_t addr, void* buf, storage_len_t* len) @C() AT_SPONTANEOUS {
+ return call BlockingConfig.write[volumeId](addr, buf, len);
+ }
+
+ error_t volumeConfigCommit(uint8_t volumeId) @C() AT_SPONTANEOUS {
+ return call BlockingConfig.commit[volumeId]();
+ }
+
+ storage_len_t volumeConfigGetSize(uint8_t volumeId) @C() AT_SPONTANEOUS {
+ return call BlockingConfig.getSize[volumeId]();
+ }
+
+ bool volumeConfigValid(uint8_t volumeId) @C() AT_SPONTANEOUS {
+ return call BlockingConfig.valid[volumeId]();
+ }
+}
/**
* @author Kevin Klues <klueska@cs.stanford.edu>
+ * @author Chieh-Jan Mike Liang <cliang4@cs.jhu.edu>
*/
#include "tosthread.h"
#if defined(TOSTHREAD_LOGSTORAGE_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
components CLogStorageC;
#endif
+ #if defined(TOSTHREAD_CONFIGSTORAGE_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
+ components CConfigStorageC;
+ #endif
#if defined(TOSTHREAD_COLLECTION_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
components CCollectionC;
#endif
/**
* @author Chieh-Jan Mike Liang <cliang4@cs.jhu.edu>
+ * @author J\97 çgila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
*/
configuration VolumeMapC {
interface BlockWrite[uint8_t volume_id];
interface LogRead[uint8_t volume_id];
interface LogWrite[uint8_t volume_id];
+ interface ConfigStorage[uint8_t volume_id];
+ interface Mount[uint8_t volume_id];
}
}
BlockWrite = VolumeMapP;
LogRead = VolumeMapP;
LogWrite = VolumeMapP;
+
+ ConfigStorage = VolumeMapP;
+ Mount = VolumeMapP;
}
/**
* @author Chieh-Jan Mike Liang <cliang4@cs.jhu.edu>
+ * @author J\97 çgila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
*/
module VolumeMapP {
interface BlockWrite[uint8_t volume_id];
interface LogRead[uint8_t volume_id];
interface LogWrite[uint8_t volume_id];
+ interface ConfigStorage[uint8_t volume_id];
+ interface Mount[uint8_t volume_id];
}
uses {
interface BlockWrite as SubBlockWrite[uint8_t volume_id];
interface LogRead as SubLogRead[uint8_t volume_id];
interface LogWrite as SubLogWrite[uint8_t volume_id];
+ interface ConfigStorage as SubConfigStorage[uint8_t volume_id];
+ interface Mount as SubMount[uint8_t volume_id];
}
}
default event void LogWrite.appendDone[uint8_t volume_id](void* buf, storage_len_t len, bool recordsLost, error_t error) {}
default event void LogWrite.eraseDone[uint8_t volume_id](error_t error) {}
default event void LogWrite.syncDone[uint8_t volume_id](error_t error) {}
+
+ command error_t ConfigStorage.read[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len) {
+ return call SubConfigStorage.read[volume_id](addr, buf, len);
+ }
+
+ event void SubConfigStorage.readDone[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {
+ signal ConfigStorage.readDone[volume_id](addr, buf, len, error);
+ }
+
+ command error_t ConfigStorage.write[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len) {
+ return call SubConfigStorage.write[volume_id](addr, buf, len);
+ }
+
+ event void SubConfigStorage.writeDone[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {
+ signal ConfigStorage.writeDone[volume_id](addr, buf, len, error);
+ }
+
+ command error_t ConfigStorage.commit[uint8_t volume_id]() {
+ return call SubConfigStorage.commit[volume_id]();
+ }
+
+ event void SubConfigStorage.commitDone[uint8_t volume_id](error_t error) {
+ signal ConfigStorage.commitDone[volume_id](error);
+ }
+
+ command storage_len_t ConfigStorage.getSize[uint8_t volume_id]() {
+ return call SubConfigStorage.getSize[volume_id]();
+ }
+
+ command bool ConfigStorage.valid[uint8_t volume_id]() {
+ return call SubConfigStorage.valid[volume_id]();
+ }
+
+ command error_t Mount.mount[uint8_t volume_id]() {
+ return call SubMount.mount[volume_id]();
+ }
+
+ event void SubMount.mountDone[uint8_t volume_id](error_t error) {
+ signal Mount.mountDone[volume_id](error);
+ }
+
+ default command error_t SubConfigStorage.read[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len) {
+ return FAIL;
+ }
+
+ default command error_t SubConfigStorage.write[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len) {
+ return FAIL;
+ }
+
+ default command error_t SubConfigStorage.commit[uint8_t volume_id]() {
+ return FAIL;
+ }
+
+ default command storage_len_t SubConfigStorage.getSize[uint8_t volume_id]() {
+ return FAIL;
+ }
+
+ default command bool SubConfigStorage.valid[uint8_t volume_id]() {
+ return FAIL;
+ }
+
+ default command error_t SubMount.mount[uint8_t volume_id]() {
+ return FAIL;
+ }
+
+ default event void ConfigStorage.commitDone[uint8_t volume_id](error_t error) {}
+ default event void ConfigStorage.writeDone[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
+ default event void ConfigStorage.readDone[uint8_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
+ default event void Mount.mountDone[uint8_t volume_id](error_t error) {}
}
--- /dev/null
+/*
+ * Copyright (c) 2009 RWTH Aachen University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written
+ * agreement is hereby granted, provided that the above copyright
+ * notice, the (updated) modification history and the author appear in
+ * all copies of this source code.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
+ * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/**
+ * @author J\97 çgila Bitsch Link <jo.bitsch@cs.rwth-aachen.de>
+ */
+
+#ifndef TOSTHREAD_CONFIGSTORAGE_H
+#define TOSTHREAD_CONFIGSTORAGE_H
+
+#include "Storage.h"
+
+extern error_t volumeConfigMount(uint8_t volumeId);
+extern error_t volumeConfigRead(uint8_t volumeId, storage_addr_t addr, void* buf, storage_len_t* len);
+extern error_t volumeConfigWrite(uint8_t volumeId, storage_addr_t addr, void* buf, storage_len_t* len);
+extern error_t volumeConfigCommit(uint8_t volumeId);
+extern storage_len_t volumeConfigGetSize(uint8_t volumeId);
+extern bool volumeConfigValid(uint8_t volumeId);
+
+#endif // TOSTHREAD_CONFIGSTORAGE_H