cas: use tmpfile when writing into disk store

Instead of writing into a temporary disk store, calculating the hash,
and then rewriting into a new entry in the diskstore with the hash as
the key, write to a tempfile on disk outside the store and then use the
new Import method to move the file into the store.
cas: use subdirectory for tmp files
Merge pull request #280 from jonboulle/cas_move

cas: use tmpfile when writing into disk store