Hi!

On Wed, 2022-08-03 at 14:50:42 -0700, Matt Taggart wrote:
> Here are some notes about documenting sysfs.conf
> 
> * sysfs(2) is about the syscall and isn't helpful in this context
> * sysfs(5) (in manpages package) explains a little about sysfs, but not how
> to interact with it.
> * The kernel documentation
> https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt is targetted
> at people writing sysfs interfaces and mostly not useful, but mentions that
> interfaces need to be documented in ABI
> https://www.kernel.org/doc/Documentation/ABI/stable/ and that might be
> useful to mention as a place where users can read about how to interact with
> various parts.
> * The default delivered sysfs.conf file has some comments at the top about
> general syntax and examples.
> * should document /etc/sysfs.d/ and how to use it (load order, etc)
> * should maybe explain the difference between sysfs and sysctl
> 
> So I think a sysfs.conf manpage could be pretty simple, mostly the comments
> already in the default file and some pointers to the other places.

Thanks for these notes! A nice start incentive. :)

What about something like the attached page?

Thanks,
Guillem
# sysfs.conf manual page (sysfs.conf.5)
#
# Copyright © 2022 Guillem Jover <[email protected]>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

=encoding utf8

=head1 NAME

sysfs.conf - Linux sysfs attributes setting configuration file

=head1 DESCRIPTION

These configuration files can be used to set B<sysfs> attribute values,
modify their file mode or owner, during the system boot.

These file are concerned with the F</sys> filesystem and should not be
confused with the F</etc/sysctl.conf> configuration which is concerned
with F</proc/sys> filesystem instead.

=head1 FORMAT

The syntax consists on a series of line based directives for F<sysfs>
attributes, those being pathnames within that filesystem, with the
following format:

=over 4

=item I<attribute> = I<value>

Set I<value> for the F<sysfs> I<attribute>.

=item B<mode> I<attribute> = I<mode>

Set the I<mode> for the F<sysfs> I<attribute>.
Where I<mode> is any mode accepted by L<chmod(1)>.

=item B<owner> I<attribute> = I<owner>[:I<group>]

Set the I<owner> (and/or I<group>) for the F<sysfs> I<attribute>.
Where I<owner> (and/or I<group>) are any specification accepted by
L<chown(1)>.

=back

Leading and trailing spaces, and spaces around the B<=> character are
ignored.

Comments start with a B<#> character until the end of line.
Empty or space-only lines are also ignored.

=head1 FILES

=over

=item F</etc/sysfs.conf>

The main configuration file.
It gets loaded first if readable.

=item F</etc/sysfs.d/*.conf>

The optional configuration fragment files.
These get loaded after the main configuration file, if readable,
in glob order.

=back

=head1 EXAMPLES

Always use the powersave CPU frequency governor.

  devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave

Use userspace CPU frequency governor and set initial speed.

  devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
  devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000

Set permissions of suspend control file.

  mode power/state = 0660
  owner power/state = root:power

=head1 SEE ALSO

L<sysfs(5)>,
L<https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt>,
L<https://www.kernel.org/doc/Documentation/ABI/stable/>.

Reply via email to