diff --git a/include/ntfs-3g/attrib.h b/include/ntfs-3g/attrib.h index 419937c1..eafa165a 100644 --- a/include/ntfs-3g/attrib.h +++ b/include/ntfs-3g/attrib.h @@ -185,7 +185,8 @@ struct _ntfs_attr { }; /** - * enum ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure + * enum ntfs_attr_state_bits - bits for the state field in the ntfs_attr + * structure */ typedef enum { NA_Initialized, /* 1: structure is initialized. */ diff --git a/include/ntfs-3g/inode.h b/include/ntfs-3g/inode.h index c1f5b216..c7f1186e 100644 --- a/include/ntfs-3g/inode.h +++ b/include/ntfs-3g/inode.h @@ -128,7 +128,13 @@ struct _ntfs_inode { }; /* Below fields are valid only for base inode. */ - s64 data_size; /* Data size stored in the filename index. */ + + /* + * These two fields are used to sync filename index and guaranteed to be + * correct, however value in index itself maybe wrong (windows itself + * do not update them properly). + */ + s64 data_size; /* Data size of unnamed DATA attribute. */ s64 allocated_size; /* Allocated size stored in the filename index. (NOTE: Equal to allocated size of the unnamed data attribute for normal or @@ -136,6 +142,11 @@ struct _ntfs_inode { of the unnamed data attribute for sparse or compressed files.) */ + /* + * These four fields are copy of relevant fields from + * STANDARD_INFORMATION attribute and used to sync it and FILE_NAME + * attribute in the index. + */ time_t creation_time; time_t last_data_change_time; time_t last_mft_change_time; diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 2f8abbec..87aa2e18 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -500,7 +500,7 @@ void ntfs_attr_close(ntfs_attr *na) * @na: ntfs attribute for which to map (part of) a runlist * @vcn: map runlist part containing this vcn * - * Map the part of a runlist containing the @vcn of an the ntfs attribute @na. + * Map the part of a runlist containing the @vcn of the ntfs attribute @na. * * Return 0 on success and -1 on error with errno set to the error code. */ @@ -543,8 +543,8 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) * ntfs_attr_map_whole_runlist - map the whole runlist of an ntfs attribute * @na: ntfs attribute for which to map the runlist * - * Map the whole runlist of an the ntfs attribute @na. For an attribute made - * up of only one attribute extent this is the same as calling + * Map the whole runlist of the ntfs attribute @na. For an attribute made up + * of only one attribute extent this is the same as calling * ntfs_attr_map_runlist(na, 0) but for an attribute with multiple extents this * will map the runlist fragments from each of the extents thus giving access * to the entirety of the disk allocation of an attribute. @@ -2992,7 +2992,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) NInoAttrListClearDirty(base_ni); } - /* Free MFT record, if it isn't contain attributes. */ + /* Free MFT record, if it doesn't contain attributes. */ if (le32_to_cpu(ctx->mrec->bytes_in_use) - le16_to_cpu(ctx->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(ni->vol, ni)) { @@ -3254,7 +3254,7 @@ rm_attr_err_out: (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) ntfs_log_perror("Failed to remove just added attribute #2"); free_err_out: - /* Free MFT record, if it isn't contain attributes. */ + /* Free MFT record, if it doesn't contain attributes. */ if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - le16_to_cpu(attr_ni->mrec->attrs_offset) == 8) if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) diff --git a/libntfs-3g/inode.c b/libntfs-3g/inode.c index b0b900a6..e1c2e33f 100644 --- a/libntfs-3g/inode.c +++ b/libntfs-3g/inode.c @@ -262,6 +262,8 @@ err_out: * If it is an extent inode, we disconnect it from its base inode before we * destroy it. * + * It is OK to pass NULL to this function, it is just noop in this case. + * * Return 0 on success or -1 on error with errno set to the error code. On * error, @ni has not been freed. The user should attempt to handle the error * and call ntfs_inode_close() again. The following error codes are defined: diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index c117e518..07a4dfc0 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -79,7 +79,6 @@ ntfs_volume *ntfs_volume_alloc(void) return ntfs_calloc(sizeof(ntfs_volume)); } - static void ntfs_attr_free(ntfs_attr **na) { if (na && *na) {