| 1 |
.\" Copyright (c) 2019, Oracle. All rights reserved. |
| 2 |
.\" |
| 3 |
.\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0+ |
| 5 |
.\" %%%LICENSE_END |
| 6 |
.TH IOCTL-XFS-FSINUMBERS 2 2019-06-17 "XFS" |
| 7 |
.SH NAME |
| 8 |
ioctl_xfs_fsinumbers \- extract a list of valid inode numbers from an XFS filesystem |
| 9 |
.SH SYNOPSIS |
| 10 |
.br |
| 11 |
.B #include <xfs/xfs_fs.h> |
| 12 |
.PP |
| 13 |
.BI "int ioctl(int " fd ", XFS_IOC_FSINUMBERS, struct xfs_fsop_bulkreq *" arg ); |
| 14 |
.SH DESCRIPTION |
| 15 |
Queries inode allocation information from an XFS filesystem. |
| 16 |
It is intended to be called iteratively to obtain the entire set of inodes. |
| 17 |
These ioctls use |
| 18 |
.B struct xfs_fsop_bulkreq |
| 19 |
to set up a bulk transfer with the kernel: |
| 20 |
.PP |
| 21 |
.in +4n |
| 22 |
.nf |
| 23 |
struct xfs_fsop_bulkreq { |
| 24 |
__u64 *lastip; |
| 25 |
__s32 count; |
| 26 |
void *ubuffer; |
| 27 |
__s32 *ocount; |
| 28 |
}; |
| 29 |
.fi |
| 30 |
.in |
| 31 |
.PP |
| 32 |
.I lastip |
| 33 |
points to a value that will receive the number of the "last inode." |
| 34 |
This should be set to one less than the number of the first inode for which the |
| 35 |
caller wants information, or zero to start with the first inode in the |
| 36 |
filesystem. |
| 37 |
After the call, this value will be set to the number of the last inode for |
| 38 |
which information is supplied. |
| 39 |
This field will not be updated if |
| 40 |
.I ocount |
| 41 |
is NULL. |
| 42 |
.PP |
| 43 |
.I count |
| 44 |
is the number of elements in the |
| 45 |
.B ubuffer |
| 46 |
array and therefore the number of inode groups for which to return allocation |
| 47 |
information. |
| 48 |
.PP |
| 49 |
.I ocount |
| 50 |
points to a value that will receive the number of records returned. |
| 51 |
An output value of zero means that there are no more inode groups left to |
| 52 |
enumerate. |
| 53 |
If this value is NULL, then neither |
| 54 |
.I ocount |
| 55 |
nor |
| 56 |
.I lastip |
| 57 |
will be updated. |
| 58 |
.PP |
| 59 |
.I ubuffer |
| 60 |
points to a memory buffer where inode group information will be copied. |
| 61 |
This buffer must be an array of |
| 62 |
.B struct xfs_inogrp |
| 63 |
which is described below. |
| 64 |
The array must have at least |
| 65 |
.I count |
| 66 |
elements. |
| 67 |
.PP |
| 68 |
.in +4n |
| 69 |
.nf |
| 70 |
struct xfs_inogrp { |
| 71 |
__u64 xi_startino; |
| 72 |
__s32 xi_alloccount; |
| 73 |
__u64 xi_allocmask; |
| 74 |
} |
| 75 |
.fi |
| 76 |
.in |
| 77 |
.PP |
| 78 |
This structure describes inode usage information for a group of 64 consecutive |
| 79 |
inode numbers. |
| 80 |
The fields are as follows: |
| 81 |
.PP |
| 82 |
.I xi_startino |
| 83 |
is the first inode number of this group. |
| 84 |
.PP |
| 85 |
.I xi_alloccount |
| 86 |
is the number of bits that are set in |
| 87 |
.IR xi_allocmask . |
| 88 |
This is the number of inodes allocated in this group. |
| 89 |
.PP |
| 90 |
.I xi_allocmask |
| 91 |
is a bitmask of inodes that are allocated in this inode group. |
| 92 |
The bitmask is 64 bits long, and the least significant bit corresponds to inode |
| 93 |
.BR xi_startino . |
| 94 |
.SH RETURN VALUE |
| 95 |
On error, \-1 is returned, and |
| 96 |
.I errno |
| 97 |
is set to indicate the error. |
| 98 |
.PP |
| 99 |
.SH ERRORS |
| 100 |
Error codes can be one of, but are not limited to, the following: |
| 101 |
.TP |
| 102 |
.B EFAULT |
| 103 |
The kernel was not able to copy into the userspace buffer. |
| 104 |
.TP |
| 105 |
.B EFSBADCRC |
| 106 |
Metadata checksum validation failed while performing the query. |
| 107 |
.TP |
| 108 |
.B EFSCORRUPTED |
| 109 |
Metadata corruption was encountered while performing the query. |
| 110 |
.TP |
| 111 |
.B EINVAL |
| 112 |
One of the arguments was not valid. |
| 113 |
.TP |
| 114 |
.B EIO |
| 115 |
An I/O error was encountered while performing the query. |
| 116 |
.TP |
| 117 |
.B ENOMEM |
| 118 |
There was insufficient memory to perform the query. |
| 119 |
.SH CONFORMING TO |
| 120 |
This API is specific to XFS filesystem on the Linux kernel. |
| 121 |
.SH SEE ALSO |
| 122 |
.BR ioctl (2) |