Here is a rough version of how I was thinking it might be possible to have a
common file for ubd_user.c and uml_moo.c, this version compiles but that is
about it, however it should show what I am thinking of, and can produce
comments on what might be better, or what blind ally I am heading down.
Basically I was thinking that the pread/pwrite functions provide a model
and when opened the file should setup the device info, and the read/write
should deal with sparse, copyback etc. Currently open is producing a mess
but that was expected, read/write seem to be falling out well, offset and
count are in units of sectors unlike normal pread/pwrite.
Almost all math and I/O should be done with 64bit types... currently 2TiB is
rather large but not very expensive, it is much easier to test with a sparse
file on uml than to build up a real 2TiB disk setup. Soon of course we will
be seeing 2TiB disks.
The v3 header is just a test header I was using to stuff full of everything
I think might be used as a header.
This also uses more extensive union, by the way the header union is over 4K
as a local var.
The sparse testing first checks if the block to be output is zero and then
checks if the output file already has something non-zero there.
The open function is still missing several cases.
1 open a plain file
2 open a exisiting COW file
3 open a new COW file given a backing file
4 open a exisiting COW file with new location for backing file
5 open a existing COW file for combination with backing file for new output
6 open a existing COW file for combination with backing file in place.
7 exotic cases (not currently) like having a COW header on a otherwise plain
file for things like C:H:S
Any more cases to worry about?
Get latest updates about Open Source Projects, Conferences and News.