static int cmd_blockdev_exec(struct vmm_chardev *cdev, int argc, char **argv) { struct vmm_blockdev *bdev = NULL; if (argc == 2) { if (strcmp(argv[1], "help") == 0) { cmd_blockdev_usage(cdev); return VMM_OK; } else if (strcmp(argv[1], "list") == 0) { cmd_blockdev_list(cdev); return VMM_OK; } } else if (argc >= 3) { bdev = vmm_blockdev_find(argv[2]); if (!bdev) { vmm_cprintf(cdev, "Error: cannot find blockdev %s\n", argv[2]); return VMM_EINVALID; } if (strcmp(argv[1], "info") == 0) { return cmd_blockdev_info(cdev, bdev); } else if (strcmp(argv[1], "dump8") == 0) { return cmd_blockdev_dump8(cdev, bdev, argc - 3, argv + 3); } } cmd_blockdev_usage(cdev); return VMM_EFAIL; }
int cmd_blockdev_exec(struct vmm_chardev *cdev, int argc, char **argv) { if (argc == 2) { if (vmm_strcmp(argv[1], "help") == 0) { cmd_blockdev_usage(cdev); return VMM_OK; } else if (vmm_strcmp(argv[1], "list") == 0) { cmd_blockdev_list(cdev); return VMM_OK; } } if (argc < 3) { cmd_blockdev_usage(cdev); return VMM_EFAIL; } return VMM_OK; }
int cmd_blockdev_exec(struct vmm_chardev *cdev, int argc, char **argv) { if (argc == 2) { if (strcmp(argv[1], "help") == 0) { cmd_blockdev_usage(cdev); return VMM_OK; } else if (strcmp(argv[1], "list") == 0) { cmd_blockdev_list(cdev); return VMM_OK; } } else if (argc == 3) { if (strcmp(argv[1], "info") == 0) { return cmd_blockdev_info(cdev, argv[2]); } } cmd_blockdev_usage(cdev); return VMM_EFAIL; }