Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Does any one know if ntfs-3g driver implements change journal? I checked official website but couldn't find any information re. USN.

share|improve this question
add comment

migrated from stackoverflow.com Mar 13 '11 at 12:53

This question came from our site for professional and enthusiast programmers.

1 Answer

I'm not finding much documentation for USN + ntfs-3g, but looking through the ntfs-3g sources, in include/ntfs-3g/layout.h, I found the following:

/**
 * struct NTFS_RECORD -
 *
 * The Update Sequence Array (usa) is an array of the u16 values which belong
 * to the end of each sector protected by the update sequence record in which
 * this array is contained. Note that the first entry is the Update Sequence
 * Number (usn), a cyclic counter of how many times the protected record has
 * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All
 * last u16's of each sector have to be equal to the usn (during reading) or
 * are set to it (during writing). If they are not, an incomplete multi sector
 * transfer has occurred when the data was written.
 * The maximum size for the update sequence array is fixed to:
 *    maximum size = usa_ofs + (usa_count * 2) = 510 bytes
 * The 510 bytes comes from the fact that the last u16 in the array has to
 * (obviously) finish before the last u16 of the first 512-byte sector.
 * This formula can be used as a consistency check in that usa_ofs +
 * (usa_count * 2) has to be less than or equal to 510.
 */
typedef struct {
      NTFS_RECORD_TYPES magic;/* A four-byte magic identifying the
                           record type and/or status. */
      u16 usa_ofs;            /* Offset to the Update Sequence Array (usa)
                           from the start of the ntfs record. */
      u16 usa_count;          /* Number of u16 sized entries in the usa
                           including the Update Sequence Number (usn),
                           thus the number of fixups is the usa_count
                           minus 1. */
} __attribute__((__packed__)) NTFS_RECORD;

(See also: struct STANDARD_INFORMATION's usn field)

So apparently they are using USNs, but I don't know the proper way to get at them. I'd start by looking at how NTFS_RECORD is used, and try to work your way out the the API from there.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.