Tootfinder

Opt-in global Mastodon full text search. Join the index!

@jamesthebard@social.linux.pizza
2026-09-30 00:22:09

Hrmm, it seems that my initial efforts to generate custom JSON from a struct have been very ineffective. Gonna need to dig up more info on how to do this it seems...the battle continues...
#zig #driveInfo #json

A screenshot of the code responsible for generating custom JSON written in Zig that isn't all that effective.
@stf@chaos.social
2026-08-30 22:27:36

phew it* finally compiles! with #zig v0.16 (i know i'm a bit late) the #iocalypse was quite some effort to avert. now let's try to port #klutshnik** too
[*] zphinx server:

@jamesthebard@social.linux.pizza
2026-09-30 03:45:21

Hell yeah, finished up the GPT-side of the Zig driveinfo program. JSON output looks exactly like it's supposed to, and now to move the allocator back into the struct which will clean up stuff as well. I'll deal with the MBR-side tomorrow, but pretty happy to have figured this out.
#programming #zig

The `jsonStringify` code opened in VSCodium for the `GPTHeader`...and it even works!
@jamesthebard@social.linux.pizza
2026-09-30 01:30:12

After a bit of work, I think I've got a handle on getting this struct all JSON-ified. A bit of reflection in place and it's no longer very angry...also, the `inline` keyword is very damned important with respect to looping over the fields of the struct.
#zig #reflection

Some example code that writes `u64` values from the struct to a JSON writer via the `jsonStringify` function hanging off the struct.
@johl@mastodon.xyz
2026-07-09 16:19:16

Why the #Zig project bans all LLM contributions – How Open Source Survives the Age of Free Code
lumramabaja.com/posts/engineer

@jamesthebard@social.linux.pizza
2026-08-21 19:52:31

So, seems I have a new job lined up finally as I've signed the tentative offer letter. Also, still working with Zig and made progress with grabbing information from the Linux `sys` tree for sector/logical block sizes. Been a busy yet awesome day.
#zig #programming

A screenshot of four functions that work together to get the LB/sector size and overall block device size in Zig.  Even better, it doesn't leak memory...
@jamesthebard@social.linux.pizza
2026-08-23 18:14:23

Nothing like converting slices of `u8`s to `u16`s. The GPT partition names are all `UTF16LE` which makes things interesting...however, that part is done and scraping GPT information is working as expected.
#zig #gpt

A function to convert slices of `u8`s to `u16`s or basically any that is a multiple of `u8`s.  Even better, it actually works.
@stf@chaos.social
2026-09-04 14:00:24

woohoo, just pushed an update to the zphinx* server to build with #zig v0.16 - due to the #iocalypse this is quite a substantial patch:

@jamesthebard@social.linux.pizza
2026-08-13 20:48:39

The Zig journey continues, things get a bit cleaner and we're now parsing the primary partition entries in the MBR. Very nice...
#programming #zig

A screenshot of neovim with the primary partition parse code written in Zig.
@jamesthebard@social.linux.pizza
2026-08-22 16:22:14

Sometimes, you just need a nice standard-sized unsigned integer of exactly 48 bits...also, I think I hate UUIDs.
#zig #programming

The source code in VSCodium showing the `convertToUUID` function which breaks up a 16 byte array into five fields, byte-swaps the last two fields, then puts them together into a string.
@stf@chaos.social
2026-09-05 21:04:20

\o/ #klutshnik server now also builds with #zig v0.16 \o/

@jamesthebard@social.linux.pizza
2026-08-09 15:18:56

So, after searching far and wide on the internet I have managed to open a file from a command-line argument and read 10 bytes from it using Zig v0.16. I was not expecting it to be quite this complicated.
#programming #zig

A screenshot of the Zig source code that I wrote running in Neovim that opens a file and reads 10 bytes from a file then prints it to a screen.
@jamesthebard@social.linux.pizza
2026-08-14 00:03:42

Holy crap, I have to be missing something with respect to HashMap construction...I officially have all of the `try put` statements...lol. It does work though, and now the primary MBR partitions have appropriate partition type descriptions.
#zig #programming

ALL OF THE MBR PARTITION TYPE KEY/VALUE PAIRS in Zig.
@stf@chaos.social
2026-09-01 22:47:47

E pur si compilio!
#zig v0.16 #klutshnik

@jamesthebard@social.linux.pizza
2026-08-12 20:30:11

Moar progress, will probably move this into the struct along with MBR reconstruction from the struct. This might actually end up doing a bit of `fdisk` stuff...
#zig #programming #mbr

MBR breakdown in Zig via `neovim`.
@jamesthebard@social.linux.pizza
2026-08-14 18:27:07

More progress. I've got the entire MBR processing finished up with a ton of cleanup. Processing the extended partition entries is always fun, but after a fixing a few dumb mistakes everything is parsing out correctly. Even better: no memory leaks.
#zig #programming

Source code in VSCodium showing part of the MBR partition processing section.  The bottom pane shows the current partition struct output from the run against a test file with 3 primary and 4 extended partitions.
@jamesthebard@social.linux.pizza
2026-08-12 03:49:19

So, after some consideration I decided to break out the block device reading operations out into its own module. Also, the returned data is now in a struct with a `.deinit` method that will handle cleanups. It might be more complicated than necessary, but it's clean.
#zig #programming

A screenshot of the new `dataops` module showing the buffer struct along with the `getData` function.  It even compiles!