Lines Matching +full:buffered +full:- +full:positive
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
47 /* Return 0 on success or positive error */
55 xfs_bulkstat_to_bstat(breq->mp, &bs1, bstat); in xfs_fsbulkstat_one_fmt()
56 if (copy_to_user(breq->ubuffer, &bs1, sizeof(bs1))) in xfs_fsbulkstat_one_fmt()
57 return -EFAULT; in xfs_fsbulkstat_one_fmt()
69 if (copy_to_user(breq->ubuffer, &ig1, sizeof(struct xfs_inogrp))) in xfs_fsinumbers_fmt()
70 return -EFAULT; in xfs_fsinumbers_fmt()
80 struct xfs_mount *mp = XFS_I(file_inode(file))->i_mount; in xfs_ioc_fsbulkstat()
94 return -EPERM; in xfs_ioc_fsbulkstat()
97 return -EIO; in xfs_ioc_fsbulkstat()
100 return -EFAULT; in xfs_ioc_fsbulkstat()
103 return -EFAULT; in xfs_ioc_fsbulkstat()
106 return -EINVAL; in xfs_ioc_fsbulkstat()
109 return -EINVAL; in xfs_ioc_fsbulkstat()
128 lastino = breq.startino - 1; in xfs_ioc_fsbulkstat()
136 lastino = breq.startino - 1; in xfs_ioc_fsbulkstat()
144 return -EFAULT; in xfs_ioc_fsbulkstat()
148 return -EFAULT; in xfs_ioc_fsbulkstat()
153 /* Return 0 on success or positive error */
159 if (copy_to_user(breq->ubuffer, bstat, sizeof(struct xfs_bulkstat))) in xfs_bulkstat_fmt()
160 return -EFAULT; in xfs_bulkstat_fmt()
167 * should proceed; -ECANCELED if there's nothing to do; or the usual
177 if (hdr->icount == 0 || in xfs_bulk_ireq_setup()
178 (hdr->flags & ~XFS_BULK_IREQ_FLAGS_ALL) || in xfs_bulk_ireq_setup()
179 memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved))) in xfs_bulk_ireq_setup()
180 return -EINVAL; in xfs_bulk_ireq_setup()
182 breq->startino = hdr->ino; in xfs_bulk_ireq_setup()
183 breq->ubuffer = ubuffer; in xfs_bulk_ireq_setup()
184 breq->icount = hdr->icount; in xfs_bulk_ireq_setup()
185 breq->ocount = 0; in xfs_bulk_ireq_setup()
186 breq->flags = 0; in xfs_bulk_ireq_setup()
193 if (hdr->flags & XFS_BULK_IREQ_SPECIAL) { in xfs_bulk_ireq_setup()
194 if (hdr->flags & XFS_BULK_IREQ_AGNO) in xfs_bulk_ireq_setup()
195 return -EINVAL; in xfs_bulk_ireq_setup()
197 switch (hdr->ino) { in xfs_bulk_ireq_setup()
199 breq->startino = mp->m_sb.sb_rootino; in xfs_bulk_ireq_setup()
202 return -EINVAL; in xfs_bulk_ireq_setup()
204 breq->icount = 1; in xfs_bulk_ireq_setup()
209 * If @hdr->ino is zero, we start iterating in that AG. If @hdr->ino is in xfs_bulk_ireq_setup()
212 if (hdr->flags & XFS_BULK_IREQ_AGNO) { in xfs_bulk_ireq_setup()
213 if (hdr->agno >= mp->m_sb.sb_agcount) in xfs_bulk_ireq_setup()
214 return -EINVAL; in xfs_bulk_ireq_setup()
216 if (breq->startino == 0) in xfs_bulk_ireq_setup()
217 breq->startino = XFS_AGINO_TO_INO(mp, hdr->agno, 0); in xfs_bulk_ireq_setup()
218 else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno) in xfs_bulk_ireq_setup()
219 return -EINVAL; in xfs_bulk_ireq_setup()
221 breq->flags |= XFS_IBULK_SAME_AG; in xfs_bulk_ireq_setup()
224 if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno) in xfs_bulk_ireq_setup()
225 return -ECANCELED; in xfs_bulk_ireq_setup()
226 } else if (hdr->agno) in xfs_bulk_ireq_setup()
227 return -EINVAL; in xfs_bulk_ireq_setup()
230 if (XFS_INO_TO_AGNO(mp, breq->startino) >= mp->m_sb.sb_agcount) in xfs_bulk_ireq_setup()
231 return -ECANCELED; in xfs_bulk_ireq_setup()
233 if (hdr->flags & XFS_BULK_IREQ_NREXT64) in xfs_bulk_ireq_setup()
234 breq->flags |= XFS_IBULK_NREXT64; in xfs_bulk_ireq_setup()
248 hdr->ino = breq->startino; in xfs_bulk_ireq_teardown()
249 hdr->ocount = breq->ocount; in xfs_bulk_ireq_teardown()
259 struct xfs_mount *mp = XFS_I(file_inode(file))->i_mount; in xfs_ioc_bulkstat()
268 return -EPERM; in xfs_ioc_bulkstat()
271 return -EIO; in xfs_ioc_bulkstat()
273 if (copy_from_user(&hdr, &arg->hdr, sizeof(hdr))) in xfs_ioc_bulkstat()
274 return -EFAULT; in xfs_ioc_bulkstat()
276 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->bulkstat); in xfs_ioc_bulkstat()
277 if (error == -ECANCELED) in xfs_ioc_bulkstat()
288 if (copy_to_user(&arg->hdr, &hdr, sizeof(hdr))) in xfs_ioc_bulkstat()
289 return -EFAULT; in xfs_ioc_bulkstat()
299 if (copy_to_user(breq->ubuffer, igrp, sizeof(struct xfs_inumbers))) in xfs_inumbers_fmt()
300 return -EFAULT; in xfs_inumbers_fmt()
318 return -EPERM; in xfs_ioc_inumbers()
321 return -EIO; in xfs_ioc_inumbers()
323 if (copy_from_user(&hdr, &arg->hdr, sizeof(hdr))) in xfs_ioc_inumbers()
324 return -EFAULT; in xfs_ioc_inumbers()
326 error = xfs_bulk_ireq_setup(mp, &hdr, &breq, arg->inumbers); in xfs_ioc_inumbers()
327 if (error == -ECANCELED) in xfs_ioc_inumbers()
338 if (copy_to_user(&arg->hdr, &hdr, sizeof(hdr))) in xfs_ioc_inumbers()
339 return -EFAULT; in xfs_ioc_inumbers()
365 return -EFAULT; in xfs_ioc_fsgeometry()
379 return -EFAULT; in xfs_ioc_ag_geometry()
381 return -EINVAL; in xfs_ioc_ag_geometry()
383 return -EINVAL; in xfs_ioc_ag_geometry()
387 return -EINVAL; in xfs_ioc_ag_geometry()
395 return -EFAULT; in xfs_ioc_ag_geometry()
409 struct xfs_mount *mp = ip->i_mount; in xfs_fill_fsxattr()
414 if (ip->i_diflags & XFS_DIFLAG_EXTSIZE) { in xfs_fill_fsxattr()
415 fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize); in xfs_fill_fsxattr()
416 } else if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) { in xfs_fill_fsxattr()
422 if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) && in xfs_fill_fsxattr()
423 xfs_extlen_to_rtxmod(mp, ip->i_extsize) > 0) { in xfs_fill_fsxattr()
424 fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | in xfs_fill_fsxattr()
426 fa->fsx_extsize = 0; in xfs_fill_fsxattr()
428 fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize); in xfs_fill_fsxattr()
432 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_fill_fsxattr()
433 fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize); in xfs_fill_fsxattr()
434 fa->fsx_projid = ip->i_projid; in xfs_fill_fsxattr()
436 fa->fsx_nextents = xfs_iext_count(ifp); in xfs_fill_fsxattr()
438 fa->fsx_nextents = xfs_ifork_nextents(ifp); in xfs_fill_fsxattr()
463 return -ENOTTY; in xfs_fileattr_get()
478 struct xfs_mount *mp = ip->i_mount; in xfs_ioctl_setattr_xflags()
479 bool rtflag = (fa->fsx_xflags & FS_XFLAG_REALTIME); in xfs_ioctl_setattr_xflags()
485 return -EINVAL; in xfs_ioctl_setattr_xflags()
493 (mp->m_ddev_targp->bt_daxdev == NULL || in xfs_ioctl_setattr_xflags()
494 (mp->m_rtdev_targp && in xfs_ioctl_setattr_xflags()
495 mp->m_rtdev_targp->bt_daxdev == NULL))) in xfs_ioctl_setattr_xflags()
496 return -EINVAL; in xfs_ioctl_setattr_xflags()
501 if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 || in xfs_ioctl_setattr_xflags()
502 xfs_extlen_to_rtxmod(mp, ip->i_extsize)) in xfs_ioctl_setattr_xflags()
503 return -EINVAL; in xfs_ioctl_setattr_xflags()
507 ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; in xfs_ioctl_setattr_xflags()
511 i_flags2 = xfs_flags2diflags2(ip, fa->fsx_xflags); in xfs_ioctl_setattr_xflags()
513 return -EINVAL; in xfs_ioctl_setattr_xflags()
515 ip->i_diflags = xfs_flags2diflags(ip, fa->fsx_xflags); in xfs_ioctl_setattr_xflags()
516 ip->i_diflags2 = i_flags2; in xfs_ioctl_setattr_xflags()
524 if (rtflag != XFS_IS_REALTIME_INODE(ip) && S_ISREG(VFS_I(ip)->i_mode)) in xfs_ioctl_setattr_xflags()
538 struct xfs_mount *mp = ip->i_mount; in xfs_ioctl_setattr_prepare_dax()
541 if (S_ISDIR(inode->i_mode)) in xfs_ioctl_setattr_prepare_dax()
547 if (((fa->fsx_xflags & FS_XFLAG_DAX) && in xfs_ioctl_setattr_prepare_dax()
548 !(ip->i_diflags2 & XFS_DIFLAG2_DAX)) || in xfs_ioctl_setattr_prepare_dax()
549 (!(fa->fsx_xflags & FS_XFLAG_DAX) && in xfs_ioctl_setattr_prepare_dax()
550 (ip->i_diflags2 & XFS_DIFLAG2_DAX))) in xfs_ioctl_setattr_prepare_dax()
565 struct xfs_mount *mp = ip->i_mount; in xfs_ioctl_setattr_get_trans()
567 int error = -EROFS; in xfs_ioctl_setattr_get_trans()
571 error = -EIO; in xfs_ioctl_setattr_get_trans()
598 struct xfs_mount *mp = ip->i_mount; in xfs_ioctl_setattr_check_extsize()
602 if (!fa->fsx_valid) in xfs_ioctl_setattr_check_extsize()
605 if (S_ISREG(VFS_I(ip)->i_mode) && xfs_inode_has_filedata(ip) && in xfs_ioctl_setattr_check_extsize()
606 XFS_FSB_TO_B(mp, ip->i_extsize) != fa->fsx_extsize) in xfs_ioctl_setattr_check_extsize()
607 return -EINVAL; in xfs_ioctl_setattr_check_extsize()
609 if (fa->fsx_extsize & mp->m_blockmask) in xfs_ioctl_setattr_check_extsize()
610 return -EINVAL; in xfs_ioctl_setattr_check_extsize()
612 new_diflags = xfs_flags2diflags(ip, fa->fsx_xflags); in xfs_ioctl_setattr_check_extsize()
624 rtextsize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize); in xfs_ioctl_setattr_check_extsize()
625 if (fa->fsx_extsize % rtextsize_bytes) in xfs_ioctl_setattr_check_extsize()
626 return -EINVAL; in xfs_ioctl_setattr_check_extsize()
629 failaddr = xfs_inode_validate_extsize(ip->i_mount, in xfs_ioctl_setattr_check_extsize()
630 XFS_B_TO_FSB(mp, fa->fsx_extsize), in xfs_ioctl_setattr_check_extsize()
631 VFS_I(ip)->i_mode, new_diflags); in xfs_ioctl_setattr_check_extsize()
632 return failaddr != NULL ? -EINVAL : 0; in xfs_ioctl_setattr_check_extsize()
640 struct xfs_mount *mp = ip->i_mount; in xfs_ioctl_setattr_check_cowextsize()
645 if (!fa->fsx_valid) in xfs_ioctl_setattr_check_cowextsize()
648 if (fa->fsx_cowextsize & mp->m_blockmask) in xfs_ioctl_setattr_check_cowextsize()
649 return -EINVAL; in xfs_ioctl_setattr_check_cowextsize()
651 new_diflags = xfs_flags2diflags(ip, fa->fsx_xflags); in xfs_ioctl_setattr_check_cowextsize()
652 new_diflags2 = xfs_flags2diflags2(ip, fa->fsx_xflags); in xfs_ioctl_setattr_check_cowextsize()
654 failaddr = xfs_inode_validate_cowextsize(ip->i_mount, in xfs_ioctl_setattr_check_cowextsize()
655 XFS_B_TO_FSB(mp, fa->fsx_cowextsize), in xfs_ioctl_setattr_check_cowextsize()
656 VFS_I(ip)->i_mode, new_diflags, new_diflags2); in xfs_ioctl_setattr_check_cowextsize()
657 return failaddr != NULL ? -EINVAL : 0; in xfs_ioctl_setattr_check_cowextsize()
665 if (!fa->fsx_valid) in xfs_ioctl_setattr_check_projid()
669 if (fa->fsx_projid > (uint16_t)-1 && in xfs_ioctl_setattr_check_projid()
670 !xfs_has_projid32(ip->i_mount)) in xfs_ioctl_setattr_check_projid()
671 return -EINVAL; in xfs_ioctl_setattr_check_projid()
682 struct xfs_mount *mp = ip->i_mount; in xfs_fileattr_set()
691 return -ENOTTY; in xfs_fileattr_set()
693 if (!fa->fsx_valid) { in xfs_fileattr_set()
694 if (fa->flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | in xfs_fileattr_set()
697 return -EOPNOTSUPP; in xfs_fileattr_set()
712 if (fa->fsx_valid && XFS_IS_QUOTA_ON(mp)) { in xfs_fileattr_set()
713 error = xfs_qm_vop_dqalloc(ip, VFS_I(ip)->i_uid, in xfs_fileattr_set()
714 VFS_I(ip)->i_gid, fa->fsx_projid, in xfs_fileattr_set()
740 if (!fa->fsx_valid) in xfs_fileattr_set()
746 * The set-user-ID and set-group-ID bits of a file will be cleared upon in xfs_fileattr_set()
750 if ((VFS_I(ip)->i_mode & (S_ISUID|S_ISGID)) && in xfs_fileattr_set()
752 VFS_I(ip)->i_mode &= ~(S_ISUID|S_ISGID); in xfs_fileattr_set()
755 if (ip->i_projid != fa->fsx_projid) { in xfs_fileattr_set()
758 &ip->i_pdquot, pdqp); in xfs_fileattr_set()
760 ip->i_projid = fa->fsx_projid; in xfs_fileattr_set()
768 if (ip->i_diflags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT)) in xfs_fileattr_set()
769 ip->i_extsize = XFS_B_TO_FSB(mp, fa->fsx_extsize); in xfs_fileattr_set()
771 ip->i_extsize = 0; in xfs_fileattr_set()
774 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_fileattr_set()
775 ip->i_cowextsize = XFS_B_TO_FSB(mp, fa->fsx_cowextsize); in xfs_fileattr_set()
777 ip->i_cowextsize = 0; in xfs_fileattr_set()
804 if (put_user(p->bmv_offset, &u->bmv_offset) || in xfs_getbmap_format()
805 put_user(p->bmv_block, &u->bmv_block) || in xfs_getbmap_format()
806 put_user(p->bmv_length, &u->bmv_length) || in xfs_getbmap_format()
807 put_user(0, &u->bmv_count) || in xfs_getbmap_format()
808 put_user(0, &u->bmv_entries)) in xfs_getbmap_format()
812 if (put_user(0, &u->bmv_iflags) || in xfs_getbmap_format()
813 put_user(p->bmv_oflags, &u->bmv_oflags) || in xfs_getbmap_format()
814 put_user(0, &u->bmv_unused1) || in xfs_getbmap_format()
815 put_user(0, &u->bmv_unused2)) in xfs_getbmap_format()
843 return -EINVAL; in xfs_ioc_getbmap()
847 return -EFAULT; in xfs_ioc_getbmap()
850 return -EINVAL; in xfs_ioc_getbmap()
852 return -ENOMEM; in xfs_ioc_getbmap()
856 return -ENOMEM; in xfs_ioc_getbmap()
862 error = -EFAULT; in xfs_ioc_getbmap()
888 f = fdget((int)sxp->sx_fdtarget); in xfs_ioc_swapext()
890 error = -EINVAL; in xfs_ioc_swapext()
894 if (!(fd_file(f)->f_mode & FMODE_WRITE) || in xfs_ioc_swapext()
895 !(fd_file(f)->f_mode & FMODE_READ) || in xfs_ioc_swapext()
896 (fd_file(f)->f_flags & O_APPEND)) { in xfs_ioc_swapext()
897 error = -EBADF; in xfs_ioc_swapext()
901 tmp = fdget((int)sxp->sx_fdtmp); in xfs_ioc_swapext()
903 error = -EINVAL; in xfs_ioc_swapext()
907 if (!(fd_file(tmp)->f_mode & FMODE_WRITE) || in xfs_ioc_swapext()
908 !(fd_file(tmp)->f_mode & FMODE_READ) || in xfs_ioc_swapext()
909 (fd_file(tmp)->f_flags & O_APPEND)) { in xfs_ioc_swapext()
910 error = -EBADF; in xfs_ioc_swapext()
916 error = -EINVAL; in xfs_ioc_swapext()
925 if (fd_file(f)->f_op != &xfs_file_operations || in xfs_ioc_swapext()
926 fd_file(tmp)->f_op != &xfs_file_operations) { in xfs_ioc_swapext()
927 error = -EINVAL; in xfs_ioc_swapext()
934 if (ip->i_mount != tip->i_mount) { in xfs_ioc_swapext()
935 error = -EINVAL; in xfs_ioc_swapext()
939 if (ip->i_ino == tip->i_ino) { in xfs_ioc_swapext()
940 error = -EINVAL; in xfs_ioc_swapext()
944 if (xfs_is_shutdown(ip->i_mount)) { in xfs_ioc_swapext()
945 error = -EIO; in xfs_ioc_swapext()
964 struct xfs_sb *sbp = &mp->m_sb; in xfs_ioc_getlabel()
968 BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX); in xfs_ioc_getlabel()
972 spin_lock(&mp->m_sb_lock); in xfs_ioc_getlabel()
973 strncpy(label, sbp->sb_fname, XFSLABEL_MAX); in xfs_ioc_getlabel()
974 spin_unlock(&mp->m_sb_lock); in xfs_ioc_getlabel()
977 return -EFAULT; in xfs_ioc_getlabel()
987 struct xfs_sb *sbp = &mp->m_sb; in xfs_ioc_setlabel()
993 return -EPERM; in xfs_ioc_setlabel()
1001 return -EFAULT; in xfs_ioc_setlabel()
1003 if (len > sizeof(sbp->sb_fname)) in xfs_ioc_setlabel()
1004 return -EINVAL; in xfs_ioc_setlabel()
1010 spin_lock(&mp->m_sb_lock); in xfs_ioc_setlabel()
1011 memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname)); in xfs_ioc_setlabel()
1012 memcpy(sbp->sb_fname, label, len); in xfs_ioc_setlabel()
1013 spin_unlock(&mp->m_sb_lock); in xfs_ioc_setlabel()
1021 * buffered reads from userspace (i.e. from blkid) are invalidated, in xfs_ioc_setlabel()
1022 * and userspace will see the newly-written label. in xfs_ioc_setlabel()
1030 mutex_lock(&mp->m_growlock); in xfs_ioc_setlabel()
1032 mutex_unlock(&mp->m_growlock); in xfs_ioc_setlabel()
1034 invalidate_bdev(mp->m_ddev_targp->bt_bdev); in xfs_ioc_setlabel()
1046 if (src->eof_version != XFS_EOFBLOCKS_VERSION) in xfs_fs_eofblocks_from_user()
1047 return -EINVAL; in xfs_fs_eofblocks_from_user()
1049 if (src->eof_flags & ~XFS_EOF_FLAGS_VALID) in xfs_fs_eofblocks_from_user()
1050 return -EINVAL; in xfs_fs_eofblocks_from_user()
1052 if (memchr_inv(&src->pad32, 0, sizeof(src->pad32)) || in xfs_fs_eofblocks_from_user()
1053 memchr_inv(src->pad64, 0, sizeof(src->pad64))) in xfs_fs_eofblocks_from_user()
1054 return -EINVAL; in xfs_fs_eofblocks_from_user()
1056 dst->icw_flags = 0; in xfs_fs_eofblocks_from_user()
1057 if (src->eof_flags & XFS_EOF_FLAGS_SYNC) in xfs_fs_eofblocks_from_user()
1058 dst->icw_flags |= XFS_ICWALK_FLAG_SYNC; in xfs_fs_eofblocks_from_user()
1059 if (src->eof_flags & XFS_EOF_FLAGS_UID) in xfs_fs_eofblocks_from_user()
1060 dst->icw_flags |= XFS_ICWALK_FLAG_UID; in xfs_fs_eofblocks_from_user()
1061 if (src->eof_flags & XFS_EOF_FLAGS_GID) in xfs_fs_eofblocks_from_user()
1062 dst->icw_flags |= XFS_ICWALK_FLAG_GID; in xfs_fs_eofblocks_from_user()
1063 if (src->eof_flags & XFS_EOF_FLAGS_PRID) in xfs_fs_eofblocks_from_user()
1064 dst->icw_flags |= XFS_ICWALK_FLAG_PRID; in xfs_fs_eofblocks_from_user()
1065 if (src->eof_flags & XFS_EOF_FLAGS_MINFILESIZE) in xfs_fs_eofblocks_from_user()
1066 dst->icw_flags |= XFS_ICWALK_FLAG_MINFILESIZE; in xfs_fs_eofblocks_from_user()
1068 dst->icw_prid = src->eof_prid; in xfs_fs_eofblocks_from_user()
1069 dst->icw_min_file_size = src->eof_min_file_size; in xfs_fs_eofblocks_from_user()
1071 dst->icw_uid = INVALID_UID; in xfs_fs_eofblocks_from_user()
1072 if (src->eof_flags & XFS_EOF_FLAGS_UID) { in xfs_fs_eofblocks_from_user()
1073 dst->icw_uid = make_kuid(current_user_ns(), src->eof_uid); in xfs_fs_eofblocks_from_user()
1074 if (!uid_valid(dst->icw_uid)) in xfs_fs_eofblocks_from_user()
1075 return -EINVAL; in xfs_fs_eofblocks_from_user()
1078 dst->icw_gid = INVALID_GID; in xfs_fs_eofblocks_from_user()
1079 if (src->eof_flags & XFS_EOF_FLAGS_GID) { in xfs_fs_eofblocks_from_user()
1080 dst->icw_gid = make_kgid(current_user_ns(), src->eof_gid); in xfs_fs_eofblocks_from_user()
1081 if (!gid_valid(dst->icw_gid)) in xfs_fs_eofblocks_from_user()
1082 return -EINVAL; in xfs_fs_eofblocks_from_user()
1093 struct xfs_mount *mp = XFS_I(file_inode(filp))->i_mount; in xfs_ioctl_getset_resblocks()
1098 return -EPERM; in xfs_ioctl_getset_resblocks()
1102 return -EROFS; in xfs_ioctl_getset_resblocks()
1105 return -EFAULT; in xfs_ioctl_getset_resblocks()
1116 spin_lock(&mp->m_sb_lock); in xfs_ioctl_getset_resblocks()
1117 fsop.resblks = mp->m_resblks; in xfs_ioctl_getset_resblocks()
1118 fsop.resblks_avail = mp->m_resblks_avail; in xfs_ioctl_getset_resblocks()
1119 spin_unlock(&mp->m_sb_lock); in xfs_ioctl_getset_resblocks()
1122 return -EFAULT; in xfs_ioctl_getset_resblocks()
1132 .allocino = percpu_counter_read_positive(&mp->m_icount), in xfs_ioctl_fs_counts()
1133 .freeino = percpu_counter_read_positive(&mp->m_ifree), in xfs_ioctl_fs_counts()
1134 .freedata = percpu_counter_read_positive(&mp->m_fdblocks) - in xfs_ioctl_fs_counts()
1136 .freertx = percpu_counter_read_positive(&mp->m_frextents), in xfs_ioctl_fs_counts()
1140 return -EFAULT; in xfs_ioctl_fs_counts()
1145 * These long-unused ioctls were removed from the official ioctl API in 5.17,
1154 * Note: some of the ioctl's return positive numbers as a
1167 struct xfs_mount *mp = ip->i_mount; in xfs_file_ioctl()
1186 current->comm); in xfs_file_ioctl()
1187 return -ENOTTY; in xfs_file_ioctl()
1192 da.d_mem = da.d_miniosz = target->bt_logical_sectorsize; in xfs_file_ioctl()
1193 da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1); in xfs_file_ioctl()
1196 return -EFAULT; in xfs_file_ioctl()
1221 return put_user(inode->i_generation, (int __user *)arg); in xfs_file_ioctl()
1248 return -EFAULT; in xfs_file_ioctl()
1255 return -EFAULT; in xfs_file_ioctl()
1263 return -EFAULT; in xfs_file_ioctl()
1276 return -EFAULT; in xfs_file_ioctl()
1296 return -EFAULT; in xfs_file_ioctl()
1310 return -EFAULT; in xfs_file_ioctl()
1324 return -EFAULT; in xfs_file_ioctl()
1338 return -EPERM; in xfs_file_ioctl()
1341 return -EFAULT; in xfs_file_ioctl()
1350 return -EPERM; in xfs_file_ioctl()
1353 return -EFAULT; in xfs_file_ioctl()
1360 return -EPERM; in xfs_file_ioctl()
1369 return -EPERM; in xfs_file_ioctl()
1372 return -EROFS; in xfs_file_ioctl()
1375 return -EFAULT; in xfs_file_ioctl()
1383 sb_start_write(mp->m_super); in xfs_file_ioctl()
1385 sb_end_write(mp->m_super); in xfs_file_ioctl()
1397 return -ENOTTY; in xfs_file_ioctl()