]>
Commit | Line | Data |
---|---|---|
f31b5e12 DW |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (C) 2019 Oracle. All Rights Reserved. | |
4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> | |
5 | */ | |
6 | #include "xfs.h" | |
7 | #include "fsgeom.h" | |
8 | #include "bulkstat.h" | |
9 | ||
10 | /* Bulkstat a single inode. Returns zero or a positive error code. */ | |
11 | int | |
12 | xfrog_bulkstat_single( | |
13 | struct xfs_fd *xfd, | |
14 | uint64_t ino, | |
15 | struct xfs_bstat *ubuffer) | |
16 | { | |
17 | __u64 i = ino; | |
18 | struct xfs_fsop_bulkreq bulkreq = { | |
19 | .lastip = &i, | |
20 | .icount = 1, | |
21 | .ubuffer = ubuffer, | |
22 | .ocount = NULL, | |
23 | }; | |
24 | int ret; | |
25 | ||
26 | ret = ioctl(xfd->fd, XFS_IOC_FSBULKSTAT_SINGLE, &bulkreq); | |
27 | if (ret) | |
28 | return errno; | |
29 | return 0; | |
30 | } | |
31 | ||
32 | /* Bulkstat a bunch of inodes. Returns zero or a positive error code. */ | |
33 | int | |
34 | xfrog_bulkstat( | |
35 | struct xfs_fd *xfd, | |
36 | uint64_t *lastino, | |
37 | uint32_t icount, | |
38 | struct xfs_bstat *ubuffer, | |
39 | uint32_t *ocount) | |
40 | { | |
41 | struct xfs_fsop_bulkreq bulkreq = { | |
42 | .lastip = (__u64 *)lastino, | |
43 | .icount = icount, | |
44 | .ubuffer = ubuffer, | |
45 | .ocount = (__s32 *)ocount, | |
46 | }; | |
47 | int ret; | |
48 | ||
49 | ret = ioctl(xfd->fd, XFS_IOC_FSBULKSTAT, &bulkreq); | |
50 | if (ret) | |
51 | return errno; | |
52 | return 0; | |
53 | } | |
621f3374 DW |
54 | |
55 | /* | |
56 | * Query inode allocation bitmask information. Returns zero or a positive | |
57 | * error code. | |
58 | */ | |
59 | int | |
60 | xfrog_inumbers( | |
61 | struct xfs_fd *xfd, | |
62 | uint64_t *lastino, | |
63 | uint32_t icount, | |
64 | struct xfs_inogrp *ubuffer, | |
65 | uint32_t *ocount) | |
66 | { | |
67 | struct xfs_fsop_bulkreq bulkreq = { | |
68 | .lastip = (__u64 *)lastino, | |
69 | .icount = icount, | |
70 | .ubuffer = ubuffer, | |
71 | .ocount = (__s32 *)ocount, | |
72 | }; | |
73 | int ret; | |
74 | ||
75 | ret = ioctl(xfd->fd, XFS_IOC_FSINUMBERS, &bulkreq); | |
76 | if (ret) | |
77 | return errno; | |
78 | return 0; | |
79 | } |