Re: [PATCH] lib: create blkdevsize.c and blkdevsize.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 23, 2007 at 02:20:52PM +0200, Stefan Krah wrote:
> Karel Zak <kzak@xxxxxxxxxx> wrote:
> > > It would be great to have an implementation that is guaranteed to work
> > > with older kernels. The getsize() of e2fsprogs for example doesn't trust
> > > BLKGETSIZE64 for kernels < 2.6.
> > 
> >  OK, send patch :-)
> 
> I find the e2fsprogs version more straightforward. This is a highly modified
> version of getsize() in e2fsprogs. The original is GPL (copyright T. Ts'o).

 Thanks.

> +static int kernel_ge_2_6(void)
> +{
> +	struct utsname ut;
> +
> +	if (uname(&ut) < 0)
> +		return 0;
> +
> +	if ((ut.release[0] == '2') && (ut.release[1] == '.') &&
> +	    (ut.release[2] < '6') && (ut.release[3] == '.'))
> +		return 0;
> +
> +	return 1;
> +}

 What about a new file lib/linux_version.c ?

 See linux_version_code() in mkswap. I think it's more generic
 implementation.

    Karel

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

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux