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]
Message-ID: <1419276380.765271.1317226086965.JavaMail.root@zimbra-prod-mbox-2.vmware.com>
Date:	Wed, 28 Sep 2011 09:08:07 -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>,
	james p freyensee <james_p_freyensee@...ux.intel.com>,
	cjb@...top.org, linux-mmc@...r.kernel.org
Subject: Re: [PATCH v2] mmc : general purpose partition support.

Hi Namjae,

In general I think your approach is fine and solves the problem. See further inline
comments.

----- 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>, "james p
> freyensee" <james_p_freyensee@...ux.intel.com>, "Namjae Jeon" <linkinjeon@...il.com>
> Sent: Saturday, September 24, 2011 1:07:00 AM
> Subject: [PATCH v2] 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 mmcblk0gp4
>           179 160 4096 mmcblk0gp3
>           179 128 4096 mmcblk0gp2
>           179 96  1052672 mmcblk0gp1
>           179 64  1024 mmcblk0boot1
>           179 32  1024 mmcblk0boot0
> 
> Signed-off-by: Namjae Jeon <linkinjeon@...il.com>

> +		if (ext_csd[EXT_CSD_BOOT_MULT]) {
> +			for (i = 0, boot_part_config = 0x1;
> +				i < MMC_NUM_BOOT_PARTITION;
> +				i++, boot_part_config++) {
> +				card->part[i].size = ...
> +				card->part[i].cookie = ...
> +				sprintf(card->part[i].name, "boot%d", i);
> +				card->part[i].force_ro = ...
> +			}
> +		}
>  	}
>  
>
> +		if (ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x1) {
> +                     ....
> +			int i, gp_num, gp_part_config, gp_size_mult;
> +			for (i = 2, gp_num = 1, gp_part_config = 0x4,
> +				card->part[i].size = ...
> +				card->part[i].cookie = ...
> +				sprintf(card->part[i].name,
> +					"gp%d", gp_num);
> +				card->part[i].force_ro = ..
> +			}
> +		}
>

I feel that you should factor out a function that operates on the static part[] array and
adds a new entry base name, index (i.e. the %d for gp%d), cookie, size, force. 
Otherwise you end up with these hidden mines like fixed indeces for
particular parts (i = 2, etc...) which becomes indecipherable for others. 
Plus you're mostly doing the same thing.

Thanks,
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