Posts
4545
Following
317
Followers
476
Linux kernel hacker and maintainer etc.

OpenPGP: 3AB05486C7752FE1

Jarkko Sakkinen

Edited 14 days ago
derive_more is a gem when it comes to rust crates

makes is so much less involved
0
0
0
@aakoskin I.e. I autolabeled USB topology in real-time (through uevents and udev database) and had a way to set labels and yeah ... not very smart :-)
0
0
0
@aakoskin It is but I somehow "knowingly" realized this while working on with USB stack as such a huge limitation :-) so yeah, this is stating the obvious if you want to put it that way.
1
0
0

Jarkko Sakkinen

Edited 14 days ago
USB is interesting in the way that identifying USB devices is a non-existent feature.

E.g., a librarian for USB mass storage would have to base identifying to filesystem labels, and obviously user would have to have a process for labeling for that to actually work.

And if a malicious stick is attached, as long as it provides sane description of itself (i.e. naming a legit device, vendor, class etc.), computer can't tell the difference.
1
0
0

Jarkko Sakkinen

Edited 16 days ago

This is as done as lsiommu can ever be, or at least as far as I’m concerned so it’s a release time:

https://github.com/puavo-org/lsiommu/releases/tag/1.0.0

I.e. I spent last night making it do less from the almost nothing it was doing already ;-) That’s the point of these tools…

That enumerated to:

  • Reverted back to heap sort.
  • Carved 64 kB of data section for JSON builder.
  • Hammered STRING_BUFFER() to migrate most of the strings to stack (except JSON builder
  • Bunch of fixes…

This sums up to zero mallocs from the main application (while libudev probably does bunch of them when not compiled with make DISCOVER=sysfs).

Motivation to do was this shitty python script:

#!/usr/bin/env python3
#
# Copyright (c) 2022-2023 Jarkko Sakkinen <jarkko.sakkinen@iki.fi>

import os
import sys

IOMMU_SYSFS = '/sys/kernel/iommu_groups'
IOMMU_GROUP_MAX = 128 # an arbitrary choice

def get_iommu_devices():
    groups = [None for group in range(IOMMU_GROUP_MAX)]

    with os.scandir(IOMMU_SYSFS) as group_it:
        for group in group_it:
            devices = []

            group_sysfs = IOMMU_SYSFS + '/' + group.name + '/devices'
            with os.scandir(group_sysfs) as device_it:
                for device in device_it:
                    devices.append(device.name)

            index = int(group.name)
            if index >= IOMMU_GROUP_MAX:
                print('Overflow')
                sys.exit(1)

            groups[index] = devices

    return groups

if __name__ == "__main__":
    groups = get_iommu_devices()

    for i in range(len(groups)):
        group = groups[i]
        if group == None:
            break

        print('IOMMU Group %d' % (i))

        group.sort()

        for device in group:
            # FIXME: Replace with pure Python code:
            os.system('lspci -nns ' + device)

#linux #kernel #iommu #kvm

0
0
0

Jarkko Sakkinen

I'm happy now with mailweb for my own needs but I wrote down in detail the tasks for expanding it to TUI file managers:

https://codeberg.org/jarkko/mailweb/issues

I could easily cope with approaches if it makes sense to me. I just wrote, mainly as a reminder, steps to a working implementation done if I really had to :-)
0
0
0

Jarkko Sakkinen

i'll add text/plain support to mailweb in the next update. it's obsolete feature for mutt or aerc but for file manager such as midnight command and ranger that'll make it a generic email file opener as it shows eml/mbox files correctly (i.e. with pics not cids).

With "--browse" it just forwards the result to the mime handler.
0
0
0

Jarkko Sakkinen

i wanted to change the name of my html mail tool multidepart as it is used by some funding organization or similar:

https://www.eiturbanmobility.eu/projects/multidepart/

the new name is mailweb as it is a tool that literally does that i.e., it converts text/html mail to a static website (despite archaic) ;-)

https://crates.io/crates/mailweb

also bumped the minor to add clarity for the change.
0
0
0

Jarkko Sakkinen

Through some indeterministic process that I don't understand from time to time I have to "warn up" gpg to not fail on "git tag -s" like this:

❯ git tag -s ihatemylife
error: gpg failed to sign the data
error: unable to sign the tag
The tag message has been left in .git/TAG_EDITMSG

~/work/codeberg.org/jarkko/multidepart main ⇡
❯ gpg -s README.md

After the latter command, tag signing suddenly works.

#git #gpg #yubikey
0
0
1
improvements with less confusing lifetimes for async is definitely a thing for me. i've been doing about 2.5-5 k line systemd daemon for a lttile while and there's a few places where i need to weird shit for compiler. i'm only now learning 2024 features but this was that i was hoping for. in some (luckily rare) cases it is not really about not grabbing borrow check, lifetimes or whatever. i need to check if i simplify some locations :-)
0
0
0

Jarkko Sakkinen

i've been using 2021 edition of rust up until now because i only now realized that i need to run rustup update occasionally :-)

i was wondering for months shouldn't 2024 be out and why i'm stuck with 2021 edition lol.

rust starts to be mature enough that probably once next version is debian is out i start to use distro toolchain (if kernel requires newer my [buildroot](https://codeberg.org/jarkko/linux-tpmdd-test) shenanigans will provide me a toolchain :-) ), which is like where any native language should evolve.

this is what i do with python i.e., work in the limits of distribution packaged stuff. it makes software translate more easily and your upstream is in a way always ready for packaging.
1
1
1

Jarkko Sakkinen

great now the deps are in the reasonable level for this type of tool :-) (and meson replaced with plain make).

using cjson was not a great idea in the first place as when doing json output for small and trivial low-level tools like this instead of dumping big continuous json string is also really the best option (vs pretty printing).

maybe i soon tag a release and put this debian packaging pipeline :-)
0
0
0
@cehteh @codrusofathens i don't think i have any use for these trait tutorials (just saying). i've disassembled enough rust binaries by now what kind of assembly code those construct generate. having a de-facto choice is not same as ultimate choice or a choice that could not change (based on testing that brings to light actual performance regressions not theoretical language spec based).
2
0
0
@gregkh yeah it sounds like it :-)
0
0
0

Jarkko Sakkinen

Edited 18 days ago

I’m using mutt so need to ask this before updating readme.

This what I have for mutt:

macro index F10 "<pipe-message>multidepart --browse\n" "View HTML in browser"
macro pager F10 "<pipe-message>multidepart --browse\n" "View HTML in browser"

This is what I presume would be correct for aerc (in ~/.config/aerc/binds.conf):

[messages]
F10= :pipe -p multidepart --browse<Enter>
[view]
F10= :pipe -p multidepart --browse<Enter>

Does that look about right?

#aerc #mutt #email #html

1
0
1
I'd figure this is easy to configure to aerc too but unfortunately i'm no longer using it and have returned back to mutt.
0
0
0

Jarkko Sakkinen

Edited 18 days ago
Something i had forgotten from crates.io: never use "license-file" in Cargo.toml. It's broken, and crates.io leaves the license undefined.
1
0
0
Show older