void masterconn_check_hdd_reports() { masterconn *eptr = masterconnsingleton; uint32_t errorcounter; uint32_t chunkcounter; uint8_t *buff; if (eptr->registerstate==REGISTERED && eptr->mode==DATA) { errorcounter = hdd_errorcounter(); while (errorcounter) { masterconn_create_attached_packet(eptr,CSTOMA_ERROR_OCCURRED,0); errorcounter--; } chunkcounter = hdd_get_damaged_chunk_count(); // lock if (chunkcounter) { buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_DAMAGED,8*chunkcounter); hdd_get_damaged_chunk_data(buff); // unlock } else { hdd_get_damaged_chunk_data(NULL); } chunkcounter = hdd_get_lost_chunk_count(LOSTCHUNKLIMIT); // lock if (chunkcounter) { buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_LOST,8*chunkcounter); hdd_get_lost_chunk_data(buff,LOSTCHUNKLIMIT); // unlock } else { hdd_get_lost_chunk_data(NULL,0); } chunkcounter = hdd_get_new_chunk_count(NEWCHUNKLIMIT); // lock if (chunkcounter) { buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_NEW,12*chunkcounter); hdd_get_new_chunk_data(buff,NEWCHUNKLIMIT); // unlock } else { hdd_get_new_chunk_data(NULL,0); } } }
void masterconn_check_hdd_reports() { masterconn *eptr = masterconnsingleton; uint32_t errorcounter; uint32_t chunkcounter; uint8_t *buff; if (eptr->mode==DATA || eptr->mode==HEADER) { if (hdd_spacechanged()) { uint64_t usedspace,totalspace,tdusedspace,tdtotalspace; uint32_t chunkcount,tdchunkcount; buff = masterconn_create_attached_packet(eptr,CSTOMA_SPACE,8+8+4+8+8+4); if (buff) { hdd_get_space(&usedspace,&totalspace,&chunkcount,&tdusedspace,&tdtotalspace,&tdchunkcount); put64bit(&buff,usedspace); put64bit(&buff,totalspace); put32bit(&buff,chunkcount); put64bit(&buff,tdusedspace); put64bit(&buff,tdtotalspace); put32bit(&buff,tdchunkcount); } } errorcounter = hdd_errorcounter(); while (errorcounter) { masterconn_create_attached_packet(eptr,CSTOMA_ERROR_OCCURRED,0); errorcounter--; } chunkcounter = hdd_get_damaged_chunk_count(); // lock if (chunkcounter) { buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_DAMAGED,8*chunkcounter); if (buff) { hdd_get_damaged_chunk_data(buff); // unlock } else { hdd_get_damaged_chunk_data(NULL); // unlock } } else { hdd_get_damaged_chunk_data(NULL); } chunkcounter = hdd_get_lost_chunk_count(); // lock if (chunkcounter) { buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_LOST,8*chunkcounter); if (buff) { hdd_get_lost_chunk_data(buff); // unlock } else { hdd_get_lost_chunk_data(NULL); // unlock } } else { hdd_get_lost_chunk_data(NULL); } } }