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: <20090918235952.GE29406@nb.net.home>
Date:	Sat, 19 Sep 2009 01:59:52 +0200
From:	Karel Zak <kzak@...hat.com>
To:	Eric Sandeen <sandeen@...hat.com>
Cc:	ext4 development <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH, RFC] mke2fs: get device topology values from blkid

On Thu, Sep 17, 2009 at 05:22:49PM -0500, Eric Sandeen wrote:
> +static errcode_t ext2fs_get_device_geometry(const char *file,
> +					    struct ext2_super_block *fs_param)
> +{
> +	int fd;
> +	int rc = 1;
> +	int blocksize;
> +	blkid_probe pr;
> +	blkid_topology tp;
> +	unsigned long min_io;
> +	unsigned long opt_io;
> +
> +#ifdef HAVE_OPEN64
> +	fd = open64(file, O_RDONLY);
> +#else
> +	fd = open(file, O_RDONLY);
> +#endif
> +	if (fd < 0)
> +		return errno;
> +
> +	pr = blkid_new_probe();
> +	if (!pr)
> +		goto out;
> +
> +	rc = blkid_probe_set_device(pr, fd, 0, 0);
> +	if (rc)
> +		goto out;
> +
> +	tp = blkid_probe_get_topology(pr);
> +	if (!tp)
> +		goto out;
> +
> +	min_io = blkid_topology_get_minimum_io_size(tp);
> +	opt_io = blkid_topology_get_optimal_io_size(tp);
> +	blocksize = EXT2_BLOCK_SIZE(fs_param);
> +
> +	fs_param->s_raid_stride = min_io / blocksize;
> +	fs_param->s_raid_stripe_width = opt_io / blocksize;
> +	rc = 0;
> +out:

   blkid_free_probe(pr);

just in case you want to keep valgrind mem-leak checkers silent :-) 

> +	close(fd);
> +	return rc;
> +}

    Karel
-- 
 Karel Zak  <kzak@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ