xfs_ioctl.c (fba9760a433634067ec01e7d4cdd581d17b149e0) xfs_ioctl.c (13d59a2a61cbbb4cda13a0cba6d4d1fc537f5dd4)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 830 unchanged lines hidden (view full) ---

839xfs_bulk_ireq_setup(
840 struct xfs_mount *mp,
841 struct xfs_bulk_ireq *hdr,
842 struct xfs_ibulk *breq,
843 void __user *ubuffer)
844{
845 if (hdr->icount == 0 ||
846 (hdr->flags & ~XFS_BULK_IREQ_FLAGS_ALL) ||
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 830 unchanged lines hidden (view full) ---

839xfs_bulk_ireq_setup(
840 struct xfs_mount *mp,
841 struct xfs_bulk_ireq *hdr,
842 struct xfs_ibulk *breq,
843 void __user *ubuffer)
844{
845 if (hdr->icount == 0 ||
846 (hdr->flags & ~XFS_BULK_IREQ_FLAGS_ALL) ||
847 hdr->reserved32 ||
848 memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved)))
849 return -EINVAL;
850
851 breq->startino = hdr->ino;
852 breq->ubuffer = ubuffer;
853 breq->icount = hdr->icount;
854 breq->ocount = 0;
847 memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved)))
848 return -EINVAL;
849
850 breq->startino = hdr->ino;
851 breq->ubuffer = ubuffer;
852 breq->icount = hdr->icount;
853 breq->ocount = 0;
854 breq->flags = 0;
855
855
856 /*
857 * The IREQ_AGNO flag means that we only want results from a given AG.
858 * If @hdr->ino is zero, we start iterating in that AG. If @hdr->ino is
859 * beyond the specified AG then we return no results.
860 */
861 if (hdr->flags & XFS_BULK_IREQ_AGNO) {
862 if (hdr->agno >= mp->m_sb.sb_agcount)
863 return -EINVAL;
864
865 if (breq->startino == 0)
866 breq->startino = XFS_AGINO_TO_INO(mp, hdr->agno, 0);
867 else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno)
868 return -EINVAL;
869
870 breq->flags |= XFS_IBULK_SAME_AG;
871
872 /* Asking for an inode past the end of the AG? We're done! */
873 if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)
874 return XFS_ITER_ABORT;
875 } else if (hdr->agno)
876 return -EINVAL;
877
856 /* Asking for an inode past the end of the FS? We're done! */
857 if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount)
858 return XFS_ITER_ABORT;
859
860 return 0;
861}
862
863/*

--- 1518 unchanged lines hidden ---
878 /* Asking for an inode past the end of the FS? We're done! */
879 if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount)
880 return XFS_ITER_ABORT;
881
882 return 0;
883}
884
885/*

--- 1518 unchanged lines hidden ---