sizeof(struct ntfs_location));
if (new->ntfs_loc == NULL)
goto out_free;
- new->ntfs_loc->path = STRDUP(old->ntfs_loc->path);
- new->ntfs_loc->attr_name = NULL;
- if (new->ntfs_loc->path == NULL)
- goto out_free;
- if (new->ntfs_loc->attr_name_nchars != 0) {
+ if (new->ntfs_loc->attr_name != NULL) {
new->ntfs_loc->attr_name =
- utf16le_dup(old->ntfs_loc->attr_name);
+ utf16le_dup(new->ntfs_loc->attr_name);
if (new->ntfs_loc->attr_name == NULL)
goto out_free;
}
#ifdef WITH_NTFS_3G
case BLOB_IN_NTFS_VOLUME:
if (blob->ntfs_loc) {
- FREE(blob->ntfs_loc->path);
FREE(blob->ntfs_loc->attr_name);
FREE(blob->ntfs_loc);
}
return tstrcmp(blob1->file_on_disk, blob2->file_on_disk);
#ifdef WITH_NTFS_3G
case BLOB_IN_NTFS_VOLUME:
- return tstrcmp(blob1->ntfs_loc->path, blob2->ntfs_loc->path);
+ return cmp_u64(blob1->ntfs_loc->mft_no, blob2->ntfs_loc->mft_no);
#endif
default:
/* No additional sorting order defined for this resource
loc->attr_name,
loc->attr_name_nchars);
if (!na) {
- ERROR_WITH_ERRNO("Failed to open attribute of \"%"TS"\" in "
- "NTFS volume", loc->path);
+ ERROR_WITH_ERRNO("Failed to open attribute of NTFS inode %"PRIu64,
+ loc->mft_no);
}
return na;
}
int ret;
u8 buf[BUFFER_SIZE];
- ni = ntfs_pathname_to_inode(vol, NULL, loc->path);
+ ni = ntfs_inode_open(vol, loc->mft_no);
if (!ni) {
- ERROR_WITH_ERRNO("Can't find NTFS inode for \"%"TS"\"", loc->path);
+ ERROR_WITH_ERRNO("Failed to open NTFS inode %"PRIu64,
+ loc->mft_no);
ret = WIMLIB_ERR_NTFS_3G;
goto out;
}
while (bytes_remaining) {
s64 to_read = min(bytes_remaining, sizeof(buf));
if (ntfs_attr_pread(na, pos, to_read, buf) != to_read) {
- ERROR_WITH_ERRNO("Error reading \"%"TS"\"", loc->path);
+ ERROR_WITH_ERRNO("Error reading data from NTFS inode "
+ "%"PRIu64, loc->mft_no);
ret = WIMLIB_ERR_NTFS_3G;
goto out_close_ntfs_attr;
}
blob->size = data_size;
blob->ntfs_loc->ntfs_vol = vol;
blob->ntfs_loc->attr_type = type;
- blob->ntfs_loc->path = memdup(path, path_len + 1);
- if (unlikely(!blob->ntfs_loc->path)) {
- ret = WIMLIB_ERR_NOMEM;
- goto out_cleanup;
- }
+ blob->ntfs_loc->mft_no = ni->mft_no;
if (unlikely(name_nchars)) {
blob->ntfs_loc->attr_name = utf16le_dup(stream_name);