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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 May 2013 12:13:02 +0200
From:	Karel Zak <kzak@...hat.com>
To:	Rafael Aquini <aquini@...hat.com>
Cc:	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	akpm@...ux-foundation.org, hughd@...gle.com, shli@...nel.org,
	jmoyer@...hat.com, riel@...hat.com, lwoodman@...hat.com,
	mgorman@...e.de
Subject: Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

On Mon, May 20, 2013 at 09:04:25PM -0300, Rafael Aquini wrote:
> -	while ((c = getopt_long(argc, argv, "ahdefp:svVL:U:",
> +	while ((c = getopt_long(argc, argv, "ahcdefp:svVL:U:",
>  				long_opts, NULL)) != -1) {
>  		switch (c) {
>  		case 'a':		/* all */
> @@ -738,8 +753,11 @@ int main(int argc, char *argv[])
>  		case 'U':
>  			add_uuid(optarg);
>  			break;
> +		case 'c':
> +			discard += 2;
> +			break;
>  		case 'd':
> -			discard = 1;
> +			discard += 1;

 this is fragile, it would be better to use

        case 'c':
            discard |= SWAP_FLAG_DISCARD_CLUSTER;
            break;
        case 'd':
            discard |= SWAP_FLAG_DISCARD;
            break;

 and use directly the flags everywhere in the code than use magical
 numbers '1' and '2' etc.

    Karel

-- 
 Karel Zak  <kzak@...hat.com>
 http://karelzak.blogspot.com
--
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