aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/udf
Commit message (Collapse)AuthorAgeFilesLines
* style(9): white space after ; and around binary operatorsDavid E. O'Brien2025-10-161-2/+2
| | | | | | | in for() loops. Also, use 'while', where only the conditional test of 'for' was used. Reviewed by: sjg
* vfs: retire the VREF macroMateusz Guzik2025-09-271-1/+1
| | | | | | | | | | | | It is defined as a plain use of vref. Churn generated with coccinelle: @@ expression vp; @@ - VREF(vp) + vref(vp)
* vfs: retire the NULLVP macroMateusz Guzik2025-09-271-2/+2
| | | | | | | | | | | | The kernel was already mostly using plain NULL, just whack it and be doen with the legacy. Churn generated with coccinelle: @@ @@ - NULLVP + NULL
* udf: Improve input validation.Dag-Erling Smørgrav2025-07-163-15/+44
| | | | | | | | | | | | | | The existing code frequently assigns unsigned 64-bit values to variables that are signed and / or shorter without checking for overflow. Try to deal with these cases. While here, fix two structs that used single-element arrays in place of flexible array members. PR: 287896 MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51339
* udf: Fix a typo in a source code commentGordon Bergling2025-05-051-1/+1
| | | | | | - s/demostrates/demonstrates/ MFC after: 3 days
* fs: Add static asserts for the size of fid structuresRick Macklem2024-12-061-0/+2
| | | | | | | | | | | | | | File system specific *fid structures are copied into the generic struct fid defined in sys/mount.h. As such, they cannot be larger than struct fid. This patch adds _Static_assert()s to check for this. ZFS and fuse already have _Static_assert()s. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47936
* udf: Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang2024-09-031-2/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
* udf: uma_zcreate() does not failMark Johnston2024-04-241-11/+0
| | | | | | | | | | While here remove an old comment regarding preallocation; it appears to refer to an optimization that is almost certainly irrelevant at this point. No functional change intended. MFC after: 1 week
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-167-14/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* udf: Reject read requests with an invalid lengthJohn Baldwin2023-08-042-1/+8
| | | | | | | | | | | | | | - If the size is negative or if rounding it up to a multiple of the block size overflows, fail the read request with ERANGE. - While here, add a sanity check that the ICB length for the root directory is at least as long as a minimum-sized file entry. PR: 257768 Reported by: Robert Morris <rtm@lcs.mit.edu> MFC after: 1 week Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41220
* udf: reject invalid block sizes from lvdKonstantin Belousov2023-08-041-0/+5
| | | | | | | PR: 272893 Reported by: Robert Morris <rtm@lcs.mit.edu> Sponsored by: The FreeBSD Foundation MFC after: 1 week
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* udf: Remove set but unused variable from udf_getattr.John Baldwin2023-04-101-3/+0
| | | | | | Reviewed by: emaste Reported by: GCC Differential Revision: https://reviews.freebsd.org/D39354
* udf: ansifyMateusz Guzik2023-02-071-6/+2
| | | | | Reported by: clang 15 Sponsored by: Rubicon Communications, LLC ("Netgate")
* Stop cleaning MNT_LOCAL on unmountKonstantin Belousov2023-01-141-4/+0
| | | | | | | | | | There is no point in clearing just this flag. Flags are reset on the struct mount re-allocation for reuse anyway. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37966
* vfs: add the concept of vnode state transitionsMateusz Guzik2022-12-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | To quote from a comment above vput_final: <quote> * XXX Some filesystems pass in an exclusively locked vnode and strongly depend * on the lock being held all the way until VOP_INACTIVE. This in particular * happens with UFS which adds half-constructed vnodes to the hash, where they * can be found by other code. </quote> As is there is no mechanism which allows filesystems to denote that a vnode is fully initialized, consequently problems like the above are only found the hard way(tm). Add rudimentary support for state transitions, which in particular allow to assert the vnode is not legally unlocked until its fate is decided (either construction finishes or vgone is called to abort it). The new field lands in a 1-byte hole, thus it does not grow the struct. Bump __FreeBSD_version to 1400077 Reviewed by: kib (previous version) Tested by: pho Differential Revision: https://reviews.freebsd.org/D37759
* vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)Mateusz Guzik2022-03-241-1/+1
|
* Change VOP_READDIR's cookies argument to a **uint64_tAlan Somers2021-12-161-4/+3
| | | | | | | | | | | | | The cookies argument is only used by the NFS server. NFSv2 defines the cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits. Our VOP_READDIR, however, has always defined it as u_long, which is 32 bits on some architectures. Change it to 64 bits on all architectures. This doesn't matter for any in-tree file systems, but it matters for some FUSE file systems that use 64-bit directory cookies. PR: 260375 Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D33404
* vfs: remove the unused thread argument from NDINIT*Mateusz Guzik2021-11-251-1/+1
| | | | | | See b4a58fbf640409a1 ("vfs: remove cn_thread") Bump __FreeBSD_version to 1400043.
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* udf: Validate the full file entry lengthMark Johnston2020-09-221-16/+30
| | | | | | | | | | | | | | | Otherwise a corrupted file entry containing invalid extended attribute lengths or allocation descriptor lengths can trigger an overflow when the file entry is loaded. admbug: 965 PR: 248613 Reported by: C Turt <ecturt@gmail.com> MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366005
* fs: clean up empty lines in .c and .h filesMateusz Guzik2020-09-012-5/+1
| | | | Notes: svn path=/head/; revision=365070
* vfs: drop the error parameter from vn_isdisk, introduce vn_isdisk_errorMateusz Guzik2020-08-191-1/+1
| | | | | | | Most consumers pass NULL. Notes: svn path=/head/; revision=364372
* vfs: remove the obsolete privused argument from vaccessMateusz Guzik2020-08-051-1/+1
| | | | | | | | This brings argument count down to 6, which is passable without the stack on amd64. Notes: svn path=/head/; revision=363893
* vfs: drop the mostly unused flags argument from VOP_UNLOCKMateusz Guzik2020-01-031-1/+1
| | | | | | | | | | | Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427 Notes: svn path=/head/; revision=356337
* vfs: flatten vop vectorsMateusz Guzik2019-12-161-0/+2
| | | | | | | | | | | | | | | This eliminates the following loop from all VOP calls: while(vop != NULL && \ vop->vop_spare2 == NULL && vop->vop_bypass == NULL) vop = vop->vop_default; Reviewed by: jeff Tesetd by: pho Differential Revision: https://reviews.freebsd.org/D22738 Notes: svn path=/head/; revision=355790
* Rework v_object lifecycle for vnodes.Konstantin Belousov2019-08-291-5/+0
| | | | | | | | | | | | | | | | | | | | | | | Current implementation of vnode_create_vobject() and vnode_destroy_vobject() is written so that it prepared to handle the vm object destruction for live vnode. Practically, no filesystems use this, except for some remnants that were present in UFS till today. One of the consequences of that model is that each filesystem must call vnode_destroy_vobject() in VOP_RECLAIM() or earlier, as result all of them get rid of the v_object in reclaim. Move the call to vnode_destroy_vobject() to vgonel() before VOP_RECLAIM(). This makes v_object stable: either the object is NULL, or it is valid vm object till the vnode reclamation. Remove code from vnode_create_vobject() to handle races with the parallel destruction. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21412 Notes: svn path=/head/; revision=351598
* Ensure that directory entry padding bytes are zeroed.Mark Johnston2018-11-231-2/+3
| | | | | | | | | | | | | | | | | Directory entries must be padded to maintain alignment; in many filesystems the padding was not initialized, resulting in stack memory being copied out to userspace. With the ino64 work there are also some explicit pad fields in struct dirent. Add a subroutine to clear these bytes and use it in the in-tree filesystems. The NFS client is omitted for now as it was fixed separately in r340787. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=340856
* Add d_off support for multiple filesystems.Konstantin Belousov2018-11-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | The d_off field has been added to the dirent structure recently. Currently filesystems don't support this feature. Support has been added and tested for zfs, ufs, ext2fs, fdescfs, msdosfs and unionfs. A stub implementation is available for cd9660, nandfs, udf and pseudofs but hasn't been tested. Motivation for this feature: our usecase is for a userspace nfs server (nfs-ganesha) with zfs. At the moment we cache direntry offsets by calling lseek once per entry, with this patch we can get the offset directly from getdirentries(2) calls which provides a significant speedup. Submitted by: Jack Halford <jack@gandi.net> Reviewed by: mckusick, pfg, rmacklem (previous versions) Sponsored by: Gandi.net MFC after: 1 week Differential revision: https://reviews.freebsd.org/D17917 Notes: svn path=/head/; revision=340431
* Rework pathconf handling for FIFOs.John Baldwin2017-12-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the one hand, FIFOs should respect other variables not supported by the fifofs vnode operation (such as _PC_NAME_MAX, _PC_LINK_MAX, etc.). These values are fs-specific and must come from a fs-specific method. On the other hand, filesystems that support FIFOs are required to support _PC_PIPE_BUF on directory vnodes that can contain FIFOs. Given this latter requirement, once the fs-specific VOP_PATHCONF method supports _PC_PIPE_BUF for directories, it is also suitable for FIFOs permitting a single VOP_PATHCONF method to be used for both FIFOs and non-FIFOs. To that end, retire all of the FIFO-specific pathconf methods from filesystems and change FIFO-specific vnode operation switches to use the existing fs-specific VOP_PATHCONF method. For fifofs, set it's VOP_PATHCONF to VOP_PANIC since it should no longer be used. While here, move _PC_PIPE_BUF handling out of vop_stdpathconf() so that only filesystems supporting FIFOs will report a value. In addition, only report a valid _PC_PIPE_BUF for directories and FIFOs. Discussed with: bde Reviewed by: kib (part of a larger patch) MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D12572 Notes: svn path=/head/; revision=327004
* sys/fs: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-276-0/+12
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326268
* Flesh out pathconf() on UDF.John Baldwin2017-10-021-3/+6
| | | | | | | | | | | - Return 64 bits for _PC_FILESIZEBITS. - Handle _PC_SYMLINK_MAX. - Defer _PC_PATH_MAX to vop_stdpathconf(). Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=324228
* On error, bread(9) zeroes buffer pointer, do not dereference it.Konstantin Belousov2016-11-221-2/+2
| | | | | | | | | | | | See r294954 for the bread(9) change and r297401 for similar cd9660 fix. Reported and tested by: Joshua Kinard <kumba@gentoo.org> PR: 214705 Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=308995
* Remove drop/reacquire of Giant around geom calls for cd9660 and udf.Konstantin Belousov2016-05-221-6/+0
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=300427
* sys/fs: spelling fixes in comments.Pedro F. Giffuni2016-04-291-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298806
* Fix a -Wcast-qual warning in udf_vnops.c, by using __DECONST. NoDimitry Andric2015-01-301-2/+3
| | | | | | | | | functional change. MFC after: 3 days Notes: svn path=/head/; revision=277952
* Add currently unused flag argument to the cluster_read(),Konstantin Belousov2013-03-141-2/+3
| | | | | | | | | | | cluster_write() and cluster_wbuild() functions. The flags to be allowed are a subset of the GB_* flags for getblk(). Sponsored by: The FreeBSD Foundation Tested by: pho Notes: svn path=/head/; revision=248282
* Complete MPSAFE VFS interface and remove MNTK_MPSAFE flag.Attilio Rao2012-11-091-2/+1
| | | | | | | | Porters should refer to __FreeBSD_version 1000021 for this change as it may have happened at the same timeframe. Notes: svn path=/head/; revision=242833
* Use NULL instead of 0 for pointersKevin Lo2012-07-221-1/+1
| | | | Notes: svn path=/head/; revision=238697
* Remove fifo.h. The only used function declaration from the header isKonstantin Belousov2012-03-111-1/+0
| | | | | | | | | migrated to sys/vnode.h. Submitted by: gianni Notes: svn path=/head/; revision=232821
* Fix found places where uio_resid is truncated to int.Konstantin Belousov2012-02-211-1/+2
| | | | | | | | | | | | Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month Notes: svn path=/head/; revision=231949
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-2/+2
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Add a lock flags argument to the VFS_FHTOVP() file systemRick Macklem2011-05-221-1/+1
| | | | | | | | | | | | | | method, so that callers can indicate the minimum vnode locking requirement. This will allow some file systems to choose to return a LK_SHARED locked vnode when LK_SHARED is specified for the flags argument. This patch only adds the flag. It does not change any file system to use it and all callers specify LK_EXCLUSIVE, so file system semantics are not changed. Reviewed by: kib Notes: svn path=/head/; revision=222167
* Revert the previous commit. The race is not applicable to the lockmgrJohn Baldwin2010-07-161-4/+1
| | | | | | | | | | | implementation in 8.0 and later as its flags field does not hold dynamic state such as waiters flags, but is only modified in lockinit() aside from VN_LOCK_*(). Discussed with: attilio Notes: svn path=/head/; revision=210172
* When the MNTK_EXTENDED_SHARED mount option was added, some filesystems wereJohn Baldwin2010-07-161-1/+4
| | | | | | | | | | | | | | | | | changed to defer the setting of VN_LOCK_ASHARE() (which clears LK_NOSHARE in the vnode lock's flags) until after they had determined if the vnode was a FIFO. This occurs after the vnode has been inserted a VFS hash or some similar table, so it is possible for another thread to find this vnode via vget() on an i-node number and block on the vnode lock. If the lockmgr interlock (vnode interlock for vnode locks) is not held when clearing the LK_NOSHARE flag, then the lk_flags field can be clobbered. As a result the thread blocked on the vnode lock may never get woken up. Fix this by holding the vnode interlock while modifying the lock flags in this case. MFC after: 3 days Notes: svn path=/head/; revision=210171
* udf_vnops: cosmetic followup to r208671 - better looking codeAndriy Gapon2010-06-221-1/+1
| | | | | | | | Suggested by: jhb MFC after: 3 days Notes: svn path=/head/; revision=209425
* udf_readlink: fix malloc call with uninitialized size parameterAndriy Gapon2010-05-311-1/+1
| | | | | | | | Found by: clang static analyzer MFC after: 4 days Notes: svn path=/head/; revision=208671
* Use #ifdef APPLE_MAC instead of #ifdef MAC to conditionalize Apple-specificRobert Watson2009-06-061-2/+2
| | | | | | | | | | | | | behavior for unicode support in UDF so as not to conflict with the MAC Framework. Note that Apple's XNU kernel also uses #ifdef MAC for the MAC Framework. Suggested by: pjd MFC after: 3 days Notes: svn path=/head/; revision=193571