public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v6 1/2] Loop block device for sandbox
Date: Fri, 28 Sep 2012 20:22:14 +0200	[thread overview]
Message-ID: <201209282022.14935.marex@denx.de> (raw)
In-Reply-To: <1348824089-17324-1-git-send-email-morpheus.ibis@gmail.com>

Dear Pavel Herrmann,

> This driver uses files as block devices, can be used for testing disk
> operations on sandbox.
> A new command "sata_loop" is introduced to load files in runtime.

The description might use a little bit of caressing here :)

[...]

> +	if (os_lseek(fd, start_byte, OS_SEEK_SET) != start_byte)
> +		return -1;

Use errno consistently ... so -EINVAL ? Or something else?

> +	retval = os_read(fd, buffer, length_byte);
> +
> +	return retval / ATA_SECT_SIZE;
> +}

[...]
> +		if (!strncmp(argv[1], "load", 4)) {

if (strncmp())
 return CMD_USAGE;

one indent less here ;-)

> +			dev = simple_strtoul(argv[2], NULL, 10);
> +			/*
> +			 * init_sata() and scan_sata() do their own range
> +			 * check, however we need to explicitly do it here
> +			 * as well.
> +			 */
> +			if (range_check(dev)) {
> +				printf("File index %d is out of range.\n", dev);
> +				return -EINVAL;
> +			}
> +			free(filenames[dev]);
> +			filenames[dev] = strdup(argv[3]);
> +			init_sata(dev);
> +			scan_sata(dev);
> +			/*
> +			 * Scan the partition table if we succeeded in loading
> +			 * the new loop file.
> +			 */
> +			if (sata_dev_desc[dev].lba > 0)
> +				init_part(&sata_dev_desc[dev]);
> +
> +			return 0;
> +		}
> +		return CMD_RET_USAGE;
> +	}
> +	return CMD_RET_USAGE;
> +}
> +
> +U_BOOT_CMD(
> +	sata_loop, 4, 1, do_loop,
> +	"SATA loopback",
> +	"info - show info about all loop devices\n"
> +	"sata_loop info devnum - show info about loop devnum\n"
> +	"sata_loop load devnum file - load file from host FS into loop devnum"
> +);

      reply	other threads:[~2012-09-28 18:22 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-29 15:46 [U-Boot] [PATCH] Loop block device for sandbox Pavel Herrmann
2012-08-29 15:48 ` Pavel Herrmann
2012-08-29 22:18 ` Marek Vasut
2012-08-30 17:14   ` Pavel Herrmann
2012-08-30 18:45     ` Marek Vasut
2012-08-30 19:07       ` Pavel Herrmann
2012-08-30 21:53         ` Marek Vasut
2012-08-31  9:09           ` Pavel Herrmann
2012-08-31 12:57             ` Marek Vasut
2012-08-31 14:25               ` Pavel Herrmann
2012-08-31 16:02                 ` Marek Vasut
2012-08-31 17:56                   ` Pavel Herrmann
2012-08-31 19:02                     ` Marek Vasut
2012-09-01 13:19 ` [U-Boot] [PATCH v2 1/2] " Pavel Herrmann
2012-09-01 13:19   ` [U-Boot] [PATCH 2/2] Use loop block device in sandbox board Pavel Herrmann
2012-09-01 14:20     ` Marek Vasut
2012-09-03 17:24       ` Pavel Herrmann
2012-09-03 17:23     ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-09-03 16:49   ` [U-Boot] [PATCH v2 1/2] Loop block device for sandbox Marek Vasut
2012-09-03 17:31     ` Pavel Herrmann
2012-09-03 20:20       ` Marek Vasut
2012-09-05 11:16   ` [U-Boot] [PATCH v3 " Pavel Herrmann
2012-09-05 11:16     ` [U-Boot] [PATCH v3 2/2] Use loop block device in sandbox board Pavel Herrmann
2012-09-05 11:33     ` [U-Boot] [PATCH v3 1/2] Loop block device for sandbox Marek Vasut
2012-09-05 12:38       ` Pavel Herrmann
2012-09-05 12:48         ` Marek Vasut
2012-09-05 20:25           ` Pavel Herrmann
2012-09-06  1:08             ` Marek Vasut
2012-09-06  8:45               ` Pavel Herrmann
2012-09-06  8:48                 ` Marek Vasut
2012-09-05 12:42       ` Pavel Herrmann
2012-09-05 12:52         ` Marek Vasut
2012-09-06 12:31     ` [U-Boot] [PATCH v4 " Pavel Herrmann
2012-09-06 23:29       ` Marek Vasut
2012-09-07  9:19         ` Pavel Herrmann
2012-09-07  9:26           ` Marek Vasut
2012-09-07  9:38             ` Pavel Herrmann
2012-09-07  9:42               ` Marek Vasut
2012-09-13 22:31           ` Tom Rini
2012-09-16 11:49             ` Pavel Herrmann
2012-09-16 11:58       ` [U-Boot] [PATCH v5 " Pavel Herrmann
2012-09-28  9:21         ` [U-Boot] [PATCH v6 " Pavel Herrmann
2012-09-28 18:22           ` Marek Vasut [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201209282022.14935.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox