以下のコマンドを実行すると、指定された btrfs パーティション内のサブボリュームのリストを取得する便利な API が c に必要です。
btrfs サブボリューム リスト btrfs/subvol/path
以下のコマンドを実行すると、指定された btrfs パーティション内のサブボリュームのリストを取得する便利な API が c に必要です。
btrfs サブボリューム リスト btrfs/subvol/path
便利な API が見つからない場合は、次のpopenものが必要です。
#include <stdio.h>
FILE *popen(const char *command, const char *mode);
int pclose(FILE *stream);
int main(void)
{
FILE *cmd = popen("btrfs subvolume list btrfs/subvol/path", "r");
char result[128];
while (fgets(result, sizeof(result), cmd) != NULL)
printf("%s", result);
pclose(cmd);
return 0;
}