The INOTIFY macro and its variants check if the vnode is being watched,
and if so, calls into a slow path which adds an event to one or more
inotify descriptors. Most of these events correspond to EVFILT_VNODE
events as well, and are added to VOP *_post hooks.
Reviewed by: kib
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
Include the two new syscalls in the symbol map.
Reviewed by: kib
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
inotify_init() and inotify_init1() are implemented using __specialfd(2).
inotify_add_watch() is implemented in terms of inotify_add_watch_at(2).
Reviewed by: kib
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
Add an implementation of inotify_init(), inotify_add_watch(),
inotify_rm_watch(), source-compatible with Linux. This provides
functionality similar to kevent(2)'s EVFILT_VNODE, i.e., it lets
applications monitor filesystem files for accesses. Compared to
inotify, however, EVFILT_VNODE has the limitation of requiring the
application to open the file to be monitored. This means that activity
on a newly created file cannot be monitored reliably, and that a file
descriptor per file in the hierarchy is required.
inotify on the other hand allows a directory and its entries to be
monitored at once. It introduces a new file descriptor type to which
"watches" can be attached; a watch is a pseudo-file descriptor
associated with a file or directory and a set of events to watch for.
When a watched vnode is accessed, a description of the event is queued
to the inotify descriptor, readable with read(2). Events for files in a
watched directory include the file name.
A watched vnode has its usecount bumped, so name cache entries
originating from a watched directory are not evicted. Name cache
entries are used to populate inotify events for files with a link in a
watched directory. In particular, if a file is accessed with, say,
read(2), an IN_ACCESS event will be generated for any watched hard link
of the file.
The inotify_add_watch_at() variant is included so that this
functionality is available in capability mode; plain inotify_add_watch()
is disallowed in capability mode.
When a file in a nullfs mount is watched, the watch is attached to the
lower vnode, such that accesses via either layer generate inotify
events.
Many thanks to Gleb Popov for testing this patch and finding lots of
bugs.
PR: 258010, 215011
Reviewed by: kib
Tested by: arrowd
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
Only attach gpiobus when the controller is fully initialized. Children
of gpiobus expect this to be the case.
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51088
Some drivers need to postpone the attachment of gpiobus until hardware
init is done. Add a new gpiobus_add_bus function to accommodate this
case.
Suggested by: mmel, andrew
Reviewed by: mmel, imp, andrew
Approved by: imp (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51133
Table name and table command require each other as reflected in the
synopsis [-t table -T command [address ...]], so print usage and exit if
only one of them is given.
By moving the inter-dependence check right after option parsing is done,
we can bail out even before opening pf(4) and drop the internal wrapper
pfctl_command_tables() as unneeded indirection with now duplicate checks.
OK sashan
Obtained from: OpenBSD, kn <kn@openbsd.org>, 97699edbc9
Sponsored by: Rubicon Communications, LLC ("Netgate")
pf.conf(5)'s TABLE section explains it, but lets be clear about it in the
table command descriptions, too.
"go for it" jmc
Obtained from: OpenBSD, kn <kn@openbsd.org>, 8d4231551f
Sponsored by: Rubicon Communications, LLC ("Netgate")
All rulesets reference their parent anchor, except for the special cased
main anchor containing the main ruleset, which's reference is always NULL
since initialization and never changes.
Replacing nullity tests with clearer equality checks makes the code less
ambigious and easier to understand.
OK sashan
Obtained from: OpenBSD, kn <kn@openbsd.org>, 55038654e1
Sponsored by: Rubicon Communications, LLC ("Netgate")
"driver" is a left-over from earlier implementations.
Nowadays each driver such as lo(4) has it's respective interface group of
the same name ("lo"), but additional driver-independent groups exist, too:
# ifconfig lo0 group foo
# pfctl -s I -i foo
foo
lo0
OK henning
Obtained from: OpenBSD, kn <kn@openbsd.org>, 822e892650
Sponsored by: Rubicon Communications, LLC ("Netgate")
For semantic consistency with pf_{create,find,remove}_{anchor,ruleset}().
Simplify logic by squashing the if/else block while here.
No functional change.
Feedback jca and mikeb, OK mikeb
Obtained from: OpenBSD, kn <kn@openbsd.org>, f6275afa61
Sponsored by: Rubicon Communications, LLC ("Netgate")
These are just unhelpful case conversion.
OK sashan henning
Obtained from: OpenBSD, kn <kn@openbsd.org>, 492cf6614c
Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit rectifies earlier change:
in the lex... even inside quotes, a \ followed by space or tab should
expand to space or tab, and a \ followed by newline should be ignored
(as a line continuation). compatible with the needs of hoststated
(which has the most strict quoted string requirements), and ifstated
(where one commonly does line continuations in strings).
OK deraadt@, OK millert@
Obtained from: OpenBSD, sashan <sashan@openbsd.org>, a153335958
Sponsored by: Rubicon Communications, LLC ("Netgate")
Regression has been introduced in version 1.1024 (a 6.2 time frame).
It's been discovered and reported by Fabian Mueller-Knapp. Fair amount
of credit goes to kn@, benno@ and henning@ for pointing me to releveant
section of pf.conf(5). Fabian and kn@ also did test the patch.
OK kn@, henning@
Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 7e89334d42
Sponsored by: Rubicon Communications, LLC ("Netgate")
Replace hardcoded 0 and implicit checks with enum as done in all other
use cases of `pfra_fback'. No object change.
OK sashan
Obtained from: OpenBSD, kn <kn@openbsd.org>, ab23e671fc
Sponsored by: Rubicon Communications, LLC ("Netgate")
The function is unused since 5aedb8b1d4.
For information, in MMC CAM both XPT_GET_TRAN_SETTINGS and XPT_PATH_INQ
obtain data using MMC_SIM_GET_TRAN_SETTINGS. So, "overlapping"
information like ccb_trans_settings_mmc::host_max_data and
ccb_pathinq::maxio is derived from the same source.
That's why sdda_get_max_data was redundant.
Reported by: bz
MFC after: 5 days
Add halt as an alias to also poweroff a machine from the loader prompt,
this is consistent with ddb.
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51132
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI we only need to provide the debug macro to
allow us to compile in ACPI support.
This ties into regulatory and will be used, e.g., for 11ax, 11be,
and Per Platform Antenna Gain (PPAG) settings.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in
ACPI support.
Sponsored by: The FreeBSD Foundation
MFC after; 3 days
Since phk rewrote the block layer ~2 decades ago, write(2) can return
EINVAL when the target is a block device and nbytes, the write size, is
not a multiple of the sector's block size.
From the original PR:
When coming from Linux, people are surprised by the fact
that write(2) to a device must be aligned to block size.
Writing a non-aligned block onto a raw device is a case
where EINVAL is also returned but the manpage does not mention this.
MFC after: 3 days
PR: 227185
Reported by: riggs
Reviewed by: imp, Pau Amma <pauamma@gundo.com>
Differential Revision: https://reviews.freebsd.org/D51138
Add a acpi_evaluate_dsm() wrapper around the native implementation
as needd by wireless drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50864
Provide union acpi_(object|buffer) as linuxkpi_ versions and in Linux
native lower case spelling so that driver code compiles unmodified.
Use the linuxkpi_ prefix to avoid name clashes with the native ACPI
implementation which uses CamelCase.
Use the linuxkpi_ names internally and redefine the linuxkpi_ unions
to their native names so they are avail as expected in drivers.
As a transition to not break drm-kmod which has in-place (no #ifdef)
changes from Linux spelling ot FreeBSD spelling, introduce
LINUXKPI_WANT_LINUX_ACPI so we have the Linux spelling as an opt-in.
That way the transition can happen gracefully and once "top-of-trees"
are all sorted we can remove the #ifdefs here again.
Bump __FreeBSD_version to be able to detect this change.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: wulf (previous version), dumbbell
Differential Revision: https://reviews.freebsd.org/D50863
There are too many ways to call (*shutdown)() and others in Linux
it seems; rather than using the one from dev_pm_ops or directly
on the bus system device, some wireless drivers are setting it on
struct device_driver so add it.
Bump __FreeBSD_version as this changes the size of various other
structs which have struct device_driver embedded.
Sponsored by: The FreeBSD Foundation
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50679
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.
As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far. That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that. We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049
While we currently only use MODULE_DEVICE_TABLE() for pci (or so I
thought [*]), this may soon change. Remove a hard coded "pci" for
the bus and use the bus name passed in as _bus.
[*] see follow-up change
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51048
Setting this option tells AMD processors that targeted TLB invalidation
instructions, such as invlpg, only have to invalidate cached entries
from the upper levels of the page table that lie along the path to the
targeted virtual address. Otherwise, by default, all cached entries
from the upper levels of the page table are invalidated.
After unmapping a page table page we always perform a TLB invalidation
that will invalidate any cached references to that page table page, so
this option is safe to enable.
Reviewed by: kib, markj
Tested by: dougm
Differential Revision: https://reviews.freebsd.org/D51093
Such annotations are obsolete, the compiler tells us when parameters are
unused. No functional change intended.
Reviewed by: cem
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51114
Entropy queue entries always include the low 32 bits of a CPU cycle
count reading. Introduce a macro for this instead of hard-coding
get_cyclecount() calls everywhere; this is handy for testing purposes
since this way, random(4)'s use of the cycle counter (e.g., the number
of bits we use) can be changed in one place.
No functional change intended.
Reviewed by: cem, delphij
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51113
They can't be used externally, so it makes no sense to have them in a
header. No functional change intended.
Reviewed by: cem
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51111
Upgrade the FUSE API from protocol 7.33 to 7.35.
Add support for FOPEN_NOFLUSH, introduced in 7.35.
Also, reduce diffs vis-a-vis upstream by factoring out an ioctl type, a
change missed in d5e3cf41e8.
Signed-off-by: Claudiu I. Palincas <mscotty@protonmail.ch>
Reviewed by: asomers
Pull Request: https://github.com/freebsd/freebsd-src/pull/1744
The HWT framework provides infrastructure for hardware-assisted tracing. It
collects detailed information about software execution and records it as
"events" in highly compressed format into DRAM. The events cover information
about control flow changes of a program, whether branches taken or not,
exceptions taken, timing information, cycles elapsed and more. This allows
to reconstruct entire program flow of a given application.
This comes with separate machine-dependent tracing backends for trace
collection, trace decoder libraries and an instrumentation tool.
Reviewed by: kib (sys/kern bits)
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D40466