Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 4 */
 5#ifndef __XFS_ITABLE_H__
 6#define	__XFS_ITABLE_H__
 7
 8/* In-memory representation of a userspace request for batch inode data. */
 9struct xfs_ibulk {
10	struct xfs_mount	*mp;
11	struct mnt_idmap	*idmap;
12	void __user		*ubuffer; /* user output buffer */
13	xfs_ino_t		startino; /* start with this inode */
14	unsigned int		icount;   /* number of elements in ubuffer */
15	unsigned int		ocount;   /* number of records returned */
16	unsigned int		flags;    /* see XFS_IBULK_FLAG_* */
17};
18
19/* Only iterate within the same AG as startino */
20#define XFS_IBULK_SAME_AG	(1U << 0)
21
22/* Fill out the bs_extents64 field if set. */
23#define XFS_IBULK_NREXT64	(1U << 1)
24
25/* Signal that we can return metadata directories. */
26#define XFS_IBULK_METADIR	(1U << 2)
27
28/*
29 * Advance the user buffer pointer by one record of the given size.  If the
30 * buffer is now full, return the appropriate error code.
31 */
32static inline int
33xfs_ibulk_advance(
34	struct xfs_ibulk	*breq,
35	size_t			bytes)
36{
37	char __user		*b = breq->ubuffer;
38
39	breq->ubuffer = b + bytes;
40	breq->ocount++;
41	return breq->ocount == breq->icount ? -ECANCELED : 0;
42}
43
44/*
45 * Return stat information in bulk (by-inode) for the filesystem.
46 */
47
48/*
49 * Return codes for the formatter function are 0 to continue iterating, and
50 * non-zero to stop iterating.  Any non-zero value will be passed up to the
51 * bulkstat/inumbers caller.  The special value -ECANCELED can be used to stop
52 * iteration, as neither bulkstat nor inumbers will ever generate that error
53 * code on their own.
54 */
55
56typedef int (*bulkstat_one_fmt_pf)(struct xfs_ibulk *breq,
57		const struct xfs_bulkstat *bstat);
58
59int xfs_bulkstat_one(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
60int xfs_bulkstat(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
61void xfs_bulkstat_to_bstat(struct xfs_mount *mp, struct xfs_bstat *bs1,
62		const struct xfs_bulkstat *bstat);
63
64typedef int (*inumbers_fmt_pf)(struct xfs_ibulk *breq,
65		const struct xfs_inumbers *igrp);
66
67int xfs_inumbers(struct xfs_ibulk *breq, inumbers_fmt_pf formatter);
68void xfs_inumbers_to_inogrp(struct xfs_inogrp *ig1,
69		const struct xfs_inumbers *ig);
70
71#endif	/* __XFS_ITABLE_H__ */
v5.14.15
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 4 */
 5#ifndef __XFS_ITABLE_H__
 6#define	__XFS_ITABLE_H__
 7
 8/* In-memory representation of a userspace request for batch inode data. */
 9struct xfs_ibulk {
10	struct xfs_mount	*mp;
11	struct user_namespace   *mnt_userns;
12	void __user		*ubuffer; /* user output buffer */
13	xfs_ino_t		startino; /* start with this inode */
14	unsigned int		icount;   /* number of elements in ubuffer */
15	unsigned int		ocount;   /* number of records returned */
16	unsigned int		flags;    /* see XFS_IBULK_FLAG_* */
17};
18
19/* Only iterate within the same AG as startino */
20#define XFS_IBULK_SAME_AG	(XFS_IWALK_SAME_AG)
 
 
 
 
 
 
21
22/*
23 * Advance the user buffer pointer by one record of the given size.  If the
24 * buffer is now full, return the appropriate error code.
25 */
26static inline int
27xfs_ibulk_advance(
28	struct xfs_ibulk	*breq,
29	size_t			bytes)
30{
31	char __user		*b = breq->ubuffer;
32
33	breq->ubuffer = b + bytes;
34	breq->ocount++;
35	return breq->ocount == breq->icount ? -ECANCELED : 0;
36}
37
38/*
39 * Return stat information in bulk (by-inode) for the filesystem.
40 */
41
42/*
43 * Return codes for the formatter function are 0 to continue iterating, and
44 * non-zero to stop iterating.  Any non-zero value will be passed up to the
45 * bulkstat/inumbers caller.  The special value -ECANCELED can be used to stop
46 * iteration, as neither bulkstat nor inumbers will ever generate that error
47 * code on their own.
48 */
49
50typedef int (*bulkstat_one_fmt_pf)(struct xfs_ibulk *breq,
51		const struct xfs_bulkstat *bstat);
52
53int xfs_bulkstat_one(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
54int xfs_bulkstat(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
55void xfs_bulkstat_to_bstat(struct xfs_mount *mp, struct xfs_bstat *bs1,
56		const struct xfs_bulkstat *bstat);
57
58typedef int (*inumbers_fmt_pf)(struct xfs_ibulk *breq,
59		const struct xfs_inumbers *igrp);
60
61int xfs_inumbers(struct xfs_ibulk *breq, inumbers_fmt_pf formatter);
62void xfs_inumbers_to_inogrp(struct xfs_inogrp *ig1,
63		const struct xfs_inumbers *ig);
64
65#endif	/* __XFS_ITABLE_H__ */