"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libntfs-3g/object_id.c" between
ntfs-3g_ntfsprogs-2016.2.22.tgz and ntfs-3g_ntfsprogs-2017.3.23.tgz

About: NTFS-3G is a read-write NTFS driver for Linux and other operating systems. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008, Windows 7 and Windows 8 NTFS file systems.

object_id.c  (ntfs-3g_ntfsprogs-2016.2.22.tgz):object_id.c  (ntfs-3g_ntfsprogs-2017.3.23.tgz)
skipping to change at line 40 skipping to change at line 40
#endif #endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_SETXATTR
#include <sys/xattr.h>
#endif
#ifdef HAVE_SYS_SYSMACROS_H #ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif
#include "compat.h" #include "compat.h"
#include "types.h" #include "types.h"
#include "debug.h" #include "debug.h"
#include "attrib.h" #include "attrib.h"
#include "inode.h" #include "inode.h"
#include "dir.h" #include "dir.h"
#include "volume.h" #include "volume.h"
#include "mft.h" #include "mft.h"
#include "index.h" #include "index.h"
#include "lcnalloc.h" #include "lcnalloc.h"
#include "object_id.h" #include "object_id.h"
#include "logging.h" #include "logging.h"
#include "misc.h" #include "misc.h"
#include "xattrs.h"
/* /*
* Endianness considerations * Endianness considerations
* *
* According to RFC 4122, GUIDs should be printed with the most * According to RFC 4122, GUIDs should be printed with the most
* significant byte first, and the six fields be compared individually * significant byte first, and the six fields be compared individually
* for ordering. RFC 4122 does not define the internal representation. * for ordering. RFC 4122 does not define the internal representation.
* *
* Here we always copy disk images with no endianness change, * Here we always copy disk images with no endianness change,
* and, for indexing, GUIDs are compared as if they were a sequence * and, for indexing, GUIDs are compared as if they were a sequence
skipping to change at line 133 skipping to change at line 129
} OBJECT_ID_INDEX_DATA; // known as OBJ_ID_INDEX_DATA } OBJECT_ID_INDEX_DATA; // known as OBJ_ID_INDEX_DATA
struct OBJECT_ID_INDEX { /* index entry in $Extend/$ObjId */ struct OBJECT_ID_INDEX { /* index entry in $Extend/$ObjId */
INDEX_ENTRY_HEADER header; INDEX_ENTRY_HEADER header;
OBJECT_ID_INDEX_KEY key; OBJECT_ID_INDEX_KEY key;
OBJECT_ID_INDEX_DATA data; OBJECT_ID_INDEX_DATA data;
} ; } ;
static ntfschar objid_index_name[] = { const_cpu_to_le16('$'), static ntfschar objid_index_name[] = { const_cpu_to_le16('$'),
const_cpu_to_le16('O') }; const_cpu_to_le16('O') };
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* /*
* Set the index for a new object id * Set the index for a new object id
* *
* Returns 0 if success * Returns 0 if success
* -1 if failure, explained by errno * -1 if failure, explained by errno
*/ */
static int set_object_id_index(ntfs_inode *ni, ntfs_index_context *xo, static int set_object_id_index(ntfs_inode *ni, ntfs_index_context *xo,
const OBJECT_ID_ATTR *object_id) const OBJECT_ID_ATTR *object_id)
skipping to change at line 179 skipping to change at line 174
memcpy(&indx.data.birth_volume_id, memcpy(&indx.data.birth_volume_id,
&object_id->birth_volume_id,sizeof(GUID)); &object_id->birth_volume_id,sizeof(GUID));
memcpy(&indx.data.birth_object_id, memcpy(&indx.data.birth_object_id,
&object_id->birth_object_id,sizeof(GUID)); &object_id->birth_object_id,sizeof(GUID));
memcpy(&indx.data.domain_id, memcpy(&indx.data.domain_id,
&object_id->domain_id,sizeof(GUID)); &object_id->domain_id,sizeof(GUID));
ntfs_index_ctx_reinit(xo); ntfs_index_ctx_reinit(xo);
return (ntfs_ie_add(xo,(INDEX_ENTRY*)&indx)); return (ntfs_ie_add(xo,(INDEX_ENTRY*)&indx));
} }
#endif /* HAVE_SETXATTR */
/* /*
* Open the $Extend/$ObjId file and its index * Open the $Extend/$ObjId file and its index
* *
* Return the index context if opened * Return the index context if opened
* or NULL if an error occurred (errno tells why) * or NULL if an error occurred (errno tells why)
* *
* The index has to be freed and inode closed when not needed any more. * The index has to be freed and inode closed when not needed any more.
*/ */
static ntfs_index_context *open_object_id_index(ntfs_volume *vol) static ntfs_index_context *open_object_id_index(ntfs_volume *vol)
skipping to change at line 216 skipping to change at line 209
if (ni) { if (ni) {
xo = ntfs_index_ctx_get(ni, objid_index_name, 2); xo = ntfs_index_ctx_get(ni, objid_index_name, 2);
if (!xo) { if (!xo) {
ntfs_inode_close(ni); ntfs_inode_close(ni);
} }
} else } else
xo = (ntfs_index_context*)NULL; xo = (ntfs_index_context*)NULL;
return (xo); return (xo);
} }
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* /*
* Merge object_id data stored in the index into * Merge object_id data stored in the index into
* a full object_id struct. * a full object_id struct.
* *
* returns 0 if merging successful * returns 0 if merging successful
* -1 if no data could be merged. This is generally not an error * -1 if no data could be merged. This is generally not an error
*/ */
static int merge_index_data(ntfs_inode *ni, static int merge_index_data(ntfs_inode *ni,
const OBJECT_ID_ATTR *objectid_attr, const OBJECT_ID_ATTR *objectid_attr,
skipping to change at line 266 skipping to change at line 257
res = 0; res = 0;
} }
} }
xoni = xo->ni; xoni = xo->ni;
ntfs_index_ctx_put(xo); ntfs_index_ctx_put(xo);
ntfs_inode_close(xoni); ntfs_inode_close(xoni);
} }
return (res); return (res);
} }
#endif /* HAVE_SETXATTR */
/* /*
* Remove an object id index entry if attribute present * Remove an object id index entry if attribute present
* *
* Returns the size of existing object id * Returns the size of existing object id
* (the existing object_d is returned) * (the existing object_d is returned)
* -1 if failure, explained by errno * -1 if failure, explained by errno
*/ */
static int remove_object_id_index(ntfs_attr *na, ntfs_index_context *xo, static int remove_object_id_index(ntfs_attr *na, ntfs_index_context *xo,
OBJECT_ID_ATTR *old_attr) OBJECT_ID_ATTR *old_attr)
skipping to change at line 314 skipping to change at line 303
ret = -1; ret = -1;
} }
} else { } else {
ret = -1; ret = -1;
errno = ENODATA; errno = ENODATA;
} }
} }
return (ret); return (ret);
} }
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* /*
* Update the object id and index * Update the object id and index
* *
* The object_id attribute should have been created and the * The object_id attribute should have been created and the
* non-duplication of the GUID should have been checked before. * non-duplication of the GUID should have been checked before.
* *
* Returns 0 if success * Returns 0 if success
* -1 if failure, explained by errno * -1 if failure, explained by errno
* If could not remove the existing index, nothing is done, * If could not remove the existing index, nothing is done,
* If could not write the new data, no index entry is inserted * If could not write the new data, no index entry is inserted
skipping to change at line 420 skipping to change at line 407
errno = ENODATA; errno = ENODATA;
} else { } else {
if (flags & XATTR_CREATE) if (flags & XATTR_CREATE)
errno = EEXIST; errno = EEXIST;
else else
res = 0; res = 0;
} }
return (res); return (res);
} }
#endif /* HAVE_SETXATTR */
/* /*
* Delete an object_id index entry * Delete an object_id index entry
* *
* Returns 0 if success * Returns 0 if success
* -1 if failure, explained by errno * -1 if failure, explained by errno
*/ */
int ntfs_delete_object_id_index(ntfs_inode *ni) int ntfs_delete_object_id_index(ntfs_inode *ni)
{ {
ntfs_index_context *xo; ntfs_index_context *xo;
skipping to change at line 459 skipping to change at line 444
ntfs_index_entry_mark_dirty(xo); ntfs_index_entry_mark_dirty(xo);
NInoSetDirty(xoni); NInoSetDirty(xoni);
ntfs_index_ctx_put(xo); ntfs_index_ctx_put(xo);
ntfs_inode_close(xoni); ntfs_inode_close(xoni);
} }
ntfs_attr_close(na); ntfs_attr_close(na);
} }
return (res); return (res);
} }
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* /*
* Get the ntfs object id into an extended attribute * Get the ntfs object id into an extended attribute
* *
* If present, the object_id from the attribute and the GUIDs * If present, the object_id from the attribute and the GUIDs
* from the index are returned (formatted as OBJECT_ID_ATTR) * from the index are returned (formatted as OBJECT_ID_ATTR)
* *
* Returns the global size (can be 0, 16 or 64) * Returns the global size (can be 0, 16 or 64)
* and the buffer is updated if it is long enough * and the buffer is updated if it is long enough
*/ */
skipping to change at line 639 skipping to change at line 622
errno = ENODATA; errno = ENODATA;
res = -1; res = -1;
} }
NInoSetDirty(ni); NInoSetDirty(ni);
} else { } else {
errno = EINVAL; errno = EINVAL;
res = -1; res = -1;
} }
return (res ? -1 : 0); return (res ? -1 : 0);
} }
#endif /* HAVE_SETXATTR */
 End of changes. 10 change blocks. 
18 lines changed or deleted 1 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS