| 202 | |
| 203 | |
| 204 | static int cr_status_update(bin_packet_t *packet) |
| 205 | { |
| 206 | struct head_db *part; |
| 207 | str cr_id; |
| 208 | str part_name; |
| 209 | int flags; |
| 210 | pcr_t *cr; |
| 211 | |
| 212 | bin_pop_str(packet, &part_name); |
| 213 | bin_pop_str(packet, &cr_id); |
| 214 | bin_pop_int(packet, &flags); |
| 215 | |
| 216 | part = get_partition( &part_name ); |
| 217 | if (part==NULL || part->rdata==NULL) |
| 218 | return -1; |
| 219 | |
| 220 | lock_start_read(part->ref_lock); |
| 221 | |
| 222 | cr = get_carrier_by_id(part->rdata->carriers_tree, &cr_id); |
| 223 | if (cr) { |
| 224 | if ((cr->flags&DR_CR_FLAG_IS_OFF)!=flags) { |
| 225 | /* import the status flags */ |
| 226 | cr->flags = ((~DR_CR_FLAG_IS_OFF)&cr->flags)|(DR_CR_FLAG_IS_OFF&flags); |
| 227 | /* set the DIRTY flag to force flushing to DB */ |
| 228 | cr->flags |= DR_CR_FLAG_DIRTY; |
| 229 | dr_raise_cr_event( part, cr, MI_SSTR("replicated info")); |
| 230 | } |
| 231 | lock_stop_read(part->ref_lock); |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | lock_stop_read(part->ref_lock); |
| 236 | |
| 237 | return -1; |
| 238 | } |
| 239 | |
| 240 | |
| 241 | static void dr_recv_sync_packet(bin_packet_t *packet) |
no test coverage detected