Hi all,
As of today, we have a working ntfstruncate utility! (It can only resize
downwards and only non-encrypted, non-compressed attributes in inodes
that do not contain attribute lists but its a good start IMO!)
To build it ./configure and make as usual and then cd ntfsprogs and make
ntfstruncate, i.e. it is not built by default.
Note all the functionality is in the library, see the ChangeLog for
details and the sources for the functions and descriptions of how to use
it.
Basically you ntfs_mount() a volume, then you open the inode you want to
be truncating using ntfs_inode_open(), then you open the attribute you
want to truncate using ntfs_attr_open(), and now you can call
ntfs_attr_truncate() which will do everything for you. (-:
To cleanup, ntfs_attr_close(), ntfs_inode_close() and ntfs_umount() and
all is done.
Have fun! Comments on the API, internals, etc, welcome. Also most welcome
are contributions to extend the functions (there are plenty of TODOs and
FIXMEs in there!) so they can work on inodes with attribute lists, so they
convert a zero length non-resident attribute to a resident one, so they
work to enlarge attributes by adding sparse runs, too, etc... I have
pretty much run out of spare time for the next two weeks so you can be
sure not to tread on my toes for the time being if you want to contribute
code... (-; Only one note, please leave the ntfs_cluster_alloc() as well
as the in future required ntfs_mft_record_alloc() to me as I have those
written already for the old ntfs driver and I just need to port them and
adapt them to the library and we will have fully functional allocators for
both. (Note the allocators are quite complex as they properly obbey the
MFT zone and the resulting DATA zones which makes them good allocators
-- at least as far as good is defined as being close to what windows
does -- so there is no point in anyone else spending time to reinvent
the wheel).
Merry Christmas and a Happy New Year!
Anton
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
|