aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/lindebugfs
Commit message (Collapse)AuthorAgeFilesLines
* lindebugfs: check that name is set as otherwise pfs_alloc_node_flags() panicsBjoern A. Zeeb13 days1-0/+3
| | | | | | | | | | | | | | | | | | | | | | I have hit the case multiple times that some LinuxKPI field may not be set during driver bringup and lindebugfs would cause a panic. The backtrace goes like: strlen() at strlen+0x54 pfs_create_dir() at pfs_create_dir+0x41 debugfs_create_dir() at debugfs_create_dir+0xa1 ... While the problem is clearly in LinuxKPI or the driver, we likely should at least add an assert to pfs_create_dir() if name is NULL like we have for pfs_add_node() but for lindebugfs at least make this a graceful error and continue without creating the dir instead of panicing. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D54944
* pseudofs: return errors from pfs_create_*()Kyle Evans2025-09-041-3/+5
| | | | | | | | | | | | | | | | | | In D52038, we kind of guess at the reason that pfs_create_dir() failed, which isn't great: it could be EEXISTS, or it could even be ENOMEM. Change the pfs_create_*() interfaces to return an error and use a double pointer to return the new node as requested. Outside of the changes in sys/fs/pseudofs, this diff is the result of running the added coccinelle script against in-tree pseudofs and fixing all of the style(9) violations that spatch added. We set *opn to NULL in the failure cases to avoid breaking callers that did actually error-check their results, since the cocci patch does not attempt to handle that in any way. Reviewed by: des (previous version), kib Differential Revision: https://reviews.freebsd.org/D52157
* lindebugfs.c: Fix possible NULL dereferenceJean-Sébastien Pédron2025-06-231-1/+1
| | | | | | | | | | If `debugfs_destroy()` is called early as part of error handling during initialzation, `pn->pn_data` is unset. This led to a panic in that if because `dm` is NULL. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50985
* lindebugfs: Add `debugfs_create_str()`Jean-Sébastien Pédron2025-04-131-0/+115
| | | | | | | | This function is used by the i915 DRM driver starting with Linux 6.8. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49067
* lindebugfs: use __func__ not __FUNCTION__Bjoern A. Zeeb2025-01-311-2/+2
| | | | | | | | | | Change to the C99 version and not the old gcc name. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D48736
* lindebugfs: Add `debugfs_lookup()`Jean-Sébastien Pédron2025-01-311-0/+17
| | | | | | | | | [Why] This function is used by hhe DRM generic code starting with Linux 6.7. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48761
* LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_bufferBjoern A. Zeeb2024-07-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | Trying to use lindebugfs for debugging wirless drivers two issues became apparent: (a) a panic in lindebugfs calling a hard coded release function if the caller had not provided one. This seems to be based on assumptions that no longer hold up. Remove the hard coded release function to prevent panics. (b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but buffers weren't setup for this (lindebugfs copies data from its own buffer) and then pseudofs will do another copyout to the user on this; remove the copy_to_user() and simply copy the data over to the provided buffer; this works for as long as the only consumers remain debugfs callers (which currently seems to be the case). [the only out-of-tree consumers I am aware off are two drm-kmod drivers/gpu/drm/amd/pm/* debugfs functions I cannot test]. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Tested by: jfree Differential Revision: https://reviews.freebsd.org/D45755
* uio: Use switch statements when handling UIO_READ vs UIO_WRITEJohn Baldwin2024-05-101-12/+21
| | | | | | | | | | This is mostly to reduce the diff with CheriBSD which adds additional constants to enum uio_rw, but also matches the normal style used for uio_segflg. Reviewed by: kib, emaste Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D45142
* 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/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* lindebugfs: Add `debugfs_create_file_size()`Jean-Sébastien Pédron2023-01-251-0/+11
| | | | | | | | | | This is the same as `debugfs_create_file()` but takes the initial size of the file. In FreeBSD, the given size is ignored and `debugfs_create_file()` is called. Reviewed by: emaste, manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D37914
* lindebugfs: Add missing `debugfs_create_u*()` and `debugfs_create_x*()`Jean-Sébastien Pédron2023-01-251-0/+140
| | | | | | | | | | | | The `debugfs_create_x*()` variants are the same as their `debugfs_create_u*()` equivalent, but they work with lowercase hexadecimal. While here, fix a few style(9) issues. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38087
* lindebugfs: Add `debugfs_create_atomic_t()`Jean-Sébastien Pédron2023-01-251-0/+30
| | | | | | Reviewed by: jfree Approved by: jfree Differential Revision: https://reviews.freebsd.org/D37915
* LinuxKPI,lindebugfs: add u8 base type and blob supportBjoern A. Zeeb2022-11-281-0/+66
| | | | | | | | | | | | Add debugfs_create_u8() based on other already present implementations. Add a read-only implementation for debugfs_create_blob(). Both are needed for iwlwifi debugfs support. Sponsored by: The FreeBSD Foundation MFC after: 3 days OKed by: jfree (earlier version) Differential Revision: https://reviews.freebsd.org/D37090
* linuxkpi: drm-kmod debugfs supportJake Freeland2022-09-201-39/+130
| | | | | | | | | | | | This diff extends LinuxKPI to support simple attribute files in debugfs. These simple attributes are an essential component for compiling drm-kmod with CONFIG_DEBUG_FS enabled. This will allow for easier graphics driver debugging using Intel's igt-gpu-tools. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D35883 Sponsored by: Google, Inc. (GSoC 2022)
* lindebugfs: The Linux file operations use negative return values in the kernel.Hans Petter Selasky2022-03-111-2/+2
| | | | | | | Fix sign. MFC after: 1 week Sponsored by: NVIDIA Networking
* lindebugfs: Zero the linux_file structure before use.Hans Petter Selasky2022-03-111-2/+1
| | | | | | | | This avoids clients using garbage values on the stack and makes debugging easier. MFC after: 1 week Sponsored by: NVIDIA Networking
* lindebugfs: Fix writeEmmanuel Vadot2022-02-041-2/+8
| | | | | | | | | | | For write operation pseudofs creates an sbuf with the data. Use this data instead of the uio as it's not usable anymore after uiomove. Reviewed by: hselasky MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D34114
* Add emulation support for the Linux kcov(4) ioctl API.Mark Johnston2020-09-041-0/+3
| | | | | | | | | | This makes it possible to run an unmodified Linux syzkaller executor against the Linuxulator, and have it gather code coverage information. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=365319
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365080
* LinuxKPI: Finalize move of lindebugfs from ports to base.Johannes Lundberg2019-05-191-4/+12
| | | | | | | | | | | | | | | | The source file was moved to base earlier and also improved upon, but never compiled in. This patch will: - Make a module in sys/modules - Make lindebugfs depend on linuxkpi (for seq_file) - Check if read/write functions are set before calling, DRM drivers don't always set both of them. Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week Notes: svn path=/head/; revision=347973
* import linux debugfs supportMatt Macy2019-02-231-0/+309
Reviewed by: hps@ MFC after: 1 week Sponsored by: iX Systems Differential Revision: https://reviews.freebsd.org/D19258 Notes: svn path=/head/; revision=344485