On Tue, Oct 23, 2007 at 02:20:52PM +0200, Stefan Krah wrote:
> Karel Zak <[EMAIL PROTECTED]> 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  <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to