[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/Deluge/BlockStorageManager BlockReaderC.nc, NONE, 1.1 BlockStorageLockC.nc, NONE, 1.1 BlockStorageLockClientC.nc, NONE, 1.1 BlockStorageManager.h, NONE, 1.1 BlockStorageManagerC.nc, NONE, 1.1 BlockStorageManagerP.nc, NONE, 1.1 BlockWriterC.nc, NONE, 1.1 VolumeId.nc, NONE, 1.1 VolumeIdC.nc, NONE, 1.1

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Sun Jan 13 20:22:04 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/Deluge/BlockStorageManager
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20053/tos/lib/net/Deluge/BlockStorageManager

Added Files:
	BlockReaderC.nc BlockStorageLockC.nc 
	BlockStorageLockClientC.nc BlockStorageManager.h 
	BlockStorageManagerC.nc BlockStorageManagerP.nc 
	BlockWriterC.nc VolumeId.nc VolumeIdC.nc 
Log Message:
Super Duper update to Deluge T2. The manual and the testing scripts are temporary out-of-date.

Some of the improvements are:
- simplified images (ident and metadata were merged)
- network-order representation of fields
- new version of tinyos.py
- improved sharing of volumes.


--- NEW FILE: BlockReaderC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

#include "BlockStorageManager.h"
#include "Storage.h"

generic configuration BlockReaderC(volume_id_t id)
{
  provides {
    interface BlockRead;
    interface Resource;
  }
}

implementation
{
  enum {
    CLIENT_ID = unique(UQ_BSTORAGEM_CLIENT)
  };

  components new VolumeIdC(id);
  components BlockStorageManagerC;
  components new BlockStorageLockClientC();

  BlockRead = BlockStorageManagerC.BlockRead[CLIENT_ID];
  Resource = BlockStorageLockClientC;
  BlockStorageManagerC.VolumeId[CLIENT_ID] -> VolumeIdC;
}

--- NEW FILE: BlockStorageLockC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

configuration BlockStorageLockC
{
  provides {
    interface Resource[uint8_t client];
    interface ArbiterInfo;
  }
}

implementation
{
  components new SimpleFcfsArbiterC(UQ_BSTORAGEL_CLIENT) as Arbiter;
  Resource = Arbiter;
  ArbiterInfo = Arbiter;
}

--- NEW FILE: BlockStorageLockClientC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

generic configuration BlockStorageLockClientC()
{
  provides interface Resource;
}

implementation
{
  enum {
    CLIENT_ID = unique(UQ_BSTORAGEL_CLIENT)
  };

  components BlockStorageLockC;
  Resource = BlockStorageLockC.Resource[CLIENT_ID];
}

--- NEW FILE: BlockStorageManager.h ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

#ifndef BLOCK_STORAGE_MANAGER_H
#define BLOCK_STORAGE_MANAGER_H

#define UQ_BSTORAGEM_CLIENT "BlockStorageManager.client"
#define UQ_BSTORAGEL_CLIENT "BlockStorageLock.client"

#endif

--- NEW FILE: BlockStorageManagerC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

#include "BlockStorageManager.h"

configuration BlockStorageManagerC
{
  provides {
    interface BlockRead[uint8_t client];
    interface BlockWrite[uint8_t client];
    interface StorageMap[uint8_t volume_id];
  }
  uses interface VolumeId[uint8_t client];
}

implementation
{
  enum {
    NUM_CLIENTS = uniqueCount(UQ_BSTORAGEM_CLIENT)
  };
  
  components new BlockStorageManagerP(NUM_CLIENTS);
  
  BlockRead  = BlockStorageManagerP;
  BlockWrite = BlockStorageManagerP;
  VolumeId   = BlockStorageManagerP;
  StorageMap = BlockStorageManagerP;

  components new BlockStorageC(VOLUME_GOLDENIMAGE) as BlockStorageC_Golden;
  components new BlockStorageC(VOLUME_DELUGE1)     as BlockStorageC_1;
  components new BlockStorageC(VOLUME_DELUGE2)     as BlockStorageC_2;
  components new BlockStorageC(VOLUME_DELUGE3)     as BlockStorageC_3;

  BlockStorageManagerP.SubBlockRead[VOLUME_GOLDENIMAGE] -> BlockStorageC_Golden;
  BlockStorageManagerP.SubBlockRead[VOLUME_DELUGE1]     -> BlockStorageC_1;
  BlockStorageManagerP.SubBlockRead[VOLUME_DELUGE2]     -> BlockStorageC_2;
  BlockStorageManagerP.SubBlockRead[VOLUME_DELUGE3]     -> BlockStorageC_3;

  BlockStorageManagerP.SubBlockWrite[VOLUME_GOLDENIMAGE] -> BlockStorageC_Golden;
  BlockStorageManagerP.SubBlockWrite[VOLUME_DELUGE1]     -> BlockStorageC_1;
  BlockStorageManagerP.SubBlockWrite[VOLUME_DELUGE2]     -> BlockStorageC_2;
  BlockStorageManagerP.SubBlockWrite[VOLUME_DELUGE3]     -> BlockStorageC_3;

#if defined(PLATFORM_TELOSB)
  BlockStorageManagerP.SubStorageMap[VOLUME_GOLDENIMAGE] -> BlockStorageC_Golden;
  BlockStorageManagerP.SubStorageMap[VOLUME_DELUGE1]     -> BlockStorageC_1;
  BlockStorageManagerP.SubStorageMap[VOLUME_DELUGE2]     -> BlockStorageC_2;
  BlockStorageManagerP.SubStorageMap[VOLUME_DELUGE3]     -> BlockStorageC_3;
#elif defined(PLATFORM_MICAZ)
  components StorageMapperAt45dbC;
  BlockStorageManagerP.At45dbVolume = At45dbStorageManagerC;
#endif
}

--- NEW FILE: BlockStorageManagerP.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

generic module BlockStorageManagerP(uint8_t clients)
{
  provides {
    interface BlockRead[uint8_t client];
    interface BlockWrite[uint8_t client];
    interface StorageMap[uint8_t volume_id];
  }
  uses {
    interface BlockRead as SubBlockRead[volume_id_t volume_id];
    interface BlockWrite as SubBlockWrite[volume_id_t volume_id];
    interface VolumeId[uint8_t client];
#if defined(PLATFORM_TELOSB)
    interface StorageMap as SubStorageMap[volume_id_t volume_id];
#elif defined(PLATFORM_MICAZ)
    interface At45dbVolume[volume_id_t volume_id];
#endif
  }
}

implementation
{
  enum {
    S_READY,
    S_BUSY
  };

  uint8_t state = S_READY;
  uint8_t current_client;

  /* BlockRead **************************/
  command error_t BlockRead.read[uint8_t client](storage_addr_t addr, void* buf, storage_len_t len)
  {
    error_t error;
    if (state != S_READY) {
      return EBUSY;
    }
    error = call SubBlockRead.read[call VolumeId.get[client]()](addr, buf, len);
    if (error == SUCCESS)
    {
      state = S_BUSY;
      current_client = client;
      return SUCCESS;
    }
    return error;
  }

  command error_t BlockRead.computeCrc[uint8_t client](storage_addr_t addr, storage_len_t len, uint16_t crc)
  {
    error_t error;
    if (state != S_READY) {
      return EBUSY;
    }
    error = call SubBlockRead.computeCrc[call VolumeId.get[client]()](addr, len, crc);
    if (error == SUCCESS)
    {
      state = S_BUSY;
      current_client = client;
      return SUCCESS;
    }
    return error;
  }

  command storage_len_t BlockRead.getSize[uint8_t client]()
  {
    return call SubBlockRead.getSize[client]();
  }

  event void SubBlockRead.readDone[volume_id_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error)
  {
    state = S_READY;
    signal BlockRead.readDone[current_client](addr, buf, len, error);
  }

  event void SubBlockRead.computeCrcDone[volume_id_t volume_id](storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error)
  {
    state = S_READY;
    signal BlockRead.computeCrcDone[current_client](addr, len, crc, error);
  }

  default command error_t SubBlockRead.read[uint8_t client](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
  default command error_t SubBlockRead.computeCrc[uint8_t client](storage_addr_t addr, storage_len_t len, uint16_t crc) { return FAIL; }
  default event void BlockRead.readDone[volume_id_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
  default event void BlockRead.computeCrcDone[volume_id_t volume_id](storage_addr_t addr, storage_len_t len, uint16_t crc, error_t error) {}


  /* BlockWrite **************************/
  command error_t BlockWrite.write[uint8_t client](storage_addr_t addr, void* buf, storage_len_t len)
  {
    error_t error;
    if (state != S_READY) {
      return EBUSY;
    }
    error = call SubBlockWrite.write[call VolumeId.get[client]()](addr, buf, len);
    if (error == SUCCESS)
    {
      state = S_BUSY;
      current_client = client;
      return SUCCESS;
    }
    return error;
  }

  command error_t BlockWrite.erase[uint8_t client]()
  {
    error_t error;
    if (state != S_READY) {
      return EBUSY;
    }
    error = call SubBlockWrite.erase[call VolumeId.get[client]()]();
    if (error == SUCCESS)
    {
      state = S_BUSY;
      current_client = client;
      return SUCCESS;
    }
    return error;
  }

  command error_t BlockWrite.sync[uint8_t client]()
  {
    error_t error;
    if (state != S_READY) {
      return EBUSY;
    }
    error = call SubBlockWrite.sync[call VolumeId.get[client]()]();
    if (error == SUCCESS)
    {
      state = S_BUSY;
      return SUCCESS;
    }
    return error;
  }

  event void SubBlockWrite.writeDone[volume_id_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error)
  {
    state = S_READY;
    signal BlockWrite.writeDone[current_client](addr, buf, len, error);
  }

  event void SubBlockWrite.eraseDone[volume_id_t volume_id](error_t error)
  {
    state = S_READY;
    signal BlockWrite.eraseDone[current_client](error);
  }

  event void SubBlockWrite.syncDone[volume_id_t volume_id](error_t error)
  {
    state = S_READY;
    signal BlockWrite.syncDone[current_client](error);
  }

  command storage_addr_t StorageMap.getPhysicalAddress[uint8_t volume_id](storage_addr_t addr)
  {
    storage_addr_t p_addr = 0xFFFFFFFF;
#if defined(PLATFORM_TELOSB)
    p_addr = call SubStorageMap.getPhysicalAddress[volume_id](addr);
#elif defined(PLATFORM_MICAZ)
    at45page_t page = call At45dbVolume.remap[img_num]((addr >> AT45_PAGE_SIZE_LOG2));
    at45pageoffset_t offset = addr & ((1 << AT45_PAGE_SIZE_LOG2) - 1);
    p_addr = page;
    p_addr = p_addr << AT45_PAGE_SIZE_LOG2;
    p_addr += offset;
#endif
    return p_addr;
  }

#if defined(PLATFORM_TELOSB)
  default command storage_addr_t SubStorageMap.getPhysicalAddress[uint8_t volume_id](storage_addr_t addr)
  {
    return 0xffffffff;
  }
#endif

  default command error_t SubBlockWrite.write[uint8_t client](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
  default command error_t SubBlockWrite.erase[uint8_t client]() { return FAIL; }
  default command error_t SubBlockWrite.sync[uint8_t client]() { return FAIL; }
  default event void BlockWrite.writeDone[volume_id_t volume_id](storage_addr_t addr, void* buf, storage_len_t len, error_t error) {}
  default event void BlockWrite.eraseDone[volume_id_t volume_id](error_t error) {}
  default event void BlockWrite.syncDone[volume_id_t volume_id](error_t error) {}


  default command volume_id_t VolumeId.get[uint8_t client]()
  {
    return 0xFF; // This is an invalid volume at least for STM25P.
  }
}

--- NEW FILE: BlockWriterC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

#include "BlockStorageManager.h"
#include "Storage.h"

generic configuration BlockWriterC(volume_id_t id)
{
  provides {
    interface BlockWrite;
    interface Resource;
  }
}

implementation
{
  enum {
    CLIENT_ID = unique(UQ_BSTORAGEM_CLIENT)
  };

  components new VolumeIdC(id);
  components BlockStorageManagerC;
  components new BlockStorageLockClientC();

  BlockWrite = BlockStorageManagerC.BlockWrite[CLIENT_ID];
  Resource = BlockStorageLockClientC;
  BlockStorageManagerC.VolumeId[CLIENT_ID] -> VolumeIdC;
}

--- NEW FILE: VolumeId.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

interface VolumeId
{
  command volume_id_t get();
}

--- NEW FILE: VolumeIdC.nc ---
/* Copyright (c) 2007 Johns Hopkins 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 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

generic module VolumeIdC(volume_id_t id)
{
  provides interface VolumeId;
}

implementation
{
  command volume_id_t VolumeId.get()
  {
    return id;
  }
}



More information about the Tinyos-2-commits mailing list