lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Sep 2011 10:20:28 -0700 (PDT)
From:	Andrei Warkentin <awarkentin@...are.com>
To:	Namjae Jeon <linkinjeon@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	adrian hunter <adrian.hunter@...el.com>,
	linus walleij <linus.walleij@...aro.org>,
	james p freyensee <james_p_freyensee@...ux.intel.com>,
	sebras@...il.com, Ulf Hansson <Ulf.Hansson@...ricsson.com>,
	stefan xk nilsson <stefan.xk.nilsson@...ricsson.com>,
	per forlin <per.forlin@...ricsson.com>,
	johan rudholm <johan.rudholm@...ricsson.com>, cjb@...top.org,
	linux-mmc@...r.kernel.org
Subject: Re: [PATCH v3] mmc : general purpose partition support.

Namjae,

----- Original Message -----
> From: "Namjae Jeon" <linkinjeon@...il.com>
> To: cjb@...top.org, linux-mmc@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org, awarkentin@...are.com, "adrian hunter" <adrian.hunter@...el.com>, "linus walleij"
> <linus.walleij@...aro.org>, "james p freyensee" <james_p_freyensee@...ux.intel.com>, sebras@...il.com, "Ulf Hansson"
> <Ulf.Hansson@...ricsson.com>, "stefan xk nilsson" <stefan.xk.nilsson@...ricsson.com>, "per forlin"
> <per.forlin@...ricsson.com>, "johan rudholm" <johan.rudholm@...ricsson.com>, "Namjae Jeon" <linkinjeon@...il.com>
> Sent: Thursday, September 29, 2011 11:17:11 AM
> Subject: [PATCH v3] mmc : general purpose partition support.
> 
> It allows gerneral purpose partitions in MMC Device.
> And I try to simpliy make mmc_blk_alloc_parts using mmc_part
> structure suggested by Andrei Warkentin.
> After patching, we can see general purpose partitions like this.
> > cat /proc/partitions
>               179 0 847872 mmcblk0
>               179 192 4096 mmcblk0gp3
>               179 160 4096 mmcblk0gp2
>               179 128 4096 mmcblk0gp1
>               179 96  1052672 mmcblk0gp0
>               179 64  1024 mmcblk0boot1
>               179 32  1024 mmcblk0boot0
> 
> Signed-off-by: Namjae Jeon <linkinjeon@...il.com>

> +	 for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
> +		if (card->boot_part[idx].size) {
> +			ret = mmc_blk_alloc_part(card, md,
> +				card->boot_part[idx].cookie,
> +				card->boot_part[idx].size >> 9,
> +				card->boot_part[idx].force_ro,
> +				card->boot_part[idx].name);
> +			if (ret)
> +				return ret;
> +		}
> +	}
> +
> +	for (idx = 0; idx < MMC_NUM_GP_PARTITION; idx++) {
> +		if (card->gp_part[idx].size) {
> +			ret = mmc_blk_alloc_part(card, md,
> +				card->gp_part[idx].cookie,
> +				card->gp_part[idx].size >> 9,
> +				card->gp_part[idx].force_ro,
> +				card->gp_part[idx].name);
> +			if (ret)
> +				return ret;

You were on a better track before. Why does the block drivre need to know about the partition types?
You should parse one array.

> -		card->ext_csd.boot_size = ext_csd[EXT_CSD_BOOT_MULT] << 17;
> +		if (ext_csd[EXT_CSD_BOOT_MULT])	{
> +			part_cfg = EXT_CSD_PART_CONFIG_ACC_BOOT0;
> +			for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
> +				card->boot_part[idx].size =
> +					ext_csd[EXT_CSD_BOOT_MULT] << 17;
> +				card->boot_part[idx].cookie = part_cfg++;
> +				sprintf(card->boot_part[idx].name, "boot%d",
> +					idx);
> +				card->boot_part[idx].force_ro = true;
> +			}
> +		}
>  	}
>  

My earlier comment still stands - make your code look something like -

if (ext_csd[EXT_CSD_BOOT_MULT])	{
	part_cfg = EXT_CSD_PART_CONFIG_ACC_BOOT0;
	for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
		mmc_part_add(card, size, part_cfg++, "boot%d", part_cfg++,
				"boot%d", idx, true)
}

> +	struct mmc_part	boot_part[MMC_NUM_BOOT_PARTITION];	/* mmc boot
> partitions */
> +	struct mmc_part	gp_part[MMC_NUM_GP_PARTITION];	/* mmc general
> purpose partitions */

struct mmc_part parts[MMC_NUM_BOOT_PARTITION + MMC_NUM_GP_PARTITION];
unsigned nr_parts;

A
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ