Skip to content

switch subvolume_list parser to --format json once it's out of experimental #41

Description

@danneu

Context

btrfs subvolume list supports --format json, but it's gated behind #if EXPERIMENTAL in btrfs-progs (cmds/subvolume-list.c:1747). Standard nixpkgs builds don't pass --enable-experimental, so the JSON flag is unavailable.

Our parse_btrfs_subvolume_list nom text parser works but is fragile — any change to btrfs-progs text formatting could break it silently.

What to do

When btrfs-progs promotes subvolume list --format json out of experimental:

  1. Switch BtrfsSubvolumeList in cmd.rs to pass --format json
  2. Rewrite cli/src/parse/btrfs_subvolume_list.rs from nom to serde_json
  3. Follow the same pattern used for the device stats JSON migration

JSON schema (from current experimental source)

{
  "__header": { "version": "1" },
  "subvolume-list": [
    {
      "id": 256,
      "generation": 30,
      "top_level": 5,
      "path": "data"
    }
  ]
}

Field names from cmds/subvolume-list.c rowspec: id (u64), generation (u64), top_level (u64), path (string). Additional fields appear when CLI flags like -u, -p, -g are used.

Tracking

Watch btrfs-progs releases for the #if EXPERIMENTAL guard being removed from subvolume list.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions