diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 13:35:32 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-11-29 13:35:32 +0000 |
commit | 18daff9b95bbe4d5004a99079207a5343760ecd3 (patch) | |
tree | b964869a341cda8ab268ae3643ea9be3ed1a78f4 /cpukit | |
parent | Whitespace removal. (diff) | |
download | rtems-18daff9b95bbe4d5004a99079207a5343760ecd3.tar.bz2 |
Whitespace removal.
Diffstat (limited to 'cpukit')
31 files changed, 256 insertions, 256 deletions
diff --git a/cpukit/itron/include/rtems/itron/task.h b/cpukit/itron/include/rtems/itron/task.h index 7aa146c4e6..13722d3b48 100644 --- a/cpukit/itron/include/rtems/itron/task.h +++ b/cpukit/itron/include/rtems/itron/task.h @@ -59,7 +59,7 @@ ITRON_EXTERN Objects_Information _ITRON_Task_Information; /** * When the user configures a set of ITRON API initialization tasks, * This variable will point to the method used to initialize them. - * + * * @note It is instantiated and initialized by confdefs.h based upon * application requirements. */ diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c index d9aa784e3d..60aca5df0d 100644 --- a/cpukit/libblock/src/bdbuf.c +++ b/cpukit/libblock/src/bdbuf.c @@ -20,7 +20,7 @@ * issues. * * Copyright (c) 2009 embedded brains GmbH. - * + * * @(#) bdbuf.c,v 1.14 2004/04/17 08:15:17 ralf Exp */ @@ -98,7 +98,7 @@ typedef struct rtems_bdbuf_cache * swap out task. It deletes itself. */ rtems_chain_control swapout_workers; /**< The work threads for the swapout * task. */ - + rtems_bdbuf_buffer* bds; /**< Pointer to table of buffer * descriptors. */ void* buffers; /**< The buffer's memory. */ @@ -132,7 +132,7 @@ typedef struct rtems_bdbuf_cache size_t group_count; /**< The number of groups. */ rtems_bdbuf_group* groups; /**< The groups. */ - + bool initialised; /**< Initialised state. */ } rtems_bdbuf_cache; @@ -416,7 +416,7 @@ rtems_bdbuf_avl_insert(rtems_bdbuf_buffer** root, p = q; } - + q->avl.left = q->avl.right = NULL; q->avl.bal = 0; modified = true; @@ -951,7 +951,7 @@ rtems_bdbuf_anonymous_wait (rtems_bdbuf_waiters *waiters) { rtems_status_code sc; rtems_mode prev_mode; - + /* * Indicate we are waiting. */ @@ -968,7 +968,7 @@ rtems_bdbuf_anonymous_wait (rtems_bdbuf_waiters *waiters) * semaphore. */ prev_mode = rtems_bdbuf_disable_preemption (); - + /* * Unlock the cache, wait, and lock the cache when we return. */ @@ -978,14 +978,14 @@ rtems_bdbuf_anonymous_wait (rtems_bdbuf_waiters *waiters) if (sc == RTEMS_TIMEOUT) rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_TO); - + if (sc != RTEMS_UNSATISFIED) rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_CACHE_WAIT_2); - + rtems_bdbuf_lock_cache (); rtems_bdbuf_restore_preemption (prev_mode); - + --waiters->count; } @@ -1060,7 +1060,7 @@ rtems_bdbuf_add_to_modified_list_after_access (rtems_bdbuf_buffer *bd) */ if (bd->state == RTEMS_BDBUF_STATE_ACCESS) bd->hold_timer = bdbuf_config.swap_block_hold; - + rtems_bdbuf_set_state (bd, RTEMS_BDBUF_STATE_MODIFIED); rtems_chain_append (&bdbuf_cache.modified, &bd->link); @@ -1107,12 +1107,12 @@ rtems_bdbuf_bds_per_group (size_t size) { size_t bufs_per_size; size_t bds_per_size; - + if (size > bdbuf_config.buffer_max) return 0; - + bufs_per_size = ((size - 1) / bdbuf_config.buffer_min) + 1; - + for (bds_per_size = 1; bds_per_size < bufs_per_size; bds_per_size <<= 1) @@ -1135,7 +1135,7 @@ rtems_bdbuf_remove_from_cache_and_lru_list (rtems_bdbuf_buffer *bd) default: rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_10); } - + rtems_chain_extract (&bd->link); } @@ -1166,17 +1166,17 @@ rtems_bdbuf_group_realloc (rtems_bdbuf_group* group, size_t new_bds_per_group) printf ("bdbuf:realloc: %tu: %zd -> %zd\n", group - bdbuf_cache.groups, group->bds_per_group, new_bds_per_group); - + bufs_per_bd = bdbuf_cache.max_bds_per_group / group->bds_per_group; - + for (b = 0, bd = group->bdbuf; b < group->bds_per_group; b++, bd += bufs_per_bd) rtems_bdbuf_remove_from_cache_and_lru_list (bd); - + group->bds_per_group = new_bds_per_group; bufs_per_bd = bdbuf_cache.max_bds_per_group / new_bds_per_group; - + for (b = 1, bd = group->bdbuf + bufs_per_bd; b < group->bds_per_group; b++, bd += bufs_per_bd) @@ -1279,7 +1279,7 @@ rtems_bdbuf_init (void) */ if ((bdbuf_config.buffer_max % bdbuf_config.buffer_min) != 0) return RTEMS_INVALID_NUMBER; - + /* * We use a special variable to manage the initialisation incase we have * completing threads doing this. You may get errors if the another thread @@ -1295,7 +1295,7 @@ rtems_bdbuf_init (void) memset(&bdbuf_cache, 0, sizeof(bdbuf_cache)); bdbuf_cache.initialised = true; rtems_bdbuf_restore_preemption (prev_mode); - + /* * For unspecified cache alignments we use the CPU alignment. */ @@ -1320,13 +1320,13 @@ rtems_bdbuf_init (void) goto error; rtems_bdbuf_lock_cache (); - + sc = rtems_semaphore_create (rtems_build_name ('B', 'D', 'C', 's'), 1, RTEMS_BDBUF_CACHE_LOCK_ATTRIBS, 0, &bdbuf_cache.sync_lock); if (sc != RTEMS_SUCCESSFUL) goto error; - + sc = rtems_semaphore_create (rtems_build_name ('B', 'D', 'C', 'a'), 0, RTEMS_BDBUF_CACHE_WAITER_ATTRIBS, 0, &bdbuf_cache.access_waiters.sema); @@ -1344,7 +1344,7 @@ rtems_bdbuf_init (void) &bdbuf_cache.buffer_waiters.sema); if (sc != RTEMS_SUCCESSFUL) goto error; - + /* * Compute the various number of elements in the cache. */ @@ -1370,13 +1370,13 @@ rtems_bdbuf_init (void) bdbuf_cache.group_count); if (!bdbuf_cache.groups) goto error; - + /* * Allocate memory for buffer memory. The buffer memory will be cache * aligned. It is possible to free the memory allocated by rtems_memalign() * with free(). Return 0 if allocated. * - * The memory allocate allows a + * The memory allocate allows a */ if (rtems_memalign ((void **) &bdbuf_cache.buffers, cache_aligment, @@ -1395,7 +1395,7 @@ rtems_bdbuf_init (void) bd->dev = BDBUF_INVALID_DEV; bd->group = group; bd->buffer = buffer; - + rtems_chain_append (&bdbuf_cache.lru, &bd->link); if ((b % bdbuf_cache.max_bds_per_group) == @@ -1414,13 +1414,13 @@ rtems_bdbuf_init (void) group->bds_per_group = bdbuf_cache.max_bds_per_group; group->bdbuf = bd; } - + /* * Create and start swapout task. This task will create and manage the worker * threads. */ bdbuf_cache.swapout_enabled = true; - + sc = rtems_task_create (rtems_build_name('B', 'S', 'W', 'P'), bdbuf_config.swapout_priority ? bdbuf_config.swapout_priority : @@ -1472,7 +1472,7 @@ rtems_bdbuf_wait_for_event (rtems_event_set event) { rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_event_set out = 0; - + sc = rtems_event_receive (event, RTEMS_EVENT_ALL | RTEMS_WAIT, RTEMS_NO_TIMEOUT, @@ -1595,7 +1595,7 @@ rtems_bdbuf_wait_for_buffer (void) { if (!rtems_chain_is_empty (&bdbuf_cache.modified)) rtems_bdbuf_wake_swapper (); - + rtems_bdbuf_anonymous_wait (&bdbuf_cache.buffer_waiters); } @@ -1605,7 +1605,7 @@ rtems_bdbuf_get_buffer_for_read_ahead (dev_t dev, size_t bds_per_group) { rtems_bdbuf_buffer *bd = NULL; - + bd = rtems_bdbuf_avl_search (&bdbuf_cache.tree, dev, block); if (bd == NULL) @@ -1631,7 +1631,7 @@ rtems_bdbuf_get_buffer_for_access (dev_t dev, size_t bds_per_group) { rtems_bdbuf_buffer *bd = NULL; - + do { bd = rtems_bdbuf_avl_search (&bdbuf_cache.tree, dev, block); @@ -1777,7 +1777,7 @@ rtems_bdbuf_get (dev_t dev, rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_2); break; } - + if (rtems_bdbuf_tracer) { rtems_bdbuf_show_users ("get", bd); @@ -1866,7 +1866,7 @@ rtems_bdbuf_create_read_request (rtems_blkdev_request *req, if (bd == NULL) break; - + req->bufs [transfer_index].user = bd; req->bufs [transfer_index].block = media_block; req->bufs [transfer_index].length = block_size; @@ -1900,7 +1900,7 @@ rtems_bdbuf_execute_read_request (rtems_blkdev_request *req, uint32_t transfer_index = 0; bool wake_transfer = false; bool wake_buffer = false; - + rtems_bdbuf_unlock_cache (); req->req = RTEMS_BLKDEV_REQ_READ; @@ -1909,7 +1909,7 @@ rtems_bdbuf_execute_read_request (rtems_blkdev_request *req, req->io_task = rtems_task_self (); req->status = RTEMS_RESOURCE_IN_USE; req->error = 0; - + result = dd->ioctl (dd, RTEMS_BLKIO_REQUEST, req); if (result == 0) @@ -1919,7 +1919,7 @@ rtems_bdbuf_execute_read_request (rtems_blkdev_request *req, } else error = errno; - + rtems_bdbuf_lock_cache (); for (transfer_index = 0; transfer_index < req->bufnum; ++transfer_index) @@ -1994,7 +1994,7 @@ rtems_bdbuf_read (dev_t dev, req = bdbuf_alloc (sizeof (rtems_blkdev_request) + sizeof ( rtems_blkdev_sg_buffer) * (bdbuf_config.max_read_ahead_blocks + 1)); - + if (rtems_bdbuf_tracer) printf ("bdbuf:read: %" PRIu32 " (%" PRIu32 ") (dev = %08x)\n", media_block + dd->start, block, (unsigned) dev); @@ -2022,7 +2022,7 @@ rtems_bdbuf_read (dev_t dev, rtems_bdbuf_show_users ("read", bd); rtems_bdbuf_show_usage (); } - + rtems_bdbuf_unlock_cache (); rtems_bdbuf_release_disk (dd); @@ -2069,10 +2069,10 @@ rtems_bdbuf_release (rtems_bdbuf_buffer *bd) rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_0); break; } - + if (rtems_bdbuf_tracer) rtems_bdbuf_show_usage (); - + rtems_bdbuf_unlock_cache (); return RTEMS_SUCCESSFUL; @@ -2097,10 +2097,10 @@ rtems_bdbuf_release_modified (rtems_bdbuf_buffer *bd) rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_6); break; } - + if (rtems_bdbuf_tracer) rtems_bdbuf_show_usage (); - + rtems_bdbuf_unlock_cache (); return RTEMS_SUCCESSFUL; @@ -2125,7 +2125,7 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer *bd) rtems_bdbuf_fatal (bd->state, RTEMS_BLKDEV_FATAL_BDBUF_STATE_5); break; } - + if (rtems_bdbuf_tracer) rtems_bdbuf_show_usage (); @@ -2140,7 +2140,7 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer *bd) rtems_bdbuf_wake (&bdbuf_cache.buffer_waiters); rtems_bdbuf_unlock_cache (); - + return RTEMS_SUCCESSFUL; } @@ -2164,7 +2164,7 @@ rtems_bdbuf_syncdev (dev_t dev) * sync lock can only be obtained with the cache unlocked. */ rtems_bdbuf_lock_sync (); - rtems_bdbuf_lock_cache (); + rtems_bdbuf_lock_cache (); /* * Set the cache to have a sync active for a specific device and let the swap @@ -2176,7 +2176,7 @@ rtems_bdbuf_syncdev (dev_t dev) bdbuf_cache.sync_active = true; bdbuf_cache.sync_requester = rtems_task_self (); bdbuf_cache.sync_device = dev; - + rtems_bdbuf_wake_swapper (); rtems_bdbuf_unlock_cache (); rtems_bdbuf_wait_for_event (RTEMS_BDBUF_TRANSFER_SYNC); @@ -2218,7 +2218,7 @@ static void rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) { rtems_disk_device* dd; - + if (rtems_bdbuf_tracer) printf ("bdbuf:swapout transfer: %08x\n", (unsigned) transfer->dev); @@ -2245,7 +2245,7 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) * block. */ uint32_t bufs_per_bd = dd->block_size / bdbuf_config.buffer_min; - + /* * Take as many buffers as configured and pass to the driver. Note, the * API to the drivers has an array of buffers and if a chain was passed @@ -2265,20 +2265,20 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) (rtems_bdbuf_buffer*) rtems_chain_get (&transfer->bds); bool write = false; - + /* * If the device only accepts sequential buffers and this is not the * first buffer (the first is always sequential, and the buffer is not * sequential then put the buffer back on the transfer chain and write * the committed buffers. */ - + if (rtems_bdbuf_tracer) printf ("bdbuf:swapout write: bd:%" PRIu32 ", bufnum:%" PRIu32 " mode:%s\n", bd->block, transfer->write_req->bufnum, dd->phys_dev->capabilities & RTEMS_BLKDEV_CAP_MULTISECTOR_CONT ? "MULIT" : "SCAT"); - + if ((dd->phys_dev->capabilities & RTEMS_BLKDEV_CAP_MULTISECTOR_CONT) && transfer->write_req->bufnum && (bd->block != (last_block + bufs_per_bd))) @@ -2320,11 +2320,11 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) * Perform the transfer. No cache locks, no preemption, only the disk * device is being held. */ - result = dd->ioctl (dd, RTEMS_BLKIO_REQUEST, transfer->write_req); + result = dd->ioctl (dd, RTEMS_BLKIO_REQUEST, transfer->write_req); if (result < 0) { rtems_bdbuf_lock_cache (); - + for (b = 0; b < transfer->write_req->bufnum; b++) { bd = transfer->write_req->bufs[b].user; @@ -2358,7 +2358,7 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) rtems_bdbuf_show_users ("write", bd); rtems_chain_append (&bdbuf_cache.lru, &bd->link); - + if (bd->waiters) rtems_bdbuf_wake (&bdbuf_cache.transfer_waiters); else @@ -2376,7 +2376,7 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) transfer->write_req->bufnum = 0; } } - + rtems_disk_release (dd); } else @@ -2419,7 +2419,7 @@ rtems_bdbuf_swapout_modified_processing (dev_t* dev, while (!rtems_chain_is_tail (chain, node)) { rtems_bdbuf_buffer* bd = (rtems_bdbuf_buffer*) node; - + /* * Check if the buffer's hold timer has reached 0. If a sync is active * or someone waits for a buffer force all the timers to 0. @@ -2429,7 +2429,7 @@ rtems_bdbuf_swapout_modified_processing (dev_t* dev, */ if (sync_active || rtems_bdbuf_has_buffer_waiters ()) bd->hold_timer = 0; - + if (bd->hold_timer) { if (update_timers) @@ -2459,7 +2459,7 @@ rtems_bdbuf_swapout_modified_processing (dev_t* dev, { rtems_chain_node* next_node = node->next; rtems_chain_node* tnode = rtems_chain_tail (transfer); - + /* * The blocks on the transfer list are sorted in block order. This * means multi-block transfers for drivers that require consecutive @@ -2472,7 +2472,7 @@ rtems_bdbuf_swapout_modified_processing (dev_t* dev, rtems_chain_extract (node); tnode = tnode->previous; - + while (node && !rtems_chain_is_head (transfer, tnode)) { rtems_bdbuf_buffer* tbd = (rtems_bdbuf_buffer*) tnode; @@ -2485,10 +2485,10 @@ rtems_bdbuf_swapout_modified_processing (dev_t* dev, else tnode = tnode->previous; } - + if (node) rtems_chain_prepend (transfer, node); - + node = next_node; } else @@ -2543,10 +2543,10 @@ rtems_bdbuf_swapout_processing (unsigned long timer_delta, if (worker) transfer = &worker->transfer; } - + rtems_chain_initialize_empty (&transfer->bds); transfer->dev = BDBUF_INVALID_DEV; - + /* * When the sync is for a device limit the sync to that device. If the sync * is for a buffer handle process the devices in the order on the sync @@ -2554,7 +2554,7 @@ rtems_bdbuf_swapout_processing (unsigned long timer_delta, */ if (bdbuf_cache.sync_active) transfer->dev = bdbuf_cache.sync_device; - + /* * If we have any buffers in the sync queue move them to the modified * list. The first sync buffer will select the device we use. @@ -2598,10 +2598,10 @@ rtems_bdbuf_swapout_processing (unsigned long timer_delta, { rtems_bdbuf_swapout_write (transfer); } - + transfered_buffers = true; } - + if (bdbuf_cache.sync_active && !transfered_buffers) { rtems_id sync_requester; @@ -2613,7 +2613,7 @@ rtems_bdbuf_swapout_processing (unsigned long timer_delta, if (sync_requester) rtems_event_send (sync_requester, RTEMS_BDBUF_TRANSFER_SYNC); } - + return transfered_buffers; } @@ -2669,7 +2669,7 @@ rtems_bdbuf_swapout_worker_task (rtems_task_argument arg) worker->transfer.dev = BDBUF_INVALID_DEV; rtems_chain_append (&bdbuf_cache.swapout_workers, &worker->link); - + rtems_bdbuf_unlock_cache (); } @@ -2687,9 +2687,9 @@ rtems_bdbuf_swapout_workers_open (void) { rtems_status_code sc; size_t w; - + rtems_bdbuf_lock_cache (); - + for (w = 0; w < bdbuf_config.swapout_workers; w++) { rtems_bdbuf_swapout_worker* worker; @@ -2701,7 +2701,7 @@ rtems_bdbuf_swapout_workers_open (void) rtems_chain_append (&bdbuf_cache.swapout_workers, &worker->link); worker->enabled = true; worker->transfer.write_req = rtems_bdbuf_swapout_writereq_alloc (); - + rtems_chain_initialize_empty (&worker->transfer.bds); worker->transfer.dev = BDBUF_INVALID_DEV; @@ -2722,7 +2722,7 @@ rtems_bdbuf_swapout_workers_open (void) if (sc != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_SO_WK_START); } - + rtems_bdbuf_unlock_cache (); } @@ -2733,9 +2733,9 @@ static void rtems_bdbuf_swapout_workers_close (void) { rtems_chain_node* node; - + rtems_bdbuf_lock_cache (); - + node = rtems_chain_first (&bdbuf_cache.swapout_workers); while (!rtems_chain_is_tail (&bdbuf_cache.swapout_workers, node)) { @@ -2744,7 +2744,7 @@ rtems_bdbuf_swapout_workers_close (void) rtems_event_send (worker->id, RTEMS_BDBUF_SWAPOUT_SYNC); node = rtems_chain_next (node); } - + rtems_bdbuf_unlock_cache (); } @@ -2781,7 +2781,7 @@ rtems_bdbuf_swapout_task (rtems_task_argument arg) * Create the worker threads. */ rtems_bdbuf_swapout_workers_open (); - + while (bdbuf_cache.swapout_enabled) { rtems_event_set out; @@ -2791,7 +2791,7 @@ rtems_bdbuf_swapout_task (rtems_task_argument arg) * Only update the timers once in the processing cycle. */ bool update_timers = true; - + /* * If we write buffers to any disk perform a check again. We only write a * single device at a time and the cache may have more than one device's @@ -2814,7 +2814,7 @@ rtems_bdbuf_swapout_task (rtems_task_argument arg) { transfered_buffers = true; } - + /* * Only update the timers once. */ @@ -2832,7 +2832,7 @@ rtems_bdbuf_swapout_task (rtems_task_argument arg) } rtems_bdbuf_swapout_workers_close (); - + free (transfer.write_req); rtems_task_delete (RTEMS_SELF); diff --git a/cpukit/libblock/src/blkdev.c b/cpukit/libblock/src/blkdev.c index dccb93b020..6a3419133d 100644 --- a/cpukit/libblock/src/blkdev.c +++ b/cpukit/libblock/src/blkdev.c @@ -5,7 +5,7 @@ * * Block device management. */ - + /* * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia * Author: Victor V. Vengerov <vvv@oktet.ru> @@ -272,7 +272,7 @@ rtems_blkdev_ioctl(rtems_disk_device *dd, uint32_t req, void *argp) { size_t *arg_size = argp; int rc = 0; - + switch (req) { case RTEMS_BLKIO_GETMEDIABLKSIZE: diff --git a/cpukit/libblock/src/diskdevs.c b/cpukit/libblock/src/diskdevs.c index 5256c84bf8..d75f2cbca5 100644 --- a/cpukit/libblock/src/diskdevs.c +++ b/cpukit/libblock/src/diskdevs.c @@ -5,7 +5,7 @@ * * @brief Block device disk management implementation. */ - + /* * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia * Author: Victor V. Vengerov <vvv@oktet.ru> @@ -190,7 +190,7 @@ create_disk(dev_t dev, const char *name, rtems_disk_device **dd_ptr) if (name != NULL) { alloc_name = strdup(name); - + if (alloc_name == NULL) { free(dd); @@ -266,7 +266,7 @@ rtems_status_code rtems_disk_create_phys( if ((*handler)(dd, RTEMS_BLKDEV_CAPABILITIES, &dd->capabilities) < 0) { dd->capabilities = 0; } - + disk_unlock(); return RTEMS_SUCCESSFUL; diff --git a/cpukit/libblock/src/flashdisk.c b/cpukit/libblock/src/flashdisk.c index 1b321ebe79..502a938fc9 100644 --- a/cpukit/libblock/src/flashdisk.c +++ b/cpukit/libblock/src/flashdisk.c @@ -246,13 +246,13 @@ typedef struct rtems_flashdisk uint32_t compact_segs; /**< Max segs to compact at once. */ uint32_t avail_compact_segs; /**< The number of segments when compaction occurs when writing. */ - + uint32_t block_size; /**< The block size for this disk. */ rtems_fdisk_block_ctl* blocks; /**< The block to segment-page mappings. */ uint32_t block_count; /**< The number of avail. blocks. */ uint32_t unavail_blocks; /**< The number of unavail blocks. */ - + rtems_fdisk_device_ctl* devices; /**< The flash devices for this disk. */ uint32_t device_count; /**< The number of flash devices. */ @@ -303,7 +303,7 @@ static uint16_t* rtems_fdisk_crc16_factor; * @relval RTEMS_SUCCESSFUL The table was generated. * @retval RTEMS_NO_MEMORY The table could not be allocated from the heap. */ -rtems_status_code +rtems_status_code rtems_fdisk_crc16_gen_factors (uint16_t pattern) { uint32_t b; @@ -456,7 +456,7 @@ rtems_fdisk_segment_queue_push_head (rtems_fdisk_segment_ctl_queue* queue, { sc->next = queue->head; queue->head = sc; - + if (queue->tail == 0) queue->tail = sc; queue->count++; @@ -497,7 +497,7 @@ rtems_fdisk_segment_queue_push_tail (rtems_fdisk_segment_ctl_queue* queue, if (sc) { sc->next = 0; - + if (queue->head) { queue->tail->next = sc; @@ -761,7 +761,7 @@ rtems_fdisk_seg_next_available_page (rtems_fdisk_segment_ctl* sc) for (page = 0; page < sc->pages; page++, pd++) if (rtems_fdisk_page_desc_erased (pd)) break; - + return page; } @@ -840,7 +840,7 @@ rtems_fdisk_seg_read (const rtems_flashdisk* fd, rtems_fdisk_printf (fd, " seg-read: %02d-%03d: o=%08x s=%d", device, segment, offset, size); #endif - return ops->read (sd, device, segment, offset, buffer, size); + return ops->read (sd, device, segment, offset, buffer, size); } /** @@ -864,7 +864,7 @@ rtems_fdisk_seg_write (const rtems_flashdisk* fd, rtems_fdisk_printf (fd, " seg-write: %02d-%03d: o=%08x s=%d", device, segment, offset, size); #endif - return ops->write (sd, device, segment, offset, buffer, size); + return ops->write (sd, device, segment, offset, buffer, size); } /** @@ -885,7 +885,7 @@ rtems_fdisk_seg_blank_check (const rtems_flashdisk* fd, rtems_fdisk_printf (fd, " seg-blank: %02d-%03d: o=%08x s=%d", device, segment, offset, size); #endif - return ops->blank (sd, device, segment, offset, size); + return ops->blank (sd, device, segment, offset, size); } /** * Verify the data with the data in a segment. @@ -906,7 +906,7 @@ rtems_fdisk_seg_verify (const rtems_flashdisk* fd, rtems_fdisk_printf (fd, " seg-verify: %02d-%03d: o=%08x s=%d", device, segment, offset, size); #endif - return ops->verify (sd, device, segment, offset, buffer, size); + return ops->verify (sd, device, segment, offset, buffer, size); } /** @@ -1015,7 +1015,7 @@ rtems_fdisk_seg_write_page_desc (const rtems_flashdisk* fd, sizeof (rtems_fdisk_page_desc)); if (ret) return ret; - } + } return rtems_fdisk_seg_write (fd, device, segment, offset, page_desc, sizeof (rtems_fdisk_page_desc)); } @@ -1095,7 +1095,7 @@ rtems_fdisk_erase_flash (const rtems_flashdisk* fd) for (device = 0; device < fd->device_count; device++) { int ret; - + #if RTEMS_FDISK_TRACE rtems_fdisk_info (fd, " erase-flash:%02d", device); #endif @@ -1148,7 +1148,7 @@ rtems_fdisk_erase_segment (rtems_flashdisk* fd, rtems_fdisk_segment_ctl* sc) sc->pages_active = 0; sc->pages_used = 0; sc->pages_bad = 0; - + sc->failed = false; /* @@ -1212,7 +1212,7 @@ rtems_fdisk_queue_segment (rtems_flashdisk* fd, rtems_fdisk_segment_ctl* sc) rtems_fdisk_segment_queue_push_tail (&fd->failed, sc); return; } - + /* * Remove the queue from the available or used queue. */ @@ -1236,7 +1236,7 @@ rtems_fdisk_queue_segment (rtems_flashdisk* fd, rtems_fdisk_segment_ctl* sc) * a new segment and cover more than one segment. */ rtems_fdisk_segment_ctl* seg = fd->used.head; - + while (seg) { if (sc->pages_used > seg->pages_used) @@ -1324,7 +1324,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) #if RTEMS_FDISK_TRACE rtems_fdisk_printf (fd, " compacting"); #endif - + dsc = rtems_fdisk_seg_most_available (&fd->available); if (dsc == 0) @@ -1332,17 +1332,17 @@ rtems_fdisk_compact (rtems_flashdisk* fd) rtems_fdisk_error ("compacting: no available segments to compact too"); return EIO; } - + ssc = fd->used.head; dst_pages = rtems_fdisk_seg_pages_available (dsc); segments = 0; pages = 0; - + #if RTEMS_FDISK_TRACE rtems_fdisk_printf (fd, " dsc:%02d-%03d: most available", dsc->device, dsc->segment); #endif - + /* * Count the number of segments that have active pages that fit into * the destination segment. Also limit the number of segments that @@ -1350,7 +1350,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) * compaction or less delay when compacting but it may mean the disk * will fill. */ - + while (ssc && ((pages + ssc->pages_active) < dst_pages) && ((compacted_segs + segments) < fd->compact_segs)) @@ -1365,7 +1365,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) * compacting one segment to another is silly. Compaction needs * to free at least one more segment. */ - + if (!ssc || (pages == 0) || ((compacted_segs + segments) == 1)) break; @@ -1374,13 +1374,13 @@ rtems_fdisk_compact (rtems_flashdisk* fd) ssc->device, ssc->segment, pages, segments); #endif - + rtems_fdisk_segment_queue_remove (&fd->available, dsc); /* * We now copy the pages to the new segment. */ - + while (pages) { uint32_t spage; @@ -1404,9 +1404,9 @@ rtems_fdisk_compact (rtems_flashdisk* fd) dpage = rtems_fdisk_seg_next_available_page (dsc); dpd = &dsc->page_descriptors[dpage]; - + active++; - + if (dpage >= dsc->pages) { rtems_fdisk_error ("compacting: %02d-%03d: " \ @@ -1418,7 +1418,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) rtems_fdisk_segment_queue_push_head (&fd->used, ssc); return EIO; } - + #if RTEMS_FDISK_TRACE rtems_fdisk_info (fd, "compacting: %02d-%03d-%03d=>%02d-%03d-%03d", ssc->device, ssc->segment, spage, @@ -1469,10 +1469,10 @@ rtems_fdisk_compact (rtems_flashdisk* fd) * We do the stats to make sure everything is as it should * be. */ - + ssc->pages_active--; ssc->pages_used++; - + fd->blocks[spd->block].segment = dsc; fd->blocks[spd->block].page = dpage; @@ -1480,7 +1480,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) * Place the segment on to the correct queue. */ rtems_fdisk_queue_segment (fd, dsc); - + pages--; } else @@ -1497,7 +1497,7 @@ rtems_fdisk_compact (rtems_flashdisk* fd) rtems_fdisk_error ("compacting: ssc pages not 0: %d", ssc->pages_active); } - + ret = rtems_fdisk_erase_segment (fd, ssc); if (ret) @@ -1518,7 +1518,7 @@ static int rtems_fdisk_recover_block_mappings (rtems_flashdisk* fd) { uint32_t device; - + /* * Clear the queues. */ @@ -1545,7 +1545,7 @@ rtems_fdisk_recover_block_mappings (rtems_flashdisk* fd) rtems_fdisk_page_desc* pd; uint32_t page; int ret; - + #if RTEMS_FDISK_TRACE rtems_fdisk_info (fd, "recover-block-mappings:%02d-%03d", device, segment); #endif @@ -1559,13 +1559,13 @@ rtems_fdisk_recover_block_mappings (rtems_flashdisk* fd) sc->pages_bad = 0; sc->failed = false; - + if (!sc->page_descriptors) sc->page_descriptors = malloc (sc->pages_desc * fd->block_size); if (!sc->page_descriptors) rtems_fdisk_abort ("no memory for page descriptors"); - + pd = sc->page_descriptors; /* @@ -1615,14 +1615,14 @@ rtems_fdisk_recover_block_mappings (rtems_flashdisk* fd) ret = rtems_fdisk_seg_write_page_desc (fd, device, segment, page, pd); - + if (ret) { rtems_fdisk_error ("forcing page to used failed: %d-%d-%d", device, segment, page); sc->failed = true; } - + sc->pages_used++; } } @@ -1773,10 +1773,10 @@ rtems_fdisk_read_block (rtems_flashdisk* fd, } cs = rtems_fdisk_page_checksum (buffer, fd->block_size); - + if (cs == pd->crc) return 0; - + rtems_fdisk_error ("read-block: crc failure: %d: buffer:%04x page:%04x", block, cs, pd->crc); } @@ -1830,7 +1830,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, rtems_fdisk_page_desc* pd; uint32_t page; int ret; - + #if RTEMS_FDISK_TRACE rtems_fdisk_info (fd, "write-block:%d", block); #endif @@ -1872,7 +1872,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, #endif return 0; } - + /* * The page exists in flash so we need to set the used flag * in the page descriptor. The descriptor is in memory with the @@ -1881,7 +1881,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, */ rtems_fdisk_page_desc_set_flags (pd, RTEMS_FDISK_PAGE_USED); - + ret = rtems_fdisk_seg_write_page_desc_flags (fd, sc->device, sc->segment, bc->page, pd); @@ -1900,7 +1900,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, sc->pages_active--; sc->pages_used++; } - + /* * If possible reuse this segment. This will mean the segment * needs to be removed from the available list and placed @@ -1925,7 +1925,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, if (rtems_fdisk_segment_count_queue (&fd->available) <= fd->avail_compact_segs) rtems_fdisk_compact (fd); - + /* * Get the next avaliable segment. */ @@ -1947,7 +1947,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, * Try again for some free space. */ sc = rtems_fdisk_segment_queue_pop_head (&fd->available); - + if (!sc) { rtems_fdisk_error ("write-block: no available pages"); @@ -1964,7 +1964,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, block, sc->device, sc->segment, queues); } #endif - + /* * Find the next avaliable page in the segment. */ @@ -1980,7 +1980,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, bc->segment = sc; bc->page = page; - + rtems_fdisk_page_desc_set_flags (pd, RTEMS_FDISK_PAGE_ACTIVE); #if RTEMS_FDISK_TRACE @@ -2026,7 +2026,7 @@ rtems_fdisk_write_block (rtems_flashdisk* fd, sc->pages_active++; } } - + rtems_fdisk_queue_segment (fd, sc); return ret; } @@ -2073,7 +2073,7 @@ rtems_fdisk_read (rtems_flashdisk* fd, rtems_blkdev_request* req) req->req_done (req->done_arg, ret ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR, ret); - + return ret; } @@ -2109,7 +2109,7 @@ rtems_fdisk_write (rtems_flashdisk* fd, rtems_blkdev_request* req) req->req_done (req->done_arg, ret ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR, ret); - + return 0; } @@ -2183,11 +2183,11 @@ rtems_fdisk_monitoring_data (rtems_flashdisk* fd, for (i = 0; i < fd->device_count; i++) { data->segment_count += fd->devices[i].segment_count; - + for (j = 0; j < fd->devices[i].segment_count; j++) { rtems_fdisk_segment_ctl* sc = &fd->devices[i].segments[j]; - + data->page_count += sc->pages; data->pages_desc += sc->pages_desc; data->pages_active += sc->pages_active; @@ -2214,7 +2214,7 @@ rtems_fdisk_print_status (rtems_flashdisk* fd) uint32_t device; fd->info_level = 3; - + rtems_fdisk_printf (fd, "Flash Disk Driver Status : %d.%d", fd->major, fd->minor); @@ -2250,7 +2250,7 @@ rtems_fdisk_print_status (rtems_flashdisk* fd) { uint32_t block; uint32_t seg; - + rtems_fdisk_printf (fd, " Device\t\t%ld", device); rtems_fdisk_printf (fd, " Segment count\t%ld", fd->devices[device].segment_count); @@ -2293,7 +2293,7 @@ rtems_fdisk_print_status (rtems_flashdisk* fd) page, block); } } - + count = 0; for (block = 0; block < fd->block_count; block++) { @@ -2375,7 +2375,7 @@ rtems_fdisk_ioctl (rtems_disk_device *dd, uint32_t req, void* argp) case RTEMS_BLKDEV_REQ_WRITE: errno = rtems_fdisk_write (&rtems_flashdisks[minor], r); break; - + default: errno = EINVAL; break; @@ -2462,9 +2462,9 @@ rtems_fdisk_initialize (rtems_device_major_number major, int ret; fd = &rtems_flashdisks[minor]; - + name [sizeof(RTEMS_FLASHDISK_DEVICE_BASE_NAME)] += minor; - + fd->major = major; fd->minor = minor; fd->flags = c->flags; @@ -2473,11 +2473,11 @@ rtems_fdisk_initialize (rtems_device_major_number major, fd->block_size = c->block_size; fd->unavail_blocks = c->unavail_blocks; fd->info_level = c->info_level; - + for (device = 0; device < c->device_count; device++) blocks += rtems_fdisk_blocks_in_device (&c->devices[device], c->block_size); - + sc = rtems_disk_create_phys(dev, c->block_size, blocks - fd->unavail_blocks, rtems_fdisk_ioctl, NULL, name); @@ -2486,7 +2486,7 @@ rtems_fdisk_initialize (rtems_device_major_number major, rtems_fdisk_error ("disk create phy failed"); return sc; } - + sc = rtems_semaphore_create (rtems_build_name ('F', 'D', 'S', 'K'), 1, RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY, 0, &fd->lock); @@ -2502,7 +2502,7 @@ rtems_fdisk_initialize (rtems_device_major_number major, fd->copy_buffer = malloc (c->block_size); if (!fd->copy_buffer) return RTEMS_NO_MEMORY; - + fd->blocks = calloc (blocks, sizeof (rtems_fdisk_block_ctl)); if (!fd->blocks) return RTEMS_NO_MEMORY; @@ -2520,14 +2520,14 @@ rtems_fdisk_initialize (rtems_device_major_number major, uint32_t segment; segment_count = rtems_fdisk_count_segments (&c->devices[device]); - + fd->devices[device].segments = calloc (segment_count, sizeof (rtems_fdisk_segment_ctl)); if (!fd->devices[device].segments) return RTEMS_NO_MEMORY; sc = fd->devices[device].segments; - + for (segment = 0; segment < c->devices[device].segment_count; segment++) { const rtems_fdisk_segment_desc* sd; @@ -2543,11 +2543,11 @@ rtems_fdisk_initialize (rtems_device_major_number major, sc->erased = 0; } } - + fd->devices[device].segment_count = segment_count; fd->devices[device].descriptor = &c->devices[device]; } - + fd->device_count = c->device_count; ret = rtems_fdisk_recover_block_mappings (fd); diff --git a/cpukit/libblock/src/nvdisk-sram.c b/cpukit/libblock/src/nvdisk-sram.c index a0d4208462..1b8369a626 100644 --- a/cpukit/libblock/src/nvdisk-sram.c +++ b/cpukit/libblock/src/nvdisk-sram.c @@ -10,7 +10,7 @@ */ #if HAVE_CONFIG_H -#include "config.h" +#include "config.h" #endif #include <stdio.h> @@ -27,7 +27,7 @@ static int rtems_nvdisk_sram_read (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + uint32_t base, uint32_t offset, void* buffer, uint32_t size) @@ -39,7 +39,7 @@ rtems_nvdisk_sram_read (uint32_t device __attribute__((unused)), static int rtems_nvdisk_sram_write (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + uint32_t base, uint32_t offset, const void* buffer, uint32_t size) @@ -51,7 +51,7 @@ rtems_nvdisk_sram_write (uint32_t device __attribute__((unused)), static int rtems_nvdisk_sram_verify (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + uint32_t base, uint32_t offset, const void* buffer, uint32_t size) diff --git a/cpukit/libblock/src/nvdisk.c b/cpukit/libblock/src/nvdisk.c index f121078bb1..fabe53a5c9 100644 --- a/cpukit/libblock/src/nvdisk.c +++ b/cpukit/libblock/src/nvdisk.c @@ -63,7 +63,7 @@ typedef struct rtems_nvdisk_device_ctl * The device this segment resides on. */ uint32_t device; - + /** * Total number of pages in the device. */ @@ -134,7 +134,7 @@ static uint16_t* rtems_nvdisk_crc16_factor; * @relval RTEMS_SUCCESSFUL The table was generated. * @retval RTEMS_NO_MEMORY The table could not be allocated from the heap. */ -rtems_status_code +rtems_status_code rtems_nvdisk_crc16_gen_factors (uint16_t pattern) { uint32_t b; @@ -275,7 +275,7 @@ rtems_nvdisk_device_read (const rtems_nvdisk* nvd, rtems_nvdisk_printf (nvd, " dev-read: %02d-%08x: s=%d", device, offset, size); #endif - return ops->read (device, dd->flags, dd->base, offset, buffer, size); + return ops->read (device, dd->flags, dd->base, offset, buffer, size); } /** @@ -296,7 +296,7 @@ rtems_nvdisk_device_write (const rtems_nvdisk* nvd, rtems_nvdisk_printf (nvd, " dev-write: %02d-%08x: s=%d", device, offset, size); #endif - return ops->write (device, dd->flags, dd->base, offset, buffer, size); + return ops->write (device, dd->flags, dd->base, offset, buffer, size); } #if NOT_USED @@ -318,7 +318,7 @@ rtems_nvdisk_device_verify (const rtems_nvdisk* nvd, rtems_nvdisk_printf (nvd, " seg-verify: %02d-%08x: s=%d", device, offset, size); #endif - return ops->verify (device, dd->flags, dd->base, offset, buffer, size); + return ops->verify (device, dd->flags, dd->base, offset, buffer, size); } #endif @@ -427,7 +427,7 @@ static rtems_nvdisk_device_ctl* rtems_nvdisk_get_device (rtems_nvdisk* nvd, uint32_t block) { uint32_t device; - + if (block >= nvd->block_count) { rtems_nvdisk_error ("read-block: bad block: %d", block); @@ -456,7 +456,7 @@ rtems_nvdisk_get_page (rtems_nvdisk_device_ctl* dc, { return block - dc->block_base; } - + /** * Read a block. The block is checked to see if the page referenced * is valid and the page has a valid crc. @@ -475,14 +475,14 @@ rtems_nvdisk_read_block (rtems_nvdisk* nvd, uint32_t block, uint8_t* buffer) uint16_t crc; uint16_t cs; int ret; - + dc = rtems_nvdisk_get_device (nvd, block); if (!dc) return EIO; page = rtems_nvdisk_get_page (dc, block); - + #if RTEMS_NVDISK_TRACE rtems_nvdisk_info (nvd, " read-block:%d=>%02d-%03d, cs:%04x", block, dc->device, page, crc); @@ -501,16 +501,16 @@ rtems_nvdisk_read_block (rtems_nvdisk* nvd, uint32_t block, uint8_t* buffer) memset (buffer, 0, nvd->block_size); return 0; } - + ret = rtems_nvdisk_read_page (nvd, dc->device, page + dc->pages_desc, buffer); if (ret) return ret; cs = rtems_nvdisk_page_checksum (buffer, nvd->block_size); - + if (cs != crc) - { + { rtems_nvdisk_error ("read-block: crc failure: %d: buffer:%04x page:%04x", block, cs, crc); return EIO; @@ -539,14 +539,14 @@ rtems_nvdisk_write_block (rtems_nvdisk* nvd, uint32_t page; uint16_t cs; int ret; - + dc = rtems_nvdisk_get_device (nvd, block); if (!dc) return EIO; page = rtems_nvdisk_get_page (dc, block); - + cs = rtems_nvdisk_page_checksum (buffer, nvd->block_size); #if RTEMS_NVDISK_TRACE @@ -597,7 +597,7 @@ rtems_nvdisk_read (rtems_nvdisk* nvd, rtems_blkdev_request* req) req->req_done (req->done_arg, ret ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR, ret); - + return ret; } @@ -637,7 +637,7 @@ rtems_nvdisk_write (rtems_nvdisk* nvd, rtems_blkdev_request* req) req->req_done (req->done_arg, ret ? RTEMS_SUCCESSFUL : RTEMS_IO_ERROR, ret); - + return 0; } @@ -692,13 +692,13 @@ rtems_nvdisk_ioctl (rtems_disk_device *dd, uint32_t req, void* argp) errno = ENODEV; return -1; } - + if (rtems_nvdisks[minor].device_count == 0) { errno = ENODEV; return -1; } - + errno = 0; sc = rtems_semaphore_obtain (rtems_nvdisks[minor].lock, RTEMS_WAIT, 0); @@ -715,11 +715,11 @@ rtems_nvdisk_ioctl (rtems_disk_device *dd, uint32_t req, void* argp) case RTEMS_BLKDEV_REQ_READ: errno = rtems_nvdisk_read (&rtems_nvdisks[minor], r); break; - + case RTEMS_BLKDEV_REQ_WRITE: errno = rtems_nvdisk_write (&rtems_nvdisks[minor], r); break; - + default: errno = EINVAL; break; @@ -729,11 +729,11 @@ rtems_nvdisk_ioctl (rtems_disk_device *dd, uint32_t req, void* argp) case RTEMS_NVDISK_IOCTL_ERASE_DISK: errno = rtems_nvdisk_erase_disk (&rtems_nvdisks[minor]); break; - + case RTEMS_NVDISK_IOCTL_INFO_LEVEL: rtems_nvdisks[minor].info_level = (uint32_t) argp; break; - + default: rtems_blkdev_ioctl (dd, req, argp); break; @@ -787,9 +787,9 @@ rtems_nvdisk_initialize (rtems_device_major_number major, uint32_t blocks = 0; nvd = &rtems_nvdisks[minor]; - + name [sizeof(RTEMS_NVDISK_DEVICE_BASE_NAME)] += minor; - + nvd->major = major; nvd->minor = minor; nvd->flags = c->flags; @@ -808,7 +808,7 @@ rtems_nvdisk_initialize (rtems_device_major_number major, dc->pages = rtems_nvdisk_pages_in_device (nvd, &c->devices[device]); dc->pages_desc = rtems_nvdisk_page_desc_pages (nvd, &c->devices[device]); dc->block_base = blocks; - + blocks += dc->pages - dc->pages_desc; dc->descriptor = &c->devices[device]; @@ -824,7 +824,7 @@ rtems_nvdisk_initialize (rtems_device_major_number major, rtems_nvdisk_error ("disk create phy failed"); return sc; } - + sc = rtems_semaphore_create (rtems_build_name ('N', 'V', 'D', 'K'), 1, RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY, 0, &nvd->lock); diff --git a/cpukit/libblock/src/ramdisk-driver.c b/cpukit/libblock/src/ramdisk-driver.c index 80503c9f3c..282fdcf3d1 100644 --- a/cpukit/libblock/src/ramdisk-driver.c +++ b/cpukit/libblock/src/ramdisk-driver.c @@ -117,7 +117,7 @@ ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp) } break; } - + default: return rtems_blkdev_ioctl (dd, req, argp); break; diff --git a/cpukit/libblock/src/show_bdbuf.c b/cpukit/libblock/src/show_bdbuf.c index fd586f523f..fe8e4d23c9 100644 --- a/cpukit/libblock/src/show_bdbuf.c +++ b/cpukit/libblock/src/show_bdbuf.c @@ -83,7 +83,7 @@ typedef struct { int error; bool modified; bool in_progress; - bool actual; + bool actual; int use_count; const CORE_mutex_Control *sema; } show_bdbuf_bdbuf_info_t; @@ -128,24 +128,24 @@ rtems_status_code rtems_bdbuf_show_follow_chain_node_to_head */ if (rc == RTEMS_SUCCESSFUL) { DISABLE_PREEMPTION(preempt_key); - } + } /* * follow node to its head - * XXX: this is highly dependent on the chain implementation + * XXX: this is highly dependent on the chain implementation * in score/src/chain.c and friends */ while (the_node->previous != NULL) { the_node = the_node->previous; - } + } /* * reenable preemption, if disabled */ if (preempt_disabled) { ENABLE_PREEMPTION(preempt_key); - } + } /* - * XXX: this depends n the chain implementation in - * score/include/rtems/score/chain.h: + * XXX: this depends n the chain implementation in + * score/include/rtems/score/chain.h: * Chain_Control is overlayed by two Cohain_Nodes */ *the_head = (Chain_Control *)the_node; @@ -176,7 +176,7 @@ rtems_status_code rtems_bdbuf_show_determine_chain_of_bdbuf rtems_status_code rc = RTEMS_SUCCESSFUL; Chain_Control *the_chain_control; - + *chn_ident = bdbuf_chain_ident_none; if (rc == RTEMS_SUCCESSFUL) { rc = rtems_bdbuf_show_follow_chain_node_to_head(&(the_bdbuf->link), @@ -218,7 +218,7 @@ rtems_status_code rtems_bdbuf_show_getargs \*=========================================================================*/ { rtems_status_code sc = RTEMS_SUCCESSFUL; - int arg_error = 0; + int arg_error = 0; int i; char *tmp_ptr; int nm_argc = 0; @@ -231,7 +231,7 @@ rtems_status_code rtems_bdbuf_show_getargs selector->show_all = true; /* - * scan arguments + * scan arguments */ for (i = 1; (i < argc) && (arg_error == 0); @@ -320,7 +320,7 @@ rtems_status_code rtems_bdbuf_show_getargs if (arg_error) { printf("%s: unknown argument %s\n",argv[0],argv[arg_error]); sc = RTEMS_NOT_DEFINED; - } + } return sc; } @@ -414,7 +414,7 @@ rtems_status_code rtems_bdbuf_show_pool_header | rtems_status_code | \*=========================================================================*/ { - + rtems_status_code rc = RTEMS_SUCCESSFUL; if (rc == RTEMS_SUCCESSFUL) { @@ -452,11 +452,11 @@ rtems_status_code rtems_show_bdbuf_get_bdbuf_info | rtems_status_code | \*=========================================================================*/ { - + rtems_status_code rc = RTEMS_SUCCESSFUL; - /* - * determine the chain we are in + /* + * determine the chain we are in */ if (rc == RTEMS_SUCCESSFUL) { rc = rtems_bdbuf_show_determine_chain_of_bdbuf(the_bdbuf,curr_pool, @@ -476,7 +476,7 @@ rtems_status_code rtems_show_bdbuf_get_bdbuf_info bdbuf_info->modified = the_bdbuf->modified; bdbuf_info->in_progress = the_bdbuf->in_progress; bdbuf_info->actual = the_bdbuf->actual; - bdbuf_info->use_count = the_bdbuf->use_count; + bdbuf_info->use_count = the_bdbuf->use_count; bdbuf_info->sema = &(the_bdbuf->transfer_sema); bdbuf_info->pool_id = the_bdbuf->pool; } @@ -503,10 +503,10 @@ rtems_status_code rtems_show_bdbuf_match_filter | rtems_status_code | \*=========================================================================*/ { - + rtems_status_code rc = RTEMS_SUCCESSFUL; bool unmatch = false; - + if (rc == RTEMS_SUCCESSFUL) { if (filter->bdbuf_all) { unmatch = false; @@ -540,7 +540,7 @@ rtems_status_code rtems_show_bdbuf_print_wait_chain | Return Value: | | rtems_status_code | \*=========================================================================*/ -{ +{ rtems_status_code rc = RTEMS_SUCCESSFUL; Chain_Control *the_chain_head; const Chain_Node *the_chain_node; @@ -566,7 +566,7 @@ rtems_status_code rtems_show_bdbuf_print_wait_chain thread_id = the_thread->Object.id; thread_name = the_thread->Object.name; - thread_name_nonstring = (uint32_t)thread_name.name_u32; + thread_name_nonstring = (uint32_t)thread_name.name_u32; printf("%20s %3d (0x%08" PRIx32 ") %c%c%c%c\n", ((thread_cnt == 1) ? "Threads waiting:" : ""), thread_cnt,thread_id, @@ -577,7 +577,7 @@ rtems_status_code rtems_show_bdbuf_print_wait_chain the_chain_node = the_chain_node->next; } - + return rc; } @@ -601,7 +601,7 @@ rtems_status_code rtems_show_bdbuf_print | rtems_status_code | \*=========================================================================*/ { - + rtems_status_code rc = RTEMS_SUCCESSFUL; /* @@ -658,9 +658,9 @@ rtems_status_code rtems_show_bdbuf_print } else { printf("%3" PRIu32 "%2" PRIu32, - ((bdbuf_info->dev == -1) + ((bdbuf_info->dev == -1) ? 0 : rtems_filesystem_dev_major_t(bdbuf_info->dev)), - ((bdbuf_info->dev == -1) + ((bdbuf_info->dev == -1) ? 0 : rtems_filesystem_dev_minor_t(bdbuf_info->dev))); } } @@ -721,9 +721,9 @@ rtems_status_code rtems_show_bdbuf_print } else { printf("%20s:%-10s ", - ((bdbuf_info->status == RTEMS_SUCCESSFUL) + ((bdbuf_info->status == RTEMS_SUCCESSFUL) ? "SUCCESSFUL" : rtems_status_text(bdbuf_info->status)), - ((bdbuf_info->status == RTEMS_SUCCESSFUL) + ((bdbuf_info->status == RTEMS_SUCCESSFUL) ? "" : strerror(bdbuf_info->error))); } } @@ -788,8 +788,8 @@ void rtems_bdbuf_show_fnc */ for (pool_idx = 0; (rc == RTEMS_SUCCESSFUL) && (pool_idx < pool_cnt); - pool_idx++) { - if ((filter.pool_id < 0) || + pool_idx++) { + if ((filter.pool_id < 0) || (filter.pool_id == pool_idx)) { curr_pool = pool_base + pool_idx; /* @@ -812,9 +812,9 @@ void rtems_bdbuf_show_fnc * for all bdbufs in this pool */ for (bdbuf_idx = 0; - ((rc == RTEMS_SUCCESSFUL) && + ((rc == RTEMS_SUCCESSFUL) && (bdbuf_idx < curr_pool->nblks)); - bdbuf_idx++) { + bdbuf_idx++) { /* * get infos about bdbuf */ @@ -839,7 +839,7 @@ void rtems_bdbuf_show_fnc if (bdbuf_matches) { rc = rtems_show_bdbuf_print(&bdbuf_info,&selector, false); - if ((rc == RTEMS_SUCCESSFUL) && + if ((rc == RTEMS_SUCCESSFUL) && selector.show_sema) { rc = rtems_show_bdbuf_print_wait_chain(&(curr_pool->bdbufs[bdbuf_idx])); } @@ -848,7 +848,7 @@ void rtems_bdbuf_show_fnc else { un_matched_cnt++; } - } + } } /* * print match statistics and footer @@ -873,7 +873,7 @@ static rtems_monitor_command_entry_t rtems_show_bdbuf_cmds[] = { } }; -#ifndef ARRAY_CNT +#ifndef ARRAY_CNT #define ARRAY_CNT(arr) (sizeof((arr))/sizeof((arr)[0])) #endif diff --git a/cpukit/libcsupport/src/__assert.c b/cpukit/libcsupport/src/__assert.c index 3d4af56e53..0e90b604c6 100644 --- a/cpukit/libcsupport/src/__assert.c +++ b/cpukit/libcsupport/src/__assert.c @@ -1,4 +1,4 @@ -/* __assert - small RTEMS Specific Implementation +/* __assert - small RTEMS Specific Implementation * * COPYRIGHT (c) 2007. * On-Line Applications Research Corporation (OAR). @@ -19,7 +19,7 @@ #if defined(RTEMS_NEWLIB) && !defined(HAVE___ASSERT_FUNC) /* - * Newlib 1.16.0 added this method. Together these provide an + * Newlib 1.16.0 added this method. Together these provide an * RTEMS safe, low memory implementation. */ void __assert_func( diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c index c58e4cdcef..44a1a8a23d 100644 --- a/cpukit/libcsupport/src/__times.c +++ b/cpukit/libcsupport/src/__times.c @@ -56,8 +56,8 @@ clock_t _times( Timestamp_Control per_tick; uint32_t ticks; uint32_t fractional_ticks; - - _Timestamp_Set( + + _Timestamp_Set( &per_tick, rtems_configuration_get_microseconds_per_tick() / TOD_MICROSECONDS_PER_SECOND, diff --git a/cpukit/libcsupport/src/free.c b/cpukit/libcsupport/src/free.c index aa7638e759..c4725a5df7 100644 --- a/cpukit/libcsupport/src/free.c +++ b/cpukit/libcsupport/src/free.c @@ -36,7 +36,7 @@ void free( * Do not attempt to free memory if in a critical section or ISR. */ - if ( _System_state_Is_up(_System_state_Get()) && + if ( _System_state_Is_up(_System_state_Get()) && !malloc_is_system_state_OK() ) { malloc_deferred_free(ptr); return; diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c index d2fa1da238..6ae05e18a6 100644 --- a/cpukit/libcsupport/src/libio.c +++ b/cpukit/libcsupport/src/libio.c @@ -26,9 +26,9 @@ #include <assert.h> #include <errno.h> -/* define this to alias O_NDELAY to O_NONBLOCK, i.e., +/* define this to alias O_NDELAY to O_NONBLOCK, i.e., * O_NDELAY is accepted on input but fcntl(F_GETFL) returns - * O_NONBLOCK. This is because rtems has no distinction + * O_NONBLOCK. This is because rtems has no distinction * between the two (but some systems have). * Note that accepting this alias creates a problem: * an application trying to clear the non-blocking flag @@ -165,7 +165,7 @@ rtems_libio_t *rtems_libio_allocate( void ) goto failed; iop = rtems_libio_iop_freelist; next = iop->data1; - (void) memset( iop, 0, sizeof(rtems_libio_t) ); + (void) memset( iop, 0, sizeof(rtems_libio_t) ); iop->flags = LIBIO_FLAGS_OPEN; iop->sem = sema; rtems_libio_iop_freelist = next; diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c index 8338e06fb3..ba5c8c0dcf 100644 --- a/cpukit/libcsupport/src/malloc.c +++ b/cpukit/libcsupport/src/malloc.c @@ -73,7 +73,7 @@ void *malloc( return_this = _Protected_heap_Allocate( RTEMS_Malloc_Heap, size ); if ( !return_this ) { - if (rtems_malloc_sbrk_helpers) + if (rtems_malloc_sbrk_helpers) return_this = (*rtems_malloc_sbrk_helpers->extend)( size ); if ( !return_this ) { errno = ENOMEM; diff --git a/cpukit/libcsupport/src/malloc_get_statistics.c b/cpukit/libcsupport/src/malloc_get_statistics.c index b0531d6244..c13a1555e8 100644 --- a/cpukit/libcsupport/src/malloc_get_statistics.c +++ b/cpukit/libcsupport/src/malloc_get_statistics.c @@ -20,7 +20,7 @@ int malloc_get_statistics( rtems_malloc_statistics_t *stats -) +) { if ( !stats ) return -1; diff --git a/cpukit/libcsupport/src/malloc_initialize.c b/cpukit/libcsupport/src/malloc_initialize.c index 913daf1a27..cec40f0df1 100644 --- a/cpukit/libcsupport/src/malloc_initialize.c +++ b/cpukit/libcsupport/src/malloc_initialize.c @@ -83,7 +83,7 @@ void RTEMS_Malloc_Initialize( * be very very careful about destroying the initialization * that has already been done. */ - + /* * If the BSP is not clearing out the workspace, then it is most likely * not clearing out the initial memory for the heap. There is no @@ -109,7 +109,7 @@ void RTEMS_Malloc_Initialize( */ if ( !rtems_unified_work_area ) { - uintptr_t status = _Protected_heap_Initialize( + uintptr_t status = _Protected_heap_Initialize( RTEMS_Malloc_Heap, heap_begin, heap_size, diff --git a/cpukit/libcsupport/src/newlibc_exit.c b/cpukit/libcsupport/src/newlibc_exit.c index 2669fc7f48..818ba884f4 100644 --- a/cpukit/libcsupport/src/newlibc_exit.c +++ b/cpukit/libcsupport/src/newlibc_exit.c @@ -131,14 +131,14 @@ void libc_wrapup(void) #else #define FINI_SYMBOL _fini #endif - + extern void FINI_SYMBOL( void ); #endif void EXIT_SYMBOL(int status) { /* - * If the toolset uses init/fini sections, then we need to + * If the toolset uses init/fini sections, then we need to * run the global destructors now. */ #if defined(__USE_INIT_FINI__) diff --git a/cpukit/libcsupport/src/newlibc_init.c b/cpukit/libcsupport/src/newlibc_init.c index dbf9544fd5..4d2cef5405 100644 --- a/cpukit/libcsupport/src/newlibc_init.c +++ b/cpukit/libcsupport/src/newlibc_init.c @@ -21,7 +21,7 @@ /* * Init libc for CYGNUS newlib - * + * * Set up _REENT to use our global libc_global_reent. * (newlib provides a global of its own, but we prefer our own name for it) * diff --git a/cpukit/libcsupport/src/open_dev_console.c b/cpukit/libcsupport/src/open_dev_console.c index 3247bf3d36..ce01a9276e 100644 --- a/cpukit/libcsupport/src/open_dev_console.c +++ b/cpukit/libcsupport/src/open_dev_console.c @@ -36,7 +36,7 @@ void open_dev_console(void) * There may not be a console driver so this is OK. */ return; - } + } /* * But if we find /dev/console once, we better find it twice more diff --git a/cpukit/libcsupport/src/printk_plugin.c b/cpukit/libcsupport/src/printk_plugin.c index ebb677a1b6..60d93a96af 100644 --- a/cpukit/libcsupport/src/printk_plugin.c +++ b/cpukit/libcsupport/src/printk_plugin.c @@ -16,7 +16,7 @@ #include <stdarg.h> #include <rtems/bspIo.h> -int printk_plugin( +int printk_plugin( void *ignored __attribute__((unused)), const char *format, ... @@ -29,6 +29,6 @@ int printk_plugin( vprintk( format, arg_pointer ); va_end(arg_pointer); /* clean up when done */ - + return 0; } diff --git a/cpukit/libcsupport/src/putk.c b/cpukit/libcsupport/src/putk.c index 78d9f2abaf..71ccc9931e 100644 --- a/cpukit/libcsupport/src/putk.c +++ b/cpukit/libcsupport/src/putk.c @@ -20,7 +20,7 @@ * * Kernel putk (e.g. puts) function requiring minimal infrastrure. */ -void putk(const char *s) +void putk(const char *s) { const char *p = s; diff --git a/cpukit/libcsupport/src/readv.c b/cpukit/libcsupport/src/readv.c index 7b77c11fe2..85498b4cbc 100644 --- a/cpukit/libcsupport/src/readv.c +++ b/cpukit/libcsupport/src/readv.c @@ -59,7 +59,7 @@ ssize_t readv( /* * OpenGroup says that you are supposed to return EINVAL if the - * sum of the iov_len values in the iov array would overflow a + * sum of the iov_len values in the iov array would overflow a * ssize_t. * * Also we would like to ensure that no IO is performed if there @@ -95,7 +95,7 @@ ssize_t readv( if ( all_zeros == true ) { return 0; } - + /* * Now process the readv(). */ diff --git a/cpukit/libcsupport/src/rmdir.c b/cpukit/libcsupport/src/rmdir.c index ca0129fd3b..b66837e115 100644 --- a/cpukit/libcsupport/src/rmdir.c +++ b/cpukit/libcsupport/src/rmdir.c @@ -34,7 +34,7 @@ int rmdir( rtems_filesystem_location_info_t loc; int i; int result; - + /* * Get the parent node of the node we wish to remove. Find the parent path. */ @@ -55,11 +55,11 @@ int rmdir( /* * Start from the parent to find the node that should be under it. */ - + loc = parentloc; name = pathname + parentpathlen; name += rtems_filesystem_prefix_separators( name, strlen( name ) ); - + result = rtems_filesystem_evaluate_relative_path( name , strlen( name ), 0, &loc, false ); if ( result != 0 ) { diff --git a/cpukit/libcsupport/src/rtems_memalign.c b/cpukit/libcsupport/src/rtems_memalign.c index 563f23cd4c..467f270b75 100644 --- a/cpukit/libcsupport/src/rtems_memalign.c +++ b/cpukit/libcsupport/src/rtems_memalign.c @@ -40,7 +40,7 @@ int rtems_memalign( /* * Do not attempt to allocate memory if not in correct system state. */ - if ( _System_state_Is_up(_System_state_Get()) && + if ( _System_state_Is_up(_System_state_Get()) && !malloc_is_system_state_OK() ) return EINVAL; @@ -85,7 +85,7 @@ int rtems_memalign( (*rtems_malloc_boundary_helpers->at_malloc)(return_this, size); #endif - *pointer = return_this; + *pointer = return_this; return 0; } #endif diff --git a/cpukit/libcsupport/src/scandir.c b/cpukit/libcsupport/src/scandir.c index a111dea5c4..59ad02a280 100644 --- a/cpukit/libcsupport/src/scandir.c +++ b/cpukit/libcsupport/src/scandir.c @@ -134,7 +134,7 @@ scandir( } closedir(dirp); if (nitems && dcomp != NULL){ - qsort(names, nitems, sizeof(struct dirent *), + qsort(names, nitems, sizeof(struct dirent *), (int (*)(const void *, const void *)) dcomp); } *namelist = names; diff --git a/cpukit/libcsupport/src/statvfs.c b/cpukit/libcsupport/src/statvfs.c index bd6827fe76..7815118d6f 100644 --- a/cpukit/libcsupport/src/statvfs.c +++ b/cpukit/libcsupport/src/statvfs.c @@ -51,9 +51,9 @@ statvfs (const char *path, struct statvfs *sb) rtems_set_errno_and_return_minus_one( ENOTSUP ); memset (sb, 0, sizeof (struct statvfs)); - + result = ( fs_mount_root->ops->statvfs_h )( fs_mount_root, sb ); - + rtems_filesystem_freenode( &loc ); return result; diff --git a/cpukit/libcsupport/src/tcflow.c b/cpukit/libcsupport/src/tcflow.c index cfce0fd8e1..b329224b45 100644 --- a/cpukit/libcsupport/src/tcflow.c +++ b/cpukit/libcsupport/src/tcflow.c @@ -20,7 +20,7 @@ #include <unistd.h> int tcflow ( - int fd __attribute__((unused)), + int fd __attribute__((unused)), int action __attribute__((unused))) { return 0; diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index 6898f4493d..373ba4dc53 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -1021,7 +1021,7 @@ fillBufferQueue (struct rtems_termios_tty *tty) /* * Process characters read from raw queue */ - while ((tty->rawInBuf.Head != tty->rawInBuf.Tail) && + while ((tty->rawInBuf.Head != tty->rawInBuf.Tail) && (tty->ccount < (CBUFSIZE-1))) { unsigned char c; unsigned int newHead; diff --git a/cpukit/libcsupport/src/termios_setinitialbaud.c b/cpukit/libcsupport/src/termios_setinitialbaud.c index ae54dbb6ab..0eb273f355 100644 --- a/cpukit/libcsupport/src/termios_setinitialbaud.c +++ b/cpukit/libcsupport/src/termios_setinitialbaud.c @@ -24,6 +24,6 @@ int rtems_termios_set_initial_baud( return -1; ttyp->termios.c_cflag = (ttyp->termios.c_cflag & ~CBAUD) | cflags_baud; - + return 0; } diff --git a/cpukit/libcsupport/src/unlink.c b/cpukit/libcsupport/src/unlink.c index 29096d3e6f..359e64b4bc 100644 --- a/cpukit/libcsupport/src/unlink.c +++ b/cpukit/libcsupport/src/unlink.c @@ -34,9 +34,9 @@ int unlink( /* * Get the node to be unlinked. Find the parent path first. */ - + parentpathlen = rtems_filesystem_dirname ( path ); - + if ( parentpathlen == 0 ) rtems_filesystem_get_start_loc( path, &i, &parentloc ); else { @@ -47,22 +47,22 @@ int unlink( if ( result != 0 ) return -1; } - + /* * Start from the parent to find the node that should be under it. */ - + loc = parentloc; name = path + parentpathlen; name += rtems_filesystem_prefix_separators( name, strlen( name ) ); - + result = rtems_filesystem_evaluate_relative_path( name , strlen( name ), 0, &loc, false ); if ( result != 0 ) { rtems_filesystem_freenode( &parentloc ); return -1; } - + if ( !loc.ops->node_type_h ) { rtems_filesystem_freenode( &loc ); rtems_filesystem_freenode( &parentloc ); diff --git a/cpukit/libcsupport/src/writev.c b/cpukit/libcsupport/src/writev.c index 88d495da56..a453209d87 100644 --- a/cpukit/libcsupport/src/writev.c +++ b/cpukit/libcsupport/src/writev.c @@ -60,7 +60,7 @@ ssize_t writev( /* * OpenGroup says that you are supposed to return EINVAL if the - * sum of the iov_len values in the iov array would overflow a + * sum of the iov_len values in the iov array would overflow a * ssize_t. * * Also we would like to ensure that no IO is performed if there @@ -84,7 +84,7 @@ ssize_t writev( if ( iov[v].iov_len ) all_zeros = false; - + /* check for wrap */ old = total; total += iov[v].iov_len; @@ -98,7 +98,7 @@ ssize_t writev( if ( all_zeros == true ) { return 0; } - + /* * Now process the writev(). */ |