From: regehr Date: Wed, 4 Jun 2008 04:30:41 +0000 (+0000) Subject: safe tinyos annotations X-Git-Tag: release_tinyos_2_1_0_0~339 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=760a452ea5519d3e7bc2aca89cffaa98bacf8b41;p=tinyos-2.x.git safe tinyos annotations --- diff --git a/tos/lib/net/6lowpan/IPP.nc b/tos/lib/net/6lowpan/IPP.nc index 61a8fc70..2864a7cb 100644 --- a/tos/lib/net/6lowpan/IPP.nc +++ b/tos/lib/net/6lowpan/IPP.nc @@ -1653,7 +1653,7 @@ void layer3_input(uint8_t *buf, uint16_t len) } /* process the optional 6lowpan headers */ -void lowpan_input(uint8_t* buf, uint8_t len ) +void TRUSTEDBLOCK lowpan_input(uint8_t* buf, uint8_t len ) { uint8_t *dispatch; struct lowpan_broadcast_hdr *bc_hdr; @@ -1960,7 +1960,7 @@ void lowpan_input(uint8_t* buf, uint8_t len ) } /* Receive an AM from the lower layer */ -event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) +event TRUSTEDBLOCK message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) { am_addr_t am_addr; diff --git a/tos/lib/net/Deluge/Crc.nc b/tos/lib/net/Deluge/Crc.nc index 31fedfd8..16c63ca3 100644 --- a/tos/lib/net/Deluge/Crc.nc +++ b/tos/lib/net/Deluge/Crc.nc @@ -25,5 +25,5 @@ interface Crc { - command uint16_t crc16(void* buf, uint8_t len); + command uint16_t crc16(void* COUNT(len) buf, uint8_t len); } diff --git a/tos/lib/net/Deluge/extra/NetProgM.nc b/tos/lib/net/Deluge/extra/NetProgM.nc index 7567ad1a..e77ebeed 100644 --- a/tos/lib/net/Deluge/extra/NetProgM.nc +++ b/tos/lib/net/Deluge/extra/NetProgM.nc @@ -53,7 +53,7 @@ implementation { command error_t Init.init() { BootArgs bootArgs; - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); // Update the local node ID if (bootArgs.address != 0xFFFF) { @@ -71,11 +71,11 @@ implementation { BootArgs bootArgs; atomic { - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); if (bootArgs.address != TOS_NODE_ID) { bootArgs.address = TOS_NODE_ID; - call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.write(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); } netprog_reboot(); } @@ -99,14 +99,14 @@ implementation { } atomic { - call IFlash.read((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.read(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); bootArgs.imageAddr = reprogramImgAddr; bootArgs.gestureCount = 0xff; bootArgs.noReprogram = FALSE; bootArgs.address = TOS_NODE_ID; - call IFlash.write((uint8_t*)TOSBOOT_ARGS_ADDR, &bootArgs, sizeof(bootArgs)); + call IFlash.write(TCAST(uint8_t* COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); // reboot netprog_reboot(); diff --git a/tos/lib/net/DisseminationUpdate.nc b/tos/lib/net/DisseminationUpdate.nc index 6ea93cad..4a28038f 100644 --- a/tos/lib/net/DisseminationUpdate.nc +++ b/tos/lib/net/DisseminationUpdate.nc @@ -49,5 +49,5 @@ interface DisseminationUpdate { * by newVal is copied out, so newVal can be reclaimed when * change returns. */ - command void change(t* newVal); + command void change(t* ONE newVal); } diff --git a/tos/lib/net/UARTDebugSenderP.nc b/tos/lib/net/UARTDebugSenderP.nc index ebce09bb..4c118513 100644 --- a/tos/lib/net/UARTDebugSenderP.nc +++ b/tos/lib/net/UARTDebugSenderP.nc @@ -100,7 +100,7 @@ implementation { } } /* Used for FE_SENT_MSG, FE_RCV_MSG, FE_FWD_MSG, FE_DST_MSG */ - command error_t CollectionDebug.logEventMsg(uint8_t type, uint16_t msg_id, am_addr_t origin, am_addr_t node) { + command error_t TRUSTEDBLOCK CollectionDebug.logEventMsg(uint8_t type, uint16_t msg_id, am_addr_t origin, am_addr_t node) { statLogReceived++; if (call MessagePool.empty()) { return FAIL; @@ -129,7 +129,7 @@ implementation { } } /* Used for TREE_NEW_PARENT, TREE_ROUTE_INFO */ - command error_t CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) { + command error_t TRUSTEDBLOCK CollectionDebug.logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t metric) { statLogReceived++; if (call MessagePool.empty()) { return FAIL; @@ -185,7 +185,7 @@ implementation { } } /* Used for DBG_2, DBG_3 */ - command error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) { + command TRUSTEDBLOCK error_t CollectionDebug.logEventDbg(uint8_t type, uint16_t arg1, uint16_t arg2, uint16_t arg3) { statLogReceived++; if (call MessagePool.empty()) { return FAIL; diff --git a/tos/lib/net/ctp/CompareBit.nc b/tos/lib/net/ctp/CompareBit.nc index baf62206..3f9528d7 100644 --- a/tos/lib/net/ctp/CompareBit.nc +++ b/tos/lib/net/ctp/CompareBit.nc @@ -38,5 +38,5 @@ interface CompareBit { /* should the source of this message be inserted into the neighbor table? */ - event bool shouldInsert(message_t *msg, void* payload, uint8_t len, bool white_bit); + event bool shouldInsert(message_t * ONE msg, void* COUNT_NOK(len) payload, uint8_t len, bool white_bit); } diff --git a/tos/lib/net/ctp/CtpForwardingEngine.h b/tos/lib/net/ctp/CtpForwardingEngine.h index ee5207de..d0946336 100644 --- a/tos/lib/net/ctp/CtpForwardingEngine.h +++ b/tos/lib/net/ctp/CtpForwardingEngine.h @@ -110,7 +110,7 @@ typedef nx_struct { * of how many times the packet has been transmitted. */ typedef struct { - message_t *msg; + message_t * ONE_NOK msg; uint8_t client; uint8_t retries; } fe_queue_entry_t; diff --git a/tos/lib/net/ctp/CtpForwardingEngineP.nc b/tos/lib/net/ctp/CtpForwardingEngineP.nc index f3f2c578..16c1803c 100644 --- a/tos/lib/net/ctp/CtpForwardingEngineP.nc +++ b/tos/lib/net/ctp/CtpForwardingEngineP.nc @@ -220,7 +220,7 @@ implementation { its queue entry is pointed to by clientPtrs. */ fe_queue_entry_t clientEntries[CLIENT_COUNT]; - fe_queue_entry_t* clientPtrs[CLIENT_COUNT]; + fe_queue_entry_t* ONE_NOK clientPtrs[CLIENT_COUNT]; /* The loopback message is for when a collection roots calls Send.send. Since Send passes a pointer but Receive allows @@ -229,7 +229,7 @@ implementation { See sendTask(). */ message_t loopbackMsg; - message_t* loopbackMsgPtr; + message_t* ONE_NOK loopbackMsgPtr; command error_t Init.init() { int i; @@ -642,7 +642,7 @@ implementation { * message in the pool, it returns the passed message and does not * put it on the send queue. */ - message_t* forward(message_t* m) { + message_t* ONE forward(message_t* ONE m) { if (call MessagePool.empty()) { dbg("Route", "%s cannot forward, message pool empty.\n", __FUNCTION__); // send a debug message to the uart diff --git a/tos/lib/net/ctp/CtpRoutingEngineP.nc b/tos/lib/net/ctp/CtpRoutingEngineP.nc index 120396ea..342f2f53 100644 --- a/tos/lib/net/ctp/CtpRoutingEngineP.nc +++ b/tos/lib/net/ctp/CtpRoutingEngineP.nc @@ -453,7 +453,7 @@ implementation { } - ctp_routing_header_t* getHeader(message_t* m) { + ctp_routing_header_t* getHeader(message_t* ONE m) { return (ctp_routing_header_t*)call BeaconSend.getPayload(m, call BeaconSend.maxPayloadLength()); } diff --git a/tos/lib/net/ctp/CtpRoutingPacket.nc b/tos/lib/net/ctp/CtpRoutingPacket.nc index 5fa376c4..fb5ec31d 100644 --- a/tos/lib/net/ctp/CtpRoutingPacket.nc +++ b/tos/lib/net/ctp/CtpRoutingPacket.nc @@ -43,16 +43,16 @@ interface CtpRoutingPacket { /* Allow individual options to be read, set, and reset independently */ - command bool getOption(message_t* msg, ctp_options_t opt); - command void setOption(message_t* msg, ctp_options_t opt); - command void clearOption(message_t* msg, ctp_options_t opt); + command bool getOption(message_t* ONE msg, ctp_options_t opt); + command void setOption(message_t* ONE msg, ctp_options_t opt); + command void clearOption(message_t* ONE msg, ctp_options_t opt); /* Clear all options */ - command void clearOptions(message_t* msg); + command void clearOptions(message_t* ONE msg); - command am_addr_t getParent(message_t* msg); - command void setParent(message_t* msg, am_addr_t addr); + command am_addr_t getParent(message_t* ONE msg); + command void setParent(message_t* ONE msg, am_addr_t addr); - command uint16_t getEtx(message_t* msg); - command void setEtx(message_t* msg, uint8_t etx); + command uint16_t getEtx(message_t* ONE msg); + command void setEtx(message_t* ONE msg, uint8_t etx); } diff --git a/tos/lib/net/drip/DisseminationCache.nc b/tos/lib/net/drip/DisseminationCache.nc index 290c7d1d..05c962f3 100644 --- a/tos/lib/net/drip/DisseminationCache.nc +++ b/tos/lib/net/drip/DisseminationCache.nc @@ -45,7 +45,7 @@ interface DisseminationCache { event error_t start(); event error_t stop(); command void* requestData( uint8_t* size ); - command void storeData( void* data, uint8_t size, uint32_t seqno ); + command void storeData( void* COUNT(size) data, uint8_t size, uint32_t seqno ); command uint32_t requestSeqno(); event void newData(); }