Changeset 3a9cf35 in mainline
- Timestamp:
- 2016-01-16T19:11:12Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e670dd
- Parents:
- 4f29118
- Location:
- uspace/srv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/vbd/disk.c
r4f29118 r3a9cf35 89 89 } 90 90 91 static vbds_disk_t *vbds_disk_first(void) 92 { 93 link_t *link; 94 95 link = list_first(&vbds_disks); 96 if (link == NULL) 97 return NULL; 98 99 return list_get_instance(link, vbds_disk_t, ldisks); 100 } 101 102 static vbds_disk_t *vbds_disk_next(vbds_disk_t *disk) 103 { 104 link_t *link; 105 106 if (disk == NULL) 107 return NULL; 108 109 link = list_next(&disk->ldisks, &vbds_disks); 110 if (link == NULL) 111 return NULL; 112 113 return list_get_instance(link, vbds_disk_t, ldisks); 114 } 115 91 116 int vbds_disks_init(void) 92 117 { … … 107 132 } 108 133 109 /** Check for new disk devices */134 /** Check for new/removed disk devices */ 110 135 static int vbds_disks_check_new(void) 111 136 { … … 114 139 service_id_t *svcs; 115 140 size_t count, i; 116 int rc; 141 vbds_disk_t *cur, *next; 142 int rc; 143 144 log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disks_check_new()"); 117 145 118 146 fibril_mutex_lock(&vbds_disks_lock); … … 133 161 } 134 162 163 list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) 164 disk->present = false; 165 135 166 for (i = 0; i < count; i++) { 136 167 already_known = false; … … 139 170 if (disk->svc_id == svcs[i]) { 140 171 already_known = true; 172 disk->present = true; 141 173 break; 142 174 } … … 151 183 "disk."); 152 184 } 185 } else { 186 log_msg(LOG_DEFAULT, LVL_DEBUG, "Disk %lu already known", 187 (unsigned long) svcs[i]); 153 188 } 189 } 190 191 cur = vbds_disk_first(); 192 while (cur != NULL) { 193 next = vbds_disk_next(cur); 194 if (!cur->present) { 195 log_msg(LOG_DEFAULT, LVL_NOTE, "Disk '%lu' is gone", 196 (unsigned long) cur->svc_id); 197 rc = vbds_disk_remove(cur->svc_id); 198 if (rc != EOK) { 199 log_msg(LOG_DEFAULT, LVL_ERROR, "Could not " 200 "remove disk."); 201 } 202 } 203 204 cur = next; 154 205 } 155 206 … … 403 454 disk->label = label; 404 455 disk->block_size = block_size; 456 disk->present = true; 405 457 406 458 list_initialize(&disk->parts); -
uspace/srv/bd/vbd/types/vbd.h
r4f29118 r3a9cf35 42 42 #include <label.h> 43 43 #include <loc.h> 44 #include <stdbool.h> 44 45 #include <sys/types.h> 45 46 #include <types/label.h> … … 87 88 /** Block size */ 88 89 size_t block_size; 90 /** Used to mark disks still present during re-discovery */ 91 bool present; 89 92 } vbds_disk_t; 90 93 -
uspace/srv/locsrv/locsrv.c
r4f29118 r3a9cf35 445 445 free(server); 446 446 447 loc_category_change_event(); 447 448 return EOK; 448 449 } … … 557 558 fibril_mutex_unlock(&services_list_mutex); 558 559 async_answer_0(iid, EOK); 560 561 loc_category_change_event(); 559 562 } 560 563
Note:
See TracChangeset
for help on using the changeset viewer.