History log of /freebsd-current/sys/compat/linsysfs/linsysfs.c
Revision Date Author Comments
# 88362a00 18-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linsysfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

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


# 7ae0972c 03-Apr-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linsysfs(4): Reimplement listnics() using ifAPI

Handle if arrival/departure events and VNETs.

Differential Revision: https://reviews.freebsd.org/D38901
MFC after: 1 month
XMFC with: ifAPI, pseudofs


# f94b5734 31-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

Revert "linsysfs(4): Reimplement listnics() using ifAPI"

This reverts commit 0b56641cfcda30d06243223f37781ccc18455bef.

As it poorly interacts with vnet subsystem


# 1f0c8bfd 25-Mar-2023 Vico Chen <vico.chern_qq.com>

linsysfs(4): Keep Linux compatible sysfs the same as Ubuntu

By checking Ubuntu, there is no `/sys/subsystem' in sysfs. To compatible
with Ubuntu, delete the 'subsystem' creation in Linux compatible module.

On the other hand, the sysfs `/sys/subsystem' cause failure for some
Linux udev cases. In Linux udev source code, there is a function named
`scan_devices_all', and it will scan `/sys/subsystem' if it is existed,
but now there are nothing in /sys/subsystem `, and it returns empty
to cause some use cases failed.

Reviewed by: dchagin
Differential Revision: https://reviews.freebsd.org/D38885
MFC after: 1 month
XMFC with: ifAPI


# 0b56641c 25-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linsysfs(4): Reimplement listnics() using ifAPI

Handle if arrival/departure events.

Reviewed by: melifaro (early version)
Differential Revision: https://reviews.freebsd.org/D38901
MFC after: 1 month
XMFC with: ifAPI


# 5d5b633d 03-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linsysfs(4): Refactor to avoid referencing an unstable interfaces

Enter the net epoch when traversing a list of interfaces. For that
split the ifname_linux_to_bsd() function on two counterparts, where
the ifname_linux_to_ifp() intended to use in epoch, while the
ifname_linux_to_bsd() intended to be a self-contained.
Until the linux_ioctl_coket() function is refactored, the
ifname_linux_to_bsd() temporarily returns interface outside
of the net epoch.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38790


# 130383f2 03-Mar-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Make linux_ifflags return a value

To simplify the use of the function in the printf-like statements.

Differential Revision: https://reviews.freebsd.org/D38830


# c50f70b5 02-Feb-2023 Justin Hibbits <jhibbits@FreeBSD.org>

linsysfs: Use IfAPI accessors

Replace the only two ifnet member accesses with IfAPI accessor calls.

Sponsored by: Juniper Networks, Inc.


# bafe3b88 31-Mar-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linsysfs: plug set-but-not-used vars.

MFC after: 2 weeks


# dc0119c2 08-Mar-2021 Edward Tomasz Napierala <trasz@FreeBSD.org>

linsysfs: create /sys/bus/ and /sys/subsystem/

This looks like a no-op, but it prevents udevadm(8) with failing
loudly, which in turn unbreaks installation of libfprint-2-2, which
in Focal is a dependency for make-4.2.1-1.2.

One might wonder why installing a build utility involves messing
with device handling...

Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29133


# 46888ded 03-Sep-2020 Mark Johnston <markj@FreeBSD.org>

Add emulation support for the Linux kcov(4) ioctl API.

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


# 8b99a63f 04-Jul-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5)
create /sys/class/power_supply/. This silences some warnings
from biology/linux-foldingathome.

Reported by: 0mp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25557


# 55258ab0 22-Sep-2019 Tijl Coosemans <tijl@FreeBSD.org>

Create a "drm" subdirectory for drm devices in linsysfs. Recent versions of
linux libdrm check for the existence of this directory:

https://cgit.freedesktop.org/mesa/drm/commit/?id=f8392583418aef5e27bfed9989aeb601e20cc96d

MFC after: 2 weeks


# 52a9e429 06-May-2019 Dmitry Chagin <dchagin@FreeBSD.org>

Remove wrong copyright line. Discussed with Carlos Neira.

Reported by: Rodney W. Grimes
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13656


# 4e2f69f1 06-May-2019 Dmitry Chagin <dchagin@FreeBSD.org>

Adds sys/class/net devices to linsysfs.

Only two interfaces are created eth0 and lo and they expose
the following properties:
address, addr_len, flags, ifindex, mty, tx_queue_len and type.

Initial patch developed by Carlos Neira in 2017 and finished by me.

PR: 223722
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13656


# 03ddf624 02-May-2019 Dmitry Chagin <dchagin@FreeBSD.org>

Remove unneeded includes.

MFC after: 2 week


# 12f3888a 02-May-2019 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add sys/devices/system/cpu/{possible,present} to linsysfs(5).
That makes Linux lscpu(1) work.

Reviewed by: dchagin
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20131


# 971b5f76 07-Jul-2018 Warner Losh <imp@FreeBSD.org>

Create PCI_MATCH and pci_match_device

Create a covenience function to match PCI device IDs. It's about 15
years overdue.

Differential Revision: https://reviews.freebsd.org/D15999


# bbc82947 18-Jun-2018 Ed Maste <emaste@FreeBSD.org>

linsysfs: depend on linux_common module on arm64, as on amd64

Sponsored by: Turing Robotic Industries


# 0e5c6bd4 04-May-2018 Jamie Gritton <jamie@FreeBSD.org>

Make it easier for filesystems to count themselves as jail-enabled,
by doing most of the work in a new function prison_add_vfs in kern_jail.c
Now a jail-enabled filesystem need only mark itself with VFCF_JAIL, and
the rest is taken care of. This includes adding a jail parameter like
allow.mount.foofs, and a sysctl like security.jail.mount_foofs_allowed.
Both of these used to be a static list of known filesystems, with
predefined permission bits.

Reviewed by: kib
Differential Revision: D14681


# 7f2d13d6 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/compat: further adoption of SPDX licensing ID tags.

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.


# 03cea61b 15-Oct-2017 Tijl Coosemans <tijl@FreeBSD.org>

Add information needed by Linux libdrm 2.4.74 (shipped with CentOS 7.4).

Create a config file for PCI devices that exposes their configuration
space. Only fields needed by libdrm are filled in (vendor, device,
revision, subvendor and subdevice).

Link /sys/class/drm/card%d/device to the PCI device directory.


# df4c9752 15-Oct-2017 Tijl Coosemans <tijl@FreeBSD.org>

Set DEVNAME to dri/card%d. This works with both in-tree drm and drm-next
and is also the value used on Linux.

Tested by: Greg V <greg@unrelenting.technology>


# 2e6418c0 18-Sep-2017 Ryan Libby <rlibby@FreeBSD.org>

linsysfs: quiet gcc -Wformat after r323692

Reviewed by: cem
Sponsored by: Dell EMC Isilon


# 4d367f25 18-Sep-2017 Conrad Meyer <cem@FreeBSD.org>

linsysfs(5): Fix two unrelated issues

1. Swap the order of device_get_ivars with device_get_devclass and devclass
name validation. This bug was introduced in r323692.

2. Error check device_get_children and free the returned list. This bug was
introduced in the original linsysfs commit.

Reported by: Oleg V. Nauman <oleg AT theweb.org.ua>, hselasky (1); hselasky (2)
Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12407


# 2d347b2e 17-Sep-2017 Conrad Meyer <cem@FreeBSD.org>

linsysfs(5): Add support for recent libdrm

Expose more information about PCI devices (and GPUs in particular) via
linsysfs to libdrm.

This allows unmodified modern 64-bit Linux libdrm to work, which allows
modern Linux Mesa to work. The submitter reports that he tested the change
with an Ubuntu 16.04 chroot + amdgpu from graphics/drm-next-kmod.

PR: 222375
Submitted by: Greg V <greg AT unrelenting.technology>


# 039aba08 18-Mar-2017 Dmitry Chagin <dchagin@FreeBSD.org>

Glibc get_nprocs() and get_nprocs_conf() uses the sysfs cpu infrastructure
to get number of processors. Implement /sys/devices/system/cpu/.

MFC after: 1 month


# f19e47d6 19-Jul-2015 Marcelo Araujo <araujo@FreeBSD.org>

Add support to the jail framework to be able to mount linsysfs(5) and
linprocfs(5).

Differential Revision: D2846
Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com>
Reviewed by: jamie


# 67d39748 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Introduce a new module linux_common.ko which is intended for the
following primary purposes:

1. Remove the dependency of linsysfs and linprocfs modules from linux.ko,
which will be architecture specific on amd64.

2. Incorporate into linux_common.ko general code for platforms on which
we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).

3. Move malloc(9) declaration to linux_common.ko, to enable getting memory
usage statistics properly.

Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c
and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.

Temporarily remove dtrace garbage from linux_mib.c and linux_util.c

Differential Revision: https://reviews.freebsd.org/D1072
In collaboration with: Vassilis Laganakos.

Reviewed by: trasz


# eedc7fd9 26-Oct-2013 Gleb Smirnoff <glebius@FreeBSD.org>

Provide includes that are needed in these files, and before were read
in implicitly via if.h -> if_var.h pollution.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


# 41c0675e 28-Feb-2012 Martin Matuska <mm@FreeBSD.org>

Add procfs to jail-mountable filesystems.

Reviewed by: jamie
MFC after: 1 week


# 36b0a373 15-Nov-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

Remove no-op assignment.

Submitted by: clang via arundel@
MFC after: 2 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 771709eb 11-Mar-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Add a pn_destroy field to pfs_node. This field points to a destructor
function which is called from pfs_destroy() before the node is reclaimed.

Modify pfs_create_{dir,file,link}() to accept a pointer to a destructor
function in addition to the usual attr / fill / vis pointers.

This breaks both the programming and binary interfaces between pseudofs
and its consumers. It is believed that there are no pseudofs consumers
outside the source tree, so that the impact of this change is minimal.

Submitted by: Aniruddha Bohra <bohra@cs.rutgers.edu>


# 5ac73157 03-Dec-2006 Alexander Leidinger <netchild@FreeBSD.org>

MFP4 (110957)

Use TAILQ_FOREACH_SAFE instead of the unsafe one where an item is removed
from the queue.

This prevents a panic on kldunload.

Submitted by: rdivacky
Tested by: bsam


# 0b1c2334 11-May-2006 Doug Ambrisko <ambrisko@FreeBSD.org>

Remove the dependency on procfs since it isn't used.

Noticed by: des


# 32397ce0 09-May-2006 Doug Ambrisko <ambrisko@FreeBSD.org>

Add in linsysfs. A linux 2.6 like sys filesystem to pacify the Linux
LSI MegaRAID SAS utility.

Sponsored by: IronPort Systems
Man page help from: brueffer