diff --git a/lib/aos/init.c b/lib/aos/init.c index d3746bc..a761973 100644 --- a/lib/aos/init.c +++ b/lib/aos/init.c @@ -96,7 +96,7 @@ static void handle_init_recv(void *arg) assert(err_is_ok(err)); if (msg.words[0] == SYS_ERR_OK) { - debug_printf("Received child init OK\n"); + // debug_printf("Received child init OK\n"); init_chan_initialized = true; } else { USER_PANIC("Child LMP initialization failed."); diff --git a/lib/aos/morecore.c b/lib/aos/morecore.c index b599f07..841b2ae 100644 --- a/lib/aos/morecore.c +++ b/lib/aos/morecore.c @@ -112,7 +112,7 @@ errval_t morecore_init(size_t alignment) { struct morecore_state *state = get_morecore_state(); - debug_printf("initializing dynamic heap\n"); + DEBUG_PRINTF("initializing dynamic heap\n"); thread_mutex_init(&state->mutex); diff --git a/lib/aos/paging.c b/lib/aos/paging.c index 814af3f..dd96d3c 100644 --- a/lib/aos/paging.c +++ b/lib/aos/paging.c @@ -561,7 +561,7 @@ errval_t paging_init_onthread(struct thread *t) // - setup exception handler for thread `t'. errval_t err; - debug_printf("paging_init_onthread thread id: %lx\n", t->id); + DEBUG_PRINTF("paging_init_onthread thread id: %lx\n", t->id); size_t stack_size = PT_STATIC_EXCEPTION_STACK_SIZE; struct capref frame; @@ -585,7 +585,7 @@ static errval_t paging_insert_vaddr_reg( struct paging_state *st, struct pt_vaddr_reg_t *target_region, size_t prefix_size, size_t alloc_size, bool heap, size_t guarded_region_size ) { - assert(target_region->free); + assert(!!target_region->free); assert(target_region->size >= prefix_size + alloc_size); // calculate the number of bytes that are left over after the region diff --git a/lib/aos/ump_chan.c b/lib/aos/ump_chan.c index f5ed50e..eb84d69 100644 --- a/lib/aos/ump_chan.c +++ b/lib/aos/ump_chan.c @@ -5,7 +5,7 @@ /** * @brief initializes a ring buffer state - * + * * @param ring_state object to initialize * @param buf start of the ring buffer memory * @param buf_len size of the ring buffer memory @@ -21,7 +21,7 @@ static void ump_ring_init(struct ump_ring_state *ring_state, void *buf, size_t b /** * @brief Tries to write a ring buffer entry without blocking. Advances in the ring if successful - * + * * @param ring_state ring to write to * @param buf start of the buffer containing the data * @param bytes number of bytes from the buffer to write to the ring @@ -42,7 +42,7 @@ static bool ump_ring_try_write_next(struct ump_ring_state *ring_state, const voi ); memcpy(&ring_state->ring_start[ring_state->ring_entry_next].data, buf, bytes); - + // memory barrier because the other endpoint might be on another core __asm volatile ( "dmb sy\n" @@ -57,7 +57,7 @@ static bool ump_ring_try_write_next(struct ump_ring_state *ring_state, const voi /** * @brief Tries to read an entry of the ring buffer. Advances the ring if successful - * + * * @param ring_state ring to read from * @param buf start of the buffer to write to. if NULL the data will be dropped * @param bytes number of bytes to read from this buffer (from the start of the buffer. the rest is dropped) @@ -88,21 +88,21 @@ static bool ump_ring_try_read_next(struct ump_ring_state *ring_state, void *buf, ring_state->ring_start[ring_state->ring_entry_next].owner = 0; // advance in the ring ring_state->ring_entry_next = (ring_state->ring_entry_next + 1) % ring_state->ring_entry_count; - + return true; } /** * @brief Try to read the next message. The message might also be read only partially but it will continue in the next call to this function - * + * * @param recv_chan channel to read the message on */ static void ump_try_read(struct ump_recv_chan *recv_chan) { // make sure we own the read metadata, otherwise we have nothing to do anyways thread_mutex_lock(&recv_chan->recv_register_lock); if( - recv_chan->state != UMP_RECV_STATE_START_MESSAGE && - recv_chan->state != UMP_RECV_STATE_HEADER && + recv_chan->state != UMP_RECV_STATE_START_MESSAGE && + recv_chan->state != UMP_RECV_STATE_HEADER && recv_chan->state != UMP_RECV_STATE_PAYLOAD ) { thread_mutex_unlock(&recv_chan->recv_register_lock); @@ -163,7 +163,7 @@ static void ump_try_read(struct ump_recv_chan *recv_chan) { /** * @brief Try to send the next message. The message might also be sent only partially but it will continue in the next call to this function - * + * * @param send_chan channel to send the message on */ static void ump_try_send(struct ump_send_chan *send_chan) { @@ -237,8 +237,8 @@ struct ump_worker_context { /** * @brief Do the async work on the channel - * - * @param arg + * + * @param arg */ static void ump_work(void *arg) { struct ump_worker_context *worker_context = arg; @@ -252,7 +252,7 @@ static void ump_work(void *arg) { /** * @brief used to handle the async work on a separate thread - * + * * @param arg the worker context * @return int not used */ @@ -261,7 +261,7 @@ static int ump_thread_worker(void *arg) { while (true) { ump_work(arg); - + thread_yield(); } @@ -271,14 +271,14 @@ static int ump_thread_worker(void *arg) { static void ump_waitset_worker(void *arg); /** * @brief Schedule the worker on its waitset. - * - * @param worker_context + * + * @param worker_context */ static void ump_worker_schedule(struct ump_worker_context *worker_context) { // we want to be automatically re-registered upon completion of an event // worker_context->waitset_chan.persistent = true; errval_t err = waitset_chan_trigger_closure( - worker_context->run_on_waitset, + worker_context->run_on_waitset, &worker_context->waitset_chan, MKCLOSURE(ump_waitset_worker, worker_context) ); @@ -290,7 +290,7 @@ static void ump_worker_schedule(struct ump_worker_context *worker_context) { /** * @brief used to handle the async work on a waitset - * + * * @param arg the worker context */ static void ump_waitset_worker(void *arg) { @@ -317,7 +317,7 @@ errval_t ump_chan_init( struct frame_identity shared_frame_id; err = frame_identify(shared_frame, &shared_frame_id); if (err_is_fail(err)) return LIB_ERR_FRAME_IDENTIFY; - + // map the full frame void *shared_mem; err = paging_map_frame(get_current_paging_state(), &shared_mem, shared_frame_id.bytes, shared_frame); @@ -325,7 +325,7 @@ errval_t ump_chan_init( // get the size of the rings for each direction size_t ring_size = shared_frame_id.bytes / 2; - debug_printf("[ump_chan_init] Each channel is %lu bytes\n", ring_size); + // debug_printf("[ump_chan_init] Each channel is %lu bytes\n", ring_size); // allocate the channel structures struct ump_send_chan *send_chan = malloc(sizeof(struct ump_send_chan)); @@ -379,7 +379,7 @@ errval_t ump_chan_init( worker_context->recv_chan = recv_chan; worker_context->send_chan = send_chan; - + if (run_on_waitset != NULL) { // we need to run on a waitset so initialize it and schedule the worker on it waitset_chanstate_init(&worker_context->waitset_chan, CHANTYPE_OTHER); @@ -415,7 +415,7 @@ void ump_send ( void *callback_arg ) { assert(chan != NULL); - + // initialize the queue entry entry->state = UMP_SEND_ENTRY_STATE_START_MESSAGE; entry->header_size = header_size; @@ -464,7 +464,7 @@ void ump_recv_payload ( void *callback_arg ) { assert(chan != NULL); - + thread_mutex_lock(&chan->recv_register_lock); // NOTE rueegges: caller has to ensure it only registers at most once?! Or should we just make it a noop? assert(chan->state == UMP_RECV_STATE_PAYLOAD_IDLE); @@ -480,4 +480,4 @@ void ump_recv_payload ( chan->state = UMP_RECV_STATE_PAYLOAD; thread_mutex_unlock(&chan->recv_register_lock); -} \ No newline at end of file +} diff --git a/lib/fs/fat32.c b/lib/fs/fat32.c index e15b5c5..2476443 100644 --- a/lib/fs/fat32.c +++ b/lib/fs/fat32.c @@ -61,8 +61,8 @@ static uint8_t fat32_get_active_fat(struct fat32 *fat32) { } /** - * @brief - * + * @brief + * * @param directory_entry_ref reference to the directory entry that we want to get an id for * @return uint64_t unique identifier for the directory entry referenced */ @@ -208,7 +208,7 @@ static errval_t fat32_extend_cluster_chain(struct fat32 *fat32, uint32_t current uint32_t old_entry; err = fat32->read_object_fn(fat_sector_num, fat_sector_offset, 4, &old_entry); if (err_is_fail(err)) return err; - + assert(new_tail_cluster_number <= 0x0FFFFFFF); // preserve the upper 4 bits of the entry uint32_t new_entry = (old_entry & 0xF0000000) | new_tail_cluster_number; @@ -256,7 +256,7 @@ static errval_t fat32_next_cluster_in_chain_or_extend(struct fat32 *fat32, uint3 // we have a valid next cluster return SYS_ERR_OK; } - + // we need to extend the chain // find a free cluster @@ -323,7 +323,7 @@ static bool fat32_name_is_dotdot(const char *short_name, const char *short_name_ /** * @brief turn the weird short_name and short_name_ext fields of a directory entry into a beautiful name - * + * * @param directory_entry entry for which we want the nice name * @return char* memory allocated using malloc containing the nice name or NULL if malloc failed */ @@ -369,7 +369,7 @@ static char* fat32_directory_entry_get_nice_name(struct fat32_directory_entry *d /** * @brief Get the next element of a path. elements are separated with one or more FS_PATH_SEP. Checks for validity of path elements - * + * * @param path_cursor where to start looking for the next element * @param path_end first byte that should not be looked at anymore * @param return_path_cursor where in the path we ended up after extracting the next element @@ -619,9 +619,9 @@ static errval_t fat32_search_in_directory( uint32_t first_sector_of_cluster = fat32_first_sector_of_cluster(fat32, current_cluster); for (uint32_t sector_offset = 0; sector_offset < fat32->sectors_per_cluster; ++sector_offset) { - + uint32_t current_sector = first_sector_of_cluster + sector_offset; - + struct fat32_directory_entry directory_entries[FAT32_DIRECTORY_ENTRIES_PER_SECTOR]; err = fat32->read_object_fn(current_sector, 0, FAT32_BLOCK_SIZE, directory_entries); if (err_is_fail(err)) return err; @@ -643,7 +643,7 @@ static errval_t fat32_search_in_directory( path_resolve_result->directory_entry_ref.sector_number = current_sector; path_resolve_result->directory_entry_ref.index_in_sector = directory_index; - // NOTE: there is a special case for dotdot directories that reside in direct child directories of + // NOTE: there is a special case for dotdot directories that reside in direct child directories of // the root directory. The cluster number is set to 0 and we need to change it to the first root cluster // for traversal if (fat32_name_is_dotdot(short_name, short_name_ext) && fat32_directory_entry_to_first_cluster(&directory_entries[directory_index]) == 0) { @@ -688,9 +688,9 @@ static errval_t fat32_check_directory_empty( uint32_t first_sector_of_cluster = fat32_first_sector_of_cluster(fat32, current_cluster); for (uint32_t sector_offset = 0; sector_offset < fat32->sectors_per_cluster; ++sector_offset) { - + uint32_t current_sector = first_sector_of_cluster + sector_offset; - + struct fat32_directory_entry directory_entries[FAT32_DIRECTORY_ENTRIES_PER_SECTOR]; err = fat32->read_object_fn(current_sector, 0, FAT32_BLOCK_SIZE, directory_entries); if (err_is_fail(err)) return err; @@ -730,7 +730,7 @@ static errval_t fat32_skip_mount_point(struct fat32 *fat32, const char *path, co if (strncmp(fat32->mount, path, mount_point_len)) { return FS_ERR_NOTFOUND; } - + *result_path = path + strlen(fat32->mount); return SYS_ERR_OK; @@ -884,7 +884,7 @@ static errval_t fat32_handle_update_current_cluster(struct fat32 *fat32, struct errval_t err; // debug_printf("[fat32_handle_update_current_cluster]\n"); - + size_t cluster_index = handle->byte_offset / fat32->bytes_per_cluster; // debug_printf("[fat32_handle_update_current_cluster] target cluster %lu for offset %lu\n", cluster_index, handle->byte_offset); @@ -920,9 +920,9 @@ static errval_t fat32_handle_update_current_cluster(struct fat32 *fat32, struct /** * @brief Verify contents of the bootsector of the SD Card - * + * * Note: This is only valid for very specific FAT32 configurations used in this course - * + * * @param bpb struct to verify */ __attribute__((__unused__)) @@ -994,21 +994,21 @@ static void fat32_print(struct bpb *bpb){ } } -// +// /** * @brief Check if the file system is FAT32. * The authors of the FAT32 specification are very strict that it MUST be done exactly this way so here we go. */ static bool is_fat32(struct bpb *bpb) { - debug_printf("[is_fat32] check fat type\n"); + // debug_printf("[is_fat32] check fat type\n"); uint32_t root_dir_sectors = ((bpb->root_entry_count * 32) + (bpb->bytes_per_sector - 1)) / bpb->bytes_per_sector; uint32_t fat_size; - if (bpb->fat_sectors_16_count != 0) + if (bpb->fat_sectors_16_count != 0) fat_size = bpb->fat_sectors_16_count; else fat_size = bpb->bpb_fat.bpb_fat32.fat_sectors_32_count; - + uint32_t tot_sec; if (bpb->total_sector_16_count != 0) tot_sec = bpb->total_sector_16_count; @@ -1017,7 +1017,7 @@ static bool is_fat32(struct bpb *bpb) { // NOTE: the start of the data region (first_data_sector) is the first sector of cluster 2 uint32_t first_data_sector = bpb->reserved_sector_count + (bpb->fat_count * fat_size) + root_dir_sectors; - + // NOTE: the number of data sectors uint32_t data_sec = tot_sec - first_data_sector; // NOTE: the number of clusters @@ -1046,7 +1046,7 @@ errval_t fat32_init( ) { errval_t err; - debug_printf("[fat32_init]\n"); + // debug_printf("[fat32_init]\n"); struct fat32 *fat32 = malloc(sizeof(struct fat32)); if (fat32 == NULL) return LIB_ERR_MALLOC_FAIL; @@ -1070,7 +1070,7 @@ errval_t fat32_init( } // initialize struct contents - debug_printf("[fat32_init] initialize state\n"); + // debug_printf("[fat32_init] initialize state\n"); fat32->bytes_per_sector = bpb->bytes_per_sector; fat32->sectors_per_cluster = bpb->sectors_per_cluster; fat32->reserved_sector_count = bpb->reserved_sector_count; @@ -1088,10 +1088,10 @@ errval_t fat32_init( // fat32_print(bpb); fat32_verify(bpb); - debug_printf("[fat32_init] verified FAT32\n"); + DEBUG_PRINTF("[fat32_init] verified FAT32\n"); *return_fat32 = fat32; - + return SYS_ERR_OK; } @@ -1106,7 +1106,7 @@ static errval_t _fat32_mkdir(struct fat32 *fat32, const char *path) { if (err_is_fail(err)) return FS_ERR_EXISTS; // debug_printf("[fat32_mkdir] basename: %s\n", basename); - + // resolve the parent path struct fat32_path_resolve_result parent_path_resolve_result; err = fat32_resolve_path_partial(fat32, path, basename, &parent_path_resolve_result); @@ -1124,7 +1124,7 @@ static errval_t _fat32_mkdir(struct fat32 *fat32, const char *path) { short_name_ext ); if (err_is_fail(err)) return err; - + // check if the entry already exists // debug_printf("[fat32_mkdir] checking if dir exists already\n"); err = fat32_search_in_directory( @@ -1144,7 +1144,7 @@ static errval_t _fat32_mkdir(struct fat32 *fat32, const char *path) { fat32, &parent_path_resolve_result.directory_entry, &free_path_resolve_result - ); + ); if (err_is_fail(err)) return err; // find a free cluster for the directory @@ -1218,7 +1218,7 @@ static errval_t _fat32_mkdir(struct fat32 *fat32, const char *path) { } errval_t fat32_mkdir(struct fat32 *fat32, const char *path) { errval_t err; - + // do the mountpoint check before taking the lock to avoid deadlocks const char *path_without_mount; err = fat32_skip_mount_point(fat32, path, &path_without_mount); @@ -1259,7 +1259,7 @@ static errval_t _fat32_opendir(struct fat32 *fat32, const char *path, struct fat } errval_t fat32_opendir(struct fat32 *fat32, const char *path, struct fat32_handle **dir_handle) { errval_t err; - + // do the mountpoint check before taking the lock to avoid deadlocks const char *path_without_mount; err = fat32_skip_mount_point(fat32, path, &path_without_mount); @@ -1284,7 +1284,7 @@ static errval_t _fat32_stat(struct fat32 *fat32, struct fat32_handle *handle, st assert(fileinfo != NULL); errval_t err; - + if (handle->is_dir) { fileinfo->type = FS_DIRECTORY; // NOTE rueegges: This should probably be changed to sum over all files in subtree or similar @@ -1325,7 +1325,7 @@ static errval_t _fat32_readdir(struct fat32 *fat32, struct fat32_handle *dir_han for (uint32_t sector_offset = (dir_handle->byte_offset / fat32->bytes_per_sector) % fat32->sectors_per_cluster; sector_offset < fat32->sectors_per_cluster; ++sector_offset) { uint32_t current_sector = first_sector_of_cluster + sector_offset; - + struct fat32_directory_entry directory_entries[FAT32_DIRECTORY_ENTRIES_PER_SECTOR]; err = fat32->read_object_fn(current_sector, 0, FAT32_BLOCK_SIZE, directory_entries); if (err_is_fail(err)) return err; @@ -1338,7 +1338,7 @@ static errval_t _fat32_readdir(struct fat32 *fat32, struct fat32_handle *dir_han if (directory_entries[directory_index].short_name[0] == 0x00) return FS_ERR_INDEX_BOUNDS; // hide hidden entries if (directory_entries[directory_index].attributes & FAT32_ATTR_HIDDEN) continue; - + // found the next directory *name = fat32_directory_entry_get_nice_name(&directory_entries[directory_index]); if(*name == NULL) return LIB_ERR_MALLOC_FAIL; @@ -1386,7 +1386,7 @@ static errval_t _fat32_rmdir(struct fat32 *fat32, const char *path) { } errval_t fat32_rmdir(struct fat32 *fat32, const char *path) { errval_t err; - + // do the mountpoint check before taking the lock to avoid deadlocks const char *path_without_mount; err = fat32_skip_mount_point(fat32, path, &path_without_mount); @@ -1443,7 +1443,7 @@ static errval_t _fat32_fcreate(struct fat32 *fat32, const char *path, struct fat if (err_is_fail(err)) return err; // debug_printf("[fat32_fcreate] basename: %s\n", basename); - + // resolve the parent path struct fat32_path_resolve_result parent_path_resolve_result; err = fat32_resolve_path_partial(fat32, path, basename, &parent_path_resolve_result); @@ -1480,7 +1480,7 @@ static errval_t _fat32_fcreate(struct fat32 *fat32, const char *path, struct fat fat32, &parent_path_resolve_result.directory_entry, &free_path_resolve_result - ); + ); if (err_is_fail(err)) return err; // find a free cluster for the file @@ -1563,7 +1563,7 @@ static errval_t _fat32_fopen(struct fat32 *fat32, const char *path, struct fat32 path_resolve_result.directory_entry_ref ); if (err_is_fail(err)) return err; - + return SYS_ERR_OK; } errval_t fat32_fopen(struct fat32 *fat32, const char *path, struct fat32_handle **file_handle) { @@ -1747,7 +1747,7 @@ errval_t fat32_fwrite(struct fat32 *fat32, struct fat32_handle *file_handle, con static errval_t _fat32_fclose(struct fat32 *fat32, struct fat32_handle *file_handle) { // debug_printf("[fat32_fclose]\n"); - + if (file_handle == NULL || file_handle->is_dir) return FS_ERR_INVALID_FH; return fat32_free_handle(fat32, file_handle); @@ -1768,7 +1768,7 @@ errval_t fat32_tell(struct fat32 *fat32, struct fat32_handle *file_handle, size_ static errval_t _fat32_seek(struct fat32 *fat32, struct fat32_handle *file_handle, enum fs_seekpos whence, off_t offset) { // debug_printf("[fat32_seek] whence: %ld@%d\n", offset, whence); errval_t err; - + if (file_handle == NULL || file_handle->is_dir) return FS_ERR_INVALID_FH; size_t absolute_offset = 0; diff --git a/lib/grading/grading.c b/lib/grading/grading.c index 9fb136d..2bb3d81 100644 --- a/lib/grading/grading.c +++ b/lib/grading/grading.c @@ -21,12 +21,12 @@ extern coreid_t my_core_id; void grading_setup_bsp_init(int argc, char **argv) { - debug_printf("grading_setup_bsp_init(argc=%d)\n", argc); + DEBUG_PRINTF("grading_setup_bsp_init(argc=%d)\n", argc); } void grading_setup_app_init(struct bootinfo * bi) { - debug_printf("grading_setup_app_init(bi=%p)\n", bi); + DEBUG_PRINTF("grading_setup_app_init(bi=%p)\n", bi); } void @@ -52,7 +52,7 @@ grading_test_early(void) { void grading_test_late(void) { if (my_core_id == 0) { - do_test_spawn(); - do_test_fs(); + // do_test_spawn(); + // do_test_fs(); } } diff --git a/lib/grading/rpc.c b/lib/grading/rpc.c index f6cd588..2890653 100644 --- a/lib/grading/rpc.c +++ b/lib/grading/rpc.c @@ -8,40 +8,40 @@ void grading_rpc_handle_number(uintptr_t val) { - debug_printf("grading_rpc_handle_number(%"PRIuPTR")\n", val); + DEBUG_PRINTF("grading_rpc_handle_number(%"PRIuPTR")\n", val); } void grading_rpc_handler_string(const char* string) { - debug_printf("grading_rpc_handler_string(\"%s\")\n", string); + DEBUG_PRINTF("grading_rpc_handler_string(\"%s\")\n", string); } void grading_rpc_handler_serial_getchar(void) { - debug_printf("grading_rpc_handler_serial_getchar()\n"); + DEBUG_PRINTF("grading_rpc_handler_serial_getchar()\n"); } void grading_rpc_handler_serial_putchar(char c) { - debug_printf("grading_rpc_handler_serial_putchar(0x%"PRIx8")\n", c); + DEBUG_PRINTF("grading_rpc_handler_serial_putchar(0x%"PRIx8")\n", c); } void grading_rpc_handler_ram_cap(size_t bytes, size_t alignment) { - // debug_printf("grading_rpc_handler_ram_cap(0x%"PRIxPTR", 0x%"PRIxPTR")\n", bytes, alignment); + // DEBUG_PRINTF("grading_rpc_handler_ram_cap(0x%"PRIxPTR", 0x%"PRIxPTR")\n", bytes, alignment); } void grading_rpc_handler_process_spawn(char* cmdline, coreid_t core) { - debug_printf("grading_rpc_handler_process_spawn(\"%s\", %"PRIuCOREID")\n", cmdline, core); + DEBUG_PRINTF("grading_rpc_handler_process_spawn(\"%s\", %"PRIuCOREID")\n", cmdline, core); } void grading_rpc_handler_process_get_name(domainid_t pid) { - debug_printf("grading_rpc_handler_process_get_name(%"PRIuDOMAINID")\n", pid); + DEBUG_PRINTF("grading_rpc_handler_process_get_name(%"PRIuDOMAINID")\n", pid); } void grading_rpc_handler_process_get_all_pids(void) { - debug_printf("grading_rpc_handler_process_get_all_pids()\n"); + DEBUG_PRINTF("grading_rpc_handler_process_get_all_pids()\n"); } diff --git a/lib/spawn/spawn.c b/lib/spawn/spawn.c index eff36e5..d5677fa 100644 --- a/lib/spawn/spawn.c +++ b/lib/spawn/spawn.c @@ -36,7 +36,7 @@ errval_t allocate_pid (const char *process_name, domainid_t *pid) { if (name_copy == NULL) return LIB_ERR_MALLOC_FAIL; process_names[spawn_next_pid] = name_copy; - debug_printf("Allocated pid %"PRIuDOMAINID" for process \"%s\".\n", spawn_next_pid, process_name); + DEBUG_PRINTF("Allocated pid %"PRIuDOMAINID" for process \"%s\".\n", spawn_next_pid, process_name); *pid = spawn_next_pid; spawn_next_pid++; @@ -98,7 +98,7 @@ static void handle_child_recv(void *arg) { switch(msg.words[0]){ case RPC_MTYPE_CHILD_ENDPOINT: - debug_printf("SPAWN: Received child init_chan endpoint\n"); + // debug_printf("SPAWN: Received child init_chan endpoint\n"); si->init_chan.remote_cap = cap; err = lmp_chan_alloc_recv_slot(&si->init_chan); if (err_is_fail(err)) { @@ -384,7 +384,7 @@ static errval_t spawn_load_elf_from_fs(char *path, char **elf_base, size_t *elf_ static errval_t spawn_load_elf_from_multiboot(char *name, char **elf_base, size_t *elf_bytes) { errval_t err; - debug_printf("[spawn_load_elf_from_multiboot] %s\n", name); + DEBUG_PRINTF("[spawn_load_elf_from_multiboot] %s\n", name); struct mem_region *module = multiboot_find_module(bi, name); if (module == NULL) return SPAWN_ERR_FIND_MODULE; @@ -409,7 +409,7 @@ static errval_t spawn_load_elf_from_multiboot(char *name, char **elf_base, size_ ); if (err_is_fail(err)) return err_push(err, SPAWN_ERR_MAP_MODULE); - debug_printf("SPAWN: multiboot mapped %s, size: %"PRIuPTR", magic: %"PRIx8" %c%c%c\n", + DEBUG_PRINTF("SPAWN: multiboot mapped %s, size: %"PRIuPTR", magic: %"PRIx8" %c%c%c\n", name, *elf_bytes, (*elf_base)[0], (*elf_base)[1], (*elf_base)[2], (*elf_base)[3]); return SYS_ERR_OK; diff --git a/usr/drivers/block_driver_server/main.c b/usr/drivers/block_driver_server/main.c index 6b59c81..290a022 100644 --- a/usr/drivers/block_driver_server/main.c +++ b/usr/drivers/block_driver_server/main.c @@ -275,7 +275,7 @@ static errval_t write_object(uint32_t block_number, size_t offset, size_t size, // debug_printf("Write start: '%.5s'\n", src); memcpy(dma_buffer + offset, src, size); - + #ifdef BLOCK_DRIVER_CACHE // update the cache metadata current_block_in_buffer = block_number; @@ -431,7 +431,7 @@ static void handle_payload(void *arg, size_t payload_size, void *payload) { // free the payload buffer, we don't use it anymore free(payload); } - + // listen for the next request on this channel ump_recv_header(state->recv_chan, handle_request, arg); } @@ -439,7 +439,7 @@ static void handle_payload(void *arg, size_t payload_size, void *payload) { static errval_t connect_callback(void *arg, struct capref cap) { errval_t err; - printf("[block_driver_server] incoming connection\n"); + // printf("[block_driver_server] incoming connection\n"); struct ump_send_chan *send_chan; struct ump_recv_chan *recv_chan; @@ -455,7 +455,7 @@ static errval_t connect_callback(void *arg, struct capref cap) { state->send_chan = send_chan; ump_recv_header(recv_chan, handle_request, state); - printf("[block_driver_server] connection ready to receive requests\n"); + // printf("[block_driver_server] connection ready to receive requests\n"); return SYS_ERR_OK; } @@ -481,7 +481,7 @@ int main(int argc, char *argv[]) { if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to map device registers"); // initialize the sdhc driver - printf("[block_driver_server] initializing sdhc driver\n"); + DEBUG_PRINTF("[block_driver_server] initializing sdhc driver\n"); err = sdhc_init(&sdhc, device_register_vaddr); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to initialize sdhc driver"); @@ -501,13 +501,12 @@ int main(int argc, char *argv[]) { err = paging_map_frame_attr(get_current_paging_state(), &dma_buffer, size, dma_buffer_frame, VREGION_FLAGS_READ_WRITE); if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP); - printf("[block_driver_server] registering\n"); struct ump_binding_server server; err = ump_binding_register(&server, UMP_SERVER_BLOCK_DRIVER, connect_callback, NULL); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server"); // wait for connections to the server - printf("[block_driver_server] listening\n"); + printf("[block_driver_server] ready\n"); struct waitset *default_ws = get_default_waitset(); while (true) { err = event_dispatch(default_ws); @@ -518,4 +517,4 @@ int main(int argc, char *argv[]) { } return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/usr/drivers/enet/enet_module.c b/usr/drivers/enet/enet_module.c index bd84d20..e6dd282 100644 --- a/usr/drivers/enet/enet_module.c +++ b/usr/drivers/enet/enet_module.c @@ -576,7 +576,7 @@ struct enet_driver_state *st; int main(int argc, char *argv[]) { errval_t err; - debug_printf("Enet driver started \n"); + DEBUG_PRINTF("Enet driver started \n"); st = (struct enet_driver_state*)calloc(1, sizeof(struct enet_driver_state)); assert(st != NULL); @@ -615,9 +615,9 @@ int main(int argc, char *argv[]) { return err; } - debug_printf("Enet driver init done \n"); + DEBUG_PRINTF("Enet driver init done \n"); - debug_printf("Creating devqs \n"); + DEBUG_PRINTF("Creating devqs \n"); err = enet_rx_queue_create(&st->rxq, st->d); if (err_is_fail(err)) { diff --git a/usr/echoserver/main.c b/usr/echoserver/main.c index 2fc7ae6..9626075 100644 --- a/usr/echoserver/main.c +++ b/usr/echoserver/main.c @@ -74,7 +74,7 @@ static void udp_listen_callback (void *arg, errval_t err, uint16_t src_port) { DEBUG_ERR(err, "failed to listen on UDP"); return; } - printf("Echo server: Listening on UDP port %d.\n", src_port); + DEBUG_PRINTF("Listening on UDP port %d.\n", src_port); } static void net_reply_callback (void *arg, errval_t err) { @@ -133,7 +133,7 @@ static void tcp_listen_callback (void *arg, errval_t err, uint16_t src_port) { DEBUG_ERR(err, "failed to listen on TCP"); return; } - printf("Echo server: Listening on TCP port %d.\n", src_port); + DEBUG_PRINTF("Listening on TCP port %d.\n", src_port); } static void tcp_receive_available_handler (void *arg) { @@ -188,11 +188,11 @@ int main (int argc, char *argv[]) { errval_t err; struct waitset *default_ws = get_default_waitset(); - printf("Echo server: registering\n"); + // printf("Echo server: registering\n"); struct ump_binding_server server; err = ump_binding_register(&server, UMP_SERVER_ECHO, connect_server, NULL); if (err_is_fail(err)) USER_PANIC_ERR(err, "Failed to register UMP server"); - printf("Echo server: listening\n"); + // printf("Echo server: listening\n"); simpleslab_init(&slabs, sizeof(struct echo_buf), slab_buf, sizeof(slab_buf)); diff --git a/usr/init/main.c b/usr/init/main.c index 56a4454..b691aab 100644 --- a/usr/init/main.c +++ b/usr/init/main.c @@ -165,7 +165,7 @@ static errval_t init_fs(void) { // give the dispatcher a skip waitset_chanstate_init(&self_rpc_waitset_chan, CHANTYPE_OTHER); err = waitset_chan_trigger_closure( - get_default_waitset(), + get_default_waitset(), &self_rpc_waitset_chan, MKCLOSURE(noop_callback, NULL) ); @@ -296,7 +296,7 @@ bsp_main(int argc, char *argv[]) { // Grading grading_test_late(); - debug_printf("Message handler loop\n"); + DEBUG_PRINTF("Message handler loop\n"); // Hang around struct waitset *default_ws = get_default_waitset(); while (true) { @@ -439,7 +439,7 @@ app_main(int argc, char *argv[]) { } free(bi_ser); - debug_printf("[app_main]: received bootinfo with %d regions\n", bi->regions_length); + DEBUG_PRINTF("[app_main]: received bootinfo with %d regions\n", bi->regions_length); // Grading grading_setup_app_init(bi); @@ -469,7 +469,7 @@ app_main(int argc, char *argv[]) { // Grading grading_test_late(); - debug_printf("Message handler loop\n"); + DEBUG_PRINTF("Message handler loop\n"); // Hang around struct waitset *default_ws = get_default_waitset(); while (true) { diff --git a/usr/shelly/shelly.h b/usr/shelly/shelly.h index 2728d90..844227f 100644 --- a/usr/shelly/shelly.h +++ b/usr/shelly/shelly.h @@ -10,7 +10,7 @@ #ifndef SHELLY_H_ #define SHELLY_H_ -#define SHELLY_DEBUG_ON 1 +// #define SHELLY_DEBUG_ON 1 #if defined(SHELLY_DEBUG_ON) #define SHELLY_DEBUG(x...) debug_printf("[SHELLY_DEBUG] " x);