diff --git a/examples/blob/cli/blobcli.c b/examples/blob/cli/blobcli.c index 695115c69..047b442e5 100644 --- a/examples/blob/cli/blobcli.c +++ b/examples/blob/cli/blobcli.c @@ -405,7 +405,7 @@ show_bs_cb(void *arg1, spdk_blob_id blobid, int bserrno) printf("\nBlobstore Private Info:\n"); printf("\tMetadata start (pages): %" PRIu64 "\n", cli_context->bs->md_start); - printf("\tMetadata length (pages): %d \n", + printf("\tMetadata length (pages): %d\n", cli_context->bs->md_len); unload_bs(cli_context, "", 0); diff --git a/examples/ioat/verify/verify.c b/examples/ioat/verify/verify.c index 4089bc800..66c9b8c77 100644 --- a/examples/ioat/verify/verify.c +++ b/examples/ioat/verify/verify.c @@ -426,7 +426,7 @@ dump_result(struct thread_entry *threads, uint32_t num_threads) total_failed += t->xfer_failed; total_failed += t->fill_failed; if (t->xfer_completed || t->xfer_failed) - printf("lcore = %d, copy success = %ld, copy failed = %ld, fill success = %ld, fill failed = %ld \n", + printf("lcore = %d, copy success = %ld, copy failed = %ld, fill success = %ld, fill failed = %ld\n", t->lcore_id, t->xfer_completed, t->xfer_failed, t->fill_completed, t->fill_failed); } return total_failed ? 1 : 0; diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 5fa7b6f7f..8368a94ee 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -954,7 +954,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport printf("Wear Leveling Count:\n"); printf(" Normalized Value : %d\n", intel_smart_page.attributes[i].normalized_value); - printf(" Current Raw Value: \n"); + printf(" Current Raw Value:\n"); printf(" Min: "); print_uint_var_dec(&intel_smart_page.attributes[i].raw_value[0], 2); printf("\n"); @@ -1010,7 +1010,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport printf("Thermal Throttle Status:\n"); printf(" Normalized Value : %d\n", intel_smart_page.attributes[i].normalized_value); - printf(" Current Raw Value: \n"); + printf(" Current Raw Value:\n"); printf(" Percentage: %d%%\n", intel_smart_page.attributes[i].raw_value[0]); printf(" Throttling Event Count: "); print_uint_var_dec(&intel_smart_page.attributes[i].raw_value[1], 4); diff --git a/examples/nvme/nvme_manage/nvme_manage.c b/examples/nvme/nvme_manage/nvme_manage.c index 8a023d7aa..5add47e46 100644 --- a/examples/nvme/nvme_manage/nvme_manage.c +++ b/examples/nvme/nvme_manage/nvme_manage.c @@ -315,7 +315,7 @@ get_controller(void) display_controller(iter, CONTROLLER_DISPLAY_SIMPLISTIC); } - printf("Please Input PCI Address(domain:bus:dev.func): \n"); + printf("Please Input PCI Address(domain:bus:dev.func):\n"); while ((ch = getchar()) != '\n' && ch != EOF); p = get_line(address, 64, stdin); @@ -409,7 +409,7 @@ get_allocated_nsid(struct dev *dev) spdk_dma_free(ns_list); - printf("Please Input Namespace ID: \n"); + printf("Please Input Namespace ID:\n"); if (!scanf("%u", &nsid)) { printf("Invalid Namespace ID\n"); nsid = 0; @@ -567,21 +567,21 @@ add_ns(void) return; } - printf("Please Input Namespace Size (in LBAs): \n"); + printf("Please Input Namespace Size (in LBAs):\n"); if (!scanf("%" SCNi64, &ns_size)) { printf("Invalid Namespace Size\n"); while (getchar() != '\n'); return; } - printf("Please Input Namespace Capacity (in LBAs): \n"); + printf("Please Input Namespace Capacity (in LBAs):\n"); if (!scanf("%" SCNi64, &ns_capacity)) { printf("Invalid Namespace Capacity\n"); while (getchar() != '\n'); return; } - printf("Please Input Data Protection Type (0 - 3): \n"); + printf("Please Input Data Protection Type (0 - 3):\n"); if (!scanf("%d", &ns_dps_type)) { printf("Invalid Data Protection Type\n"); while (getchar() != '\n'); @@ -589,7 +589,7 @@ add_ns(void) } if (SPDK_NVME_FMT_NVM_PROTECTION_DISABLE != ns_dps_type) { - printf("Please Input Data Protection Location (1: Head; 0: Tail): \n"); + printf("Please Input Data Protection Location (1: Head; 0: Tail):\n"); if (!scanf("%d", &ns_dps_location)) { printf("Invalid Data Protection Location\n"); while (getchar() != '\n'); @@ -597,7 +597,7 @@ add_ns(void) } } - printf("Please Input Multi-path IO and Sharing Capabilities (1: Share; 0: Private): \n"); + printf("Please Input Multi-path IO and Sharing Capabilities (1: Share; 0: Private):\n"); if (!scanf("%d", &ns_nmic)) { printf("Invalid Multi-path IO and Sharing Capabilities\n"); while (getchar() != '\n'); @@ -625,7 +625,7 @@ delete_ns(void) return; } - printf("Please Input Namespace ID: \n"); + printf("Please Input Namespace ID:\n"); if (!scanf("%d", &ns_id)) { printf("Invalid Namespace ID\n"); while (getchar() != '\n'); @@ -667,7 +667,7 @@ format_nvm(void) ns_id = SPDK_NVME_GLOBAL_NS_TAG; ns = spdk_nvme_ctrlr_get_ns(ctrlr->ctrlr, 1); } else { - printf("Please Input Namespace ID (1 - %d): \n", cdata->nn); + printf("Please Input Namespace ID (1 - %d):\n", cdata->nn); if (!scanf("%d", &ns_id)) { printf("Invalid Namespace ID\n"); while (getchar() != '\n'); @@ -684,7 +684,7 @@ format_nvm(void) nsdata = spdk_nvme_ns_get_data(ns); - printf("Please Input Secure Erase Setting: \n"); + printf("Please Input Secure Erase Setting:\n"); printf(" 0: No secure erase operation requested\n"); printf(" 1: User data erase\n"); if (cdata->fna.crypto_erase_supported) { @@ -703,7 +703,7 @@ format_nvm(void) } if (nsdata->lbaf[lbaf].ms) { - printf("Please Input Protection Information: \n"); + printf("Please Input Protection Information:\n"); printf(" 0: Protection information is not enabled\n"); printf(" 1: Protection information is enabled, Type 1\n"); printf(" 2: Protection information is enabled, Type 2\n"); @@ -715,7 +715,7 @@ format_nvm(void) } if (pi) { - printf("Please Input Protection Information Location: \n"); + printf("Please Input Protection Information Location:\n"); printf(" 0: Protection information transferred as the last eight bytes of metadata\n"); printf(" 1: Protection information transferred as the first eight bytes of metadata\n"); if (!scanf("%d", &pil)) { @@ -727,7 +727,7 @@ format_nvm(void) pil = 0; } - printf("Please Input Metadata Setting: \n"); + printf("Please Input Metadata Setting:\n"); printf(" 0: Metadata is transferred as part of a separate buffer\n"); printf(" 1: Metadata is transferred as part of an extended data LBA\n"); if (!scanf("%d", &ms)) { @@ -832,7 +832,7 @@ update_firmware_image(void) } close(fd); - printf("Please Input Slot(0 - 7): \n"); + printf("Please Input Slot(0 - 7):\n"); if (!scanf("%d", &slot)) { printf("Invalid Slot\n"); spdk_dma_free(fw_image); diff --git a/lib/bdev/malloc/bdev_malloc.c b/lib/bdev/malloc/bdev_malloc.c index a460dc5ae..915d282fe 100644 --- a/lib/bdev/malloc/bdev_malloc.c +++ b/lib/bdev/malloc/bdev_malloc.c @@ -469,7 +469,7 @@ bdev_malloc_get_spdk_running_config(FILE *fp) "\n" "# Users may change this section to create a different number or size of\n" "# malloc LUNs.\n" - "# This will generate %d LUNs with a malloc-allocated backend. Each LUN \n" + "# This will generate %d LUNs with a malloc-allocated backend. Each LUN\n" "# will be %" PRIu64 "MB in size and these will be named Malloc0 through Malloc%d.\n" "# Not all LUNs defined here are necessarily used below.\n" "[Malloc]\n" diff --git a/lib/bdev/virtio/bdev_virtio_scsi.c b/lib/bdev/virtio/bdev_virtio_scsi.c index ee771c6ab..51bb7b36d 100644 --- a/lib/bdev/virtio/bdev_virtio_scsi.c +++ b/lib/bdev/virtio/bdev_virtio_scsi.c @@ -258,7 +258,7 @@ virtio_scsi_dev_init(struct virtio_scsi_dev *svdev, uint16_t max_queues) svdev->eventq_ios = spdk_dma_zmalloc(sizeof(*svdev->eventq_ios) * num_events, 0, NULL); if (svdev->eventq_ios == NULL) { - SPDK_ERRLOG("cannot allocate memory for %"PRIu16" eventq buffers \n", + SPDK_ERRLOG("cannot allocate memory for %"PRIu16" eventq buffers\n", num_events); virtio_dev_release_queue(vdev, VIRTIO_SCSI_EVENTQ); virtio_dev_release_queue(vdev, VIRTIO_SCSI_CONTROLQ); diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index a7b9ca368..26544f55b 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -805,7 +805,7 @@ spdk_vhost_scsi_dev_add_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_num, } if (bdev_name == NULL) { - SPDK_ERRLOG("No lun name specified \n"); + SPDK_ERRLOG("No lun name specified\n"); return -EINVAL; } diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 1cae9c5f9..60eae94c2 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -51,6 +51,19 @@ else fi rm -f comment.log +echo -n "Checking trailing whitespace in output strings..." + +git grep --line-number -e ' \\n"' -- '*.[ch]' > whitespace.log || true + +if [ -s whitespace.log ]; then + echo " Incorrect trailing whitespace detected" + cat whitespace.log + rc=1 +else + echo " OK" +fi +rm -f whitespace.log + echo -n "Checking for use of forbidden library functions..." git grep -w strcpy -- app examples lib test > badfunc.log || true diff --git a/test/vhost/common/common.sh b/test/vhost/common/common.sh index 5c4054dfa..168deccfc 100644 --- a/test/vhost/common/common.sh +++ b/test/vhost/common/common.sh @@ -591,7 +591,7 @@ function vm_setup() [[ ! -e $raw_disk ]]; then if [[ $raw_disk =~ /dev/.* ]]; then error \ - "ERROR: Virtio disk point to missing device ($raw_disk) - \n" \ + "ERROR: Virtio disk point to missing device ($raw_disk) -\n" \ " this is probably not what you want." return 1 fi