1*ace5b9b5Schristos /* $NetBSD: compat_fhstatvfs.c,v 1.5 2024/01/20 14:52:46 christos Exp $ */
2b4cb63a6Smartin
3b4cb63a6Smartin /*-
4b4cb63a6Smartin * Copyright (c) 2006 The NetBSD Foundation, Inc.
5b4cb63a6Smartin * All rights reserved.
6b4cb63a6Smartin *
7b4cb63a6Smartin * This code is derived from software contributed to The NetBSD Foundation
8b4cb63a6Smartin * by Martin Husemann <martin@NetBSD.org>.
9b4cb63a6Smartin *
10b4cb63a6Smartin * Redistribution and use in source and binary forms, with or without
11b4cb63a6Smartin * modification, are permitted provided that the following conditions
12b4cb63a6Smartin * are met:
13b4cb63a6Smartin * 1. Redistributions of source code must retain the above copyright
14b4cb63a6Smartin * notice, this list of conditions and the following disclaimer.
15b4cb63a6Smartin * 2. Redistributions in binary form must reproduce the above copyright
16b4cb63a6Smartin * notice, this list of conditions and the following disclaimer in the
17b4cb63a6Smartin * documentation and/or other materials provided with the distribution.
18b4cb63a6Smartin *
19b4cb63a6Smartin * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20b4cb63a6Smartin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21b4cb63a6Smartin * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22b4cb63a6Smartin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23b4cb63a6Smartin * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24b4cb63a6Smartin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25b4cb63a6Smartin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26b4cb63a6Smartin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27b4cb63a6Smartin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28b4cb63a6Smartin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29b4cb63a6Smartin * POSSIBILITY OF SUCH DAMAGE.
30b4cb63a6Smartin */
31b4cb63a6Smartin
32b4cb63a6Smartin
33b4cb63a6Smartin #include <sys/cdefs.h>
34b4cb63a6Smartin #if defined(LIBC_SCCS) && !defined(lint)
35*ace5b9b5Schristos __RCSID("$NetBSD: compat_fhstatvfs.c,v 1.5 2024/01/20 14:52:46 christos Exp $");
36b4cb63a6Smartin #endif /* LIBC_SCCS and not lint */
37b4cb63a6Smartin
38b4cb63a6Smartin #define __LIBC12_SOURCE__
39b4cb63a6Smartin
40b4cb63a6Smartin #include <sys/types.h>
41b4cb63a6Smartin #include <sys/statvfs.h>
42b4cb63a6Smartin #include <compat/include/fstypes.h>
4302cdd248Schristos #include <compat/sys/statvfs.h>
44b4cb63a6Smartin
45b4cb63a6Smartin __warn_references(fhstatvfs,
4602cdd248Schristos "warning: reference to compatibility fhstatvfs(); include <sys/statvfs.h> to generate correct reference")
47b4cb63a6Smartin
48b4cb63a6Smartin /*
49b4cb63a6Smartin * Convert old fhstatvs() call to new calling convention
50b4cb63a6Smartin */
51b4cb63a6Smartin int
fhstatvfs(const struct compat_30_fhandle * fhp,struct statvfs90 * buf)5202cdd248Schristos fhstatvfs(const struct compat_30_fhandle *fhp, struct statvfs90 *buf)
53b4cb63a6Smartin {
5402cdd248Schristos struct statvfs sb;
5502cdd248Schristos int error = __fhstatvfs190(fhp, FHANDLE30_SIZE, &sb, 0);
5602cdd248Schristos if (error != -1)
5702cdd248Schristos statvfs_to_statvfs90(&sb, buf);
5802cdd248Schristos return error;
59b4cb63a6Smartin }
60