I had a look at the code for btrfsck. My first impression was:
OMG! This has 3,500 lines of code with a total of 20 comments!
It returns negative errno numbers as exit codes. The 'main' function
literally contains lines like 'return -EIO;' I've no idea wtf they
were thinking there. There are also regular exit codes (calls to
'exit (1);' and 'return 1;'). Since the return codes are effectively
random, there doesn't seem to be any meaning behind the values,
unlike regular fsck.
It doesn't appear to be interactive.
It looks as if stderr is used correctly for error messages.
There are some command line options which we should bind. I think our
binding should use optional arguments which will allow us some room
for growth in future. We should start by binding at least the
'--super <int64>' and '--repair' options.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v