Changeset 205832b in mainline
- Timestamp:
- 2012-11-05T15:37:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f048658
- Parents:
- 6b99156
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/adt/cht.c
r6b99156 r205832b 151 151 /* Sentinel node used by all buckets. Stores the greatest possible hash value.*/ 152 152 static const cht_link_t sentinel = { 153 .link = 0, 153 /* NULL and N_NORMAL */ 154 .link = 0 | N_NORMAL, 154 155 .hash = -1 155 156 }; … … 265 266 h->max_load = (max_load == 0) ? CHT_MAX_LOAD : max_load; 266 267 h->min_order = min_order; 267 h->new_b = 0;268 h->new_b = NULL; 268 269 h->op = op; 269 270 atomic_set(&h->item_cnt, 0); … … 298 299 299 300 if (!b) 300 return 0;301 return NULL; 301 302 302 303 b->order = order; … … 346 347 347 348 free(h->b); 348 h->b = 0;349 h->b = NULL; 349 350 350 351 /* You must clear the table of items. Otherwise cht_destroy will leak. */ … … 457 458 */ 458 459 459 cht_link_t *cur = 0;460 cht_link_t *cur = NULL; 460 461 marked_ptr_t prev = head; 461 462 … … 492 493 } 493 494 494 return 0;495 return NULL; 495 496 } 496 497 … … 607 608 * points to an allocated join node (if non-null) even if marked 608 609 * invalid. Before the resizer lets join nodes to be unlinked 609 * (and freed) it sets old_head to 0and waits for a grace period.610 * (and freed) it sets old_head to NULL and waits for a grace period. 610 611 * So either the invalid old_head points to join node; or old_head 611 612 * is null and we would have seen a completed bucket join while … … 616 617 } 617 618 618 return 0;619 return NULL; 619 620 } else { 620 621 /* … … 700 701 .ppred = phead, 701 702 .cur = get_next(*phead), 702 .last = 0703 .last = NULL 703 704 }; 704 705 … … 807 808 */ 808 809 read_barrier(); 809 return 0!= find_duplicate(h, item, hash, wnd->cur);810 return NULL != find_duplicate(h, item, hash, wnd->cur); 810 811 } 811 812 … … 840 841 } 841 842 842 return 0;843 return NULL; 843 844 } 844 845 … … 908 909 .ppred = phead, 909 910 .cur = get_next(*phead), 910 .last = 0911 .last = NULL 911 912 }; 912 913 … … 1194 1195 } 1195 1196 1196 /* wnd->cur may be 0or even marked N_DELETED. */1197 /* wnd->cur may be NULL or even marked N_DELETED. */ 1197 1198 return true; 1198 1199 } … … 1966 1967 1967 1968 /* Not needed; just for increased readability. */ 1968 h->new_b = 0;1969 h->new_b = NULL; 1969 1970 } 1970 1971 … … 2065 2066 2066 2067 /* Not needed; just for increased readability. */ 2067 h->new_b = 0;2068 h->new_b = NULL; 2068 2069 } 2069 2070 … … 2144 2145 2145 2146 wnd_t wnd = { 2146 .ppred = 0,2147 .cur = 02147 .ppred = NULL, 2148 .cur = NULL 2148 2149 }; 2149 2150 marked_ptr_t *cur_link = new_head; -
kernel/generic/src/synch/rcu.c
r6b99156 r205832b 237 237 #endif 238 238 239 rcu.detector_thr = 0;239 rcu.detector_thr = NULL; 240 240 241 241 rcu.stat_expedited_cnt = 0; … … 260 260 #endif 261 261 262 CPU->rcu.cur_cbs = 0;262 CPU->rcu.cur_cbs = NULL; 263 263 CPU->rcu.cur_cbs_cnt = 0; 264 CPU->rcu.next_cbs = 0;264 CPU->rcu.next_cbs = NULL; 265 265 CPU->rcu.next_cbs_cnt = 0; 266 CPU->rcu.arriving_cbs = 0;266 CPU->rcu.arriving_cbs = NULL; 267 267 CPU->rcu.parriving_cbs_tail = &CPU->rcu.arriving_cbs; 268 268 CPU->rcu.arriving_cbs_cnt = 0; … … 275 275 /* BSP creates reclaimer threads before AP's rcu_cpu_init() runs. */ 276 276 if (config.cpu_active == 1) 277 CPU->rcu.reclaimer_thr = 0;277 CPU->rcu.reclaimer_thr = NULL; 278 278 279 279 CPU->rcu.stat_max_cbs = 0; … … 317 317 /* Stop and wait for reclaimers. */ 318 318 for (unsigned int cpu_id = 0; cpu_id < config.cpu_active; ++cpu_id) { 319 ASSERT(cpus[cpu_id].rcu.reclaimer_thr != 0);319 ASSERT(cpus[cpu_id].rcu.reclaimer_thr != NULL); 320 320 321 321 if (cpus[cpu_id].rcu.reclaimer_thr) { … … 323 323 thread_join(cpus[cpu_id].rcu.reclaimer_thr); 324 324 thread_detach(cpus[cpu_id].rcu.reclaimer_thr); 325 cpus[cpu_id].rcu.reclaimer_thr = 0;325 cpus[cpu_id].rcu.reclaimer_thr = NULL; 326 326 } 327 327 } … … 333 333 thread_join(rcu.detector_thr); 334 334 thread_detach(rcu.detector_thr); 335 rcu.detector_thr = 0;335 rcu.detector_thr = NULL; 336 336 } 337 337 #endif … … 357 357 358 358 cpus[cpu_id].rcu.reclaimer_thr = 359 thread_create(reclaimer, 0, TASK, THREAD_FLAG_NONE, name);359 thread_create(reclaimer, NULL, TASK, THREAD_FLAG_NONE, name); 360 360 361 361 if (!cpus[cpu_id].rcu.reclaimer_thr) … … 373 373 { 374 374 rcu.detector_thr = 375 thread_create(detector, 0, TASK, THREAD_FLAG_NONE, "rcu-det");375 thread_create(detector, NULL, TASK, THREAD_FLAG_NONE, "rcu-det"); 376 376 377 377 if (!rcu.detector_thr) … … 410 410 * to finish. 411 411 * 412 * Note that THREAD may be 0in scheduler() and not just during boot.412 * Note that THREAD may be NULL in scheduler() and not just during boot. 413 413 */ 414 414 if ((THREAD && THREAD->rcu.was_preempted) || CPU->rcu.is_delaying_gp) { … … 522 522 523 523 cpu_mask_for_each(*cpu_mask, cpu_id) { 524 smp_call(cpu_id, add_barrier_cb, 0);524 smp_call(cpu_id, add_barrier_cb, NULL); 525 525 } 526 526 … … 583 583 584 584 rcu_item->func = func; 585 rcu_item->next = 0;585 rcu_item->next = NULL; 586 586 587 587 preemption_disable(); … … 611 611 { 612 612 ASSERT(THREAD && THREAD->wired); 613 return 0== CPU->rcu.cur_cbs;613 return NULL == CPU->rcu.cur_cbs; 614 614 } 615 615 … … 617 617 { 618 618 ASSERT(THREAD && THREAD->wired); 619 return 0== CPU->rcu.next_cbs;619 return NULL == CPU->rcu.next_cbs; 620 620 } 621 621 … … 628 628 * a false negative if we race with a local interrupt handler. 629 629 */ 630 return 0== CPU->rcu.arriving_cbs;630 return NULL == CPU->rcu.arriving_cbs; 631 631 } 632 632 … … 741 741 } 742 742 743 *phead = 0;743 *phead = NULL; 744 744 } 745 745 … … 779 779 CPU->rcu.next_cbs_cnt = CPU->rcu.arriving_cbs_cnt; 780 780 781 CPU->rcu.arriving_cbs = 0;781 CPU->rcu.arriving_cbs = NULL; 782 782 CPU->rcu.parriving_cbs_tail = &CPU->rcu.arriving_cbs; 783 783 CPU->rcu.arriving_cbs_cnt = 0; … … 1289 1289 atomic_set(&rcu.delaying_cpu_cnt, 0); 1290 1290 1291 sample_cpus(cpu_mask, 0);1291 sample_cpus(cpu_mask, NULL); 1292 1292 } 1293 1293 … … 1452 1452 void rcu_thread_exiting(void) 1453 1453 { 1454 ASSERT(THREAD != 0);1454 ASSERT(THREAD != NULL); 1455 1455 ASSERT(THREAD->state == Exiting); 1456 1456 ASSERT(PREEMPTION_DISABLED || interrupts_disabled()); -
kernel/test/cht/cht1.c
r6b99156 r205832b 97 97 static const char * do_sanity_test(cht_t *h) 98 98 { 99 if (cht_find_lazy(h, 0))99 if (cht_find_lazy(h, (void*)0)) 100 100 return "Found lazy in empty table."; 101 101 102 if (cht_find(h, 0))102 if (cht_find(h, (void*)0)) 103 103 return "Found in empty table."; 104 104 105 if (cht_remove_key(h, 0))105 if (cht_remove_key(h, (void*)0)) 106 106 return "Removed from empty table."; 107 107 108 108 const int val_cnt = 6; 109 val_t *v[6] = { 0};109 val_t *v[6] = { NULL }; 110 110 111 111 for (int i = 0; i < val_cnt; ++i) … … 145 145 146 146 if (cht_find(h, (void*)0)) 147 return " Fantom find.";147 return "Phantom find."; 148 148 149 149 cht_link_t *item = cht_find(h, (void*)v[5]->unique_id); … … 226 226 } 227 227 228 return 0;228 return NULL; 229 229 } 230 230 … … 559 559 return "CHT stress test failed."; 560 560 else 561 return 0;562 } 561 return NULL; 562 } -
kernel/test/smpcall/smpcall1.c
r6b99156 r205832b 85 85 /* Number of received calls that were sent by cpu[i]. */ 86 86 size_t call_cnt[MAX_CPUS] = {0}; 87 thread_t *thread[MAX_CPUS] = { 0};87 thread_t *thread[MAX_CPUS] = { NULL }; 88 88 89 89 unsigned int cpu_count = min(config.cpu_active, MAX_CPUS); -
kernel/test/synch/rcu1.c
r6b99156 r205832b 43 43 44 44 static int one_idx = 0; 45 static thread_t *thread[MAX_THREADS] = { 0};45 static thread_t *thread[MAX_THREADS] = { NULL }; 46 46 47 47 typedef struct { … … 100 100 101 101 for (size_t i = 0; i < thread_cnt; ++i) { 102 run_thread(i, func, 0);102 run_thread(i, func, NULL); 103 103 } 104 104 } … … 123 123 124 124 thread_detach(thread[i]); 125 thread[i] = 0;125 thread[i] = NULL; 126 126 } 127 127 } … … 145 145 thread_join(thread[one_idx]); 146 146 thread_detach(thread[one_idx]); 147 thread[one_idx] = 0;147 thread[one_idx] = NULL; 148 148 } 149 149 } … … 337 337 338 338 TPRINTF("\nRun a single reader that posts one callback.\n"); 339 run_one(one_cb_reader, 0);339 run_one(one_cb_reader, NULL); 340 340 join_one(); 341 341 … … 1015 1015 { 0, do_expedite, "do_expedite" }, 1016 1016 { 1, do_stress, "do_stress" }, 1017 { 0, 0, 0}1017 { 0, NULL, NULL } 1018 1018 }; 1019 1019 … … 1023 1023 uint64_t delta_gps = 0; 1024 1024 1025 for (int i = 0; test_func[i].func != 0; ++i) {1025 for (int i = 0; test_func[i].func; ++i) { 1026 1026 if (!test_func[i].include) { 1027 1027 TPRINTF("\nSubtest %s() skipped.\n", test_func[i].desc); … … 1047 1047 1048 1048 if (success) 1049 return 0;1049 return NULL; 1050 1050 else 1051 1051 return "One of the tests failed."; -
kernel/test/synch/workqueue2.c
r6b99156 r205832b 116 116 test_custom_workq_impl(true, "test-workq-stop"); 117 117 /* Errors are expected. */ 118 return 0;118 return NULL; 119 119 } 120 120 … … 122 122 const char *test_workqueue_all(void) 123 123 { 124 const char *err = 0;124 const char *err = NULL; 125 125 const char *res; 126 126 -
kernel/test/synch/workqueue3.c
r6b99156 r205832b 56 56 static const char *do_test(bool exit_early) 57 57 { 58 const char *err = 0;58 const char *err = NULL; 59 59 TPRINTF("Stress testing system queue.\n"); 60 60 TPRINTF("First run:\n"); -
uspace/lib/c/generic/adt/hash_table.c
r6b99156 r205832b 112 112 h->apply_ongoing = false; 113 113 114 if (h->op->remove_callback == 0) {114 if (h->op->remove_callback == NULL) { 115 115 h->op->remove_callback = nop_remove_callback; 116 116 } … … 133 133 free(h->bucket); 134 134 135 h->bucket = 0;135 h->bucket = NULL; 136 136 h->bucket_cnt = 0; 137 137 }
Note:
See TracChangeset
for help on using the changeset viewer.