got bored. don't read the diffs.
parent
cb13f36956
commit
7a142ef54c
|
@ -115,7 +115,7 @@ extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol,
|
|||
* // with it and then just continue with the while loop.
|
||||
* }
|
||||
* if (err && errno != ENOENT)
|
||||
* // Ooops. An error occured! You should handle this case.
|
||||
* // Ooops. An error occurred! You should handle this case.
|
||||
* // Now finished with all attributes in the inode.
|
||||
*/
|
||||
static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx)
|
||||
|
@ -131,7 +131,7 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx)
|
|||
* @type: attribute type
|
||||
* @name: Unicode name of the attribute
|
||||
* @name_len: length of @name in Unicode characters
|
||||
* @state: NTFS attribute specific flags descibing this attribute
|
||||
* @state: NTFS attribute specific flags describing this attribute
|
||||
* @allocated_size: copy from the attribute record
|
||||
* @data_size: copy from the attribute record
|
||||
* @initialized_size: copy from the attribute record
|
||||
|
@ -154,16 +154,16 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx)
|
|||
*
|
||||
* @rl is the decompressed runlist of the attribute described by this
|
||||
* structure. Obviously this only makes sense if the attribute is not resident,
|
||||
* i.e. NAttrNonResident() is true. If the runlist hasn't been decomressed yet
|
||||
* i.e. NAttrNonResident() is true. If the runlist hasn't been decompressed yet
|
||||
* @rl is NULL, so be prepared to cope with @rl == NULL.
|
||||
*
|
||||
* @ni is the base ntfs inode of the attribute described by this structure.
|
||||
*
|
||||
* @type is the attribute type (see layout.h for the definition of ATTR_TYPES),
|
||||
* @name and @name_len are the little endian Unicode name and the name length
|
||||
* in Unicode characters of the attribute, respecitvely.
|
||||
* in Unicode characters of the attribute, respectively.
|
||||
*
|
||||
* @state contains NTFS attribute specific flags descibing this attribute
|
||||
* @state contains NTFS attribute specific flags describing this attribute
|
||||
* structure. See ntfs_attr_state_bits above.
|
||||
*/
|
||||
struct _ntfs_attr {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* compat.h - Tweaks for Windows compatability.
|
||||
* compat.h - Tweaks for Windows compatibility.
|
||||
*
|
||||
* Copyright (c) 2002 Richard Russon
|
||||
* Copyright (c) 2002-2004 Anton Altaparmakov
|
||||
|
|
|
@ -53,12 +53,12 @@
|
|||
*
|
||||
* If @is_in_root is TRUE, @entry is in the index root attribute @ir described
|
||||
* by the attribute search context @actx and inode @ni. @ia, @ia_vcn and
|
||||
* @ia_dirty are undifined in this case.
|
||||
* @ia_dirty are undefined in this case.
|
||||
*
|
||||
* If @is_in_root is FALSE, @entry is in the index allocation attribute and @ia
|
||||
* and @ia_vcn point to the index allocation block and VCN where it's placed,
|
||||
* respectively. @ir and @actx are NULL in this case. @ia_na is opened
|
||||
* INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and
|
||||
* INDEX_ALLOCATION attribute. @ia_dirty is TRUE if index block was changed and
|
||||
* FALSE otherwise.
|
||||
*
|
||||
* To obtain a context call ntfs_index_ctx_get().
|
||||
|
|
|
@ -171,7 +171,7 @@ typedef enum {
|
|||
* 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 occured when the data was written.
|
||||
* 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
|
||||
|
@ -279,7 +279,7 @@ typedef enum {
|
|||
* fragmented. Volume free space includes the empty part of the mft zone and
|
||||
* when the volume's free 88% are used up, the mft zone is shrunk by a factor
|
||||
* of 2, thus making more space available for more files/data. This process is
|
||||
* repeated everytime there is no more free space except for the mft zone until
|
||||
* repeated every time there is no more free space except for the mft zone until
|
||||
* there really is no more free space.
|
||||
*/
|
||||
|
||||
|
@ -951,7 +951,7 @@ typedef struct {
|
|||
* itself. The list is sorted: first by attribute type, second by attribute
|
||||
* name (if present), third by instance number. The extents of one
|
||||
* non-resident attribute (if present) immediately follow after the initial
|
||||
* extent. They are ordered by lowest_vcn and have their instace set to zero.
|
||||
* extent. They are ordered by lowest_vcn and have their instance set to zero.
|
||||
* It is not allowed to have two attributes with all sorting keys equal.
|
||||
* - Further restrictions:
|
||||
* - If not resident, the vcn to lcn mapping array has to fit inside the
|
||||
|
@ -1522,7 +1522,7 @@ typedef enum {
|
|||
* Write access. For files, this maps onto:
|
||||
* FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA |
|
||||
* FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE
|
||||
* For directories, the mapping has the same numberical value. See
|
||||
* For directories, the mapping has the same numerical value. See
|
||||
* above for the descriptions of the rights granted.
|
||||
*/
|
||||
GENERIC_WRITE = const_cpu_to_le32(0x40000000),
|
||||
|
@ -1531,7 +1531,7 @@ typedef enum {
|
|||
* Read access. For files, this maps onto:
|
||||
* FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA |
|
||||
* STANDARD_RIGHTS_READ | SYNCHRONIZE
|
||||
* For directories, the mapping has the same numberical value. See
|
||||
* For directories, the mapping has the same numerical value. See
|
||||
* above for the descriptions of the rights granted.
|
||||
*/
|
||||
GENERIC_READ = const_cpu_to_le32(0x80000000),
|
||||
|
@ -1633,14 +1633,14 @@ typedef enum {
|
|||
* SID pointed to by the Owner field was provided by a
|
||||
* defaulting mechanism rather than explicitly provided by the
|
||||
* original provider of the security descriptor. This may
|
||||
* affect the treatment of the SID with respect to inheritence
|
||||
* affect the treatment of the SID with respect to inheritance
|
||||
* of an owner.
|
||||
*
|
||||
* SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the
|
||||
* SID in the Group field was provided by a defaulting mechanism
|
||||
* rather than explicitly provided by the original provider of
|
||||
* the security descriptor. This may affect the treatment of
|
||||
* the SID with respect to inheritence of a primary group.
|
||||
* the SID with respect to inheritance of a primary group.
|
||||
*
|
||||
* SE_DACL_PRESENT - This boolean flag, when set, indicates that the
|
||||
* security descriptor contains a discretionary ACL. If this
|
||||
|
@ -1651,7 +1651,7 @@ typedef enum {
|
|||
* ACL pointed to by the Dacl field was provided by a defaulting
|
||||
* mechanism rather than explicitly provided by the original
|
||||
* provider of the security descriptor. This may affect the
|
||||
* treatment of the ACL with respect to inheritence of an ACL.
|
||||
* treatment of the ACL with respect to inheritance of an ACL.
|
||||
* This flag is ignored if the DaclPresent flag is not set.
|
||||
*
|
||||
* SE_SACL_PRESENT - This boolean flag, when set, indicates that the
|
||||
|
@ -1664,7 +1664,7 @@ typedef enum {
|
|||
* ACL pointed to by the Sacl field was provided by a defaulting
|
||||
* mechanism rather than explicitly provided by the original
|
||||
* provider of the security descriptor. This may affect the
|
||||
* treatment of the ACL with respect to inheritence of an ACL.
|
||||
* treatment of the ACL with respect to inheritance of an ACL.
|
||||
* This flag is ignored if the SaclPresent flag is not set.
|
||||
*
|
||||
* SE_SELF_RELATIVE - This boolean flag, when set, indicates that the
|
||||
|
@ -1791,7 +1791,7 @@ typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR;
|
|||
* matching hash is found, but the security descriptors do not match, the
|
||||
* search in the $SDH index is continued, searching for a next matching hash.
|
||||
*
|
||||
* When a precise match is found, the security_id coresponding to the security
|
||||
* When a precise match is found, the security_id corresponding to the security
|
||||
* descriptor in the $SDS attribute is read from the found $SDH index entry and
|
||||
* is stored in the $STANDARD_INFORMATION attribute of the file/directory to
|
||||
* which the security descriptor is being applied. The $STANDARD_INFORMATION
|
||||
|
@ -1968,14 +1968,14 @@ typedef struct {
|
|||
*
|
||||
* When a directory is small enough to fit inside the index root then this
|
||||
* is the only attribute describing the directory. When the directory is too
|
||||
* large to fit in the index root, on the other hand, two aditional attributes
|
||||
* large to fit in the index root, on the other hand, two additional attributes
|
||||
* are present: an index allocation attribute, containing sub-nodes of the B+
|
||||
* directory tree (see below), and a bitmap attribute, describing which virtual
|
||||
* cluster numbers (vcns) in the index allocation attribute are in use by an
|
||||
* index block.
|
||||
*
|
||||
* NOTE: The root directory (FILE_root) contains an entry for itself. Other
|
||||
* dircetories do not contain entries for themselves, though.
|
||||
* directories do not contain entries for themselves, though.
|
||||
*/
|
||||
typedef struct {
|
||||
ATTR_TYPES type; /* Type of the indexed attribute. Is
|
||||
|
@ -2244,7 +2244,7 @@ typedef struct {
|
|||
*
|
||||
* The reparse point tag is an unsigned 32-bit value divided in three parts:
|
||||
*
|
||||
* 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of
|
||||
* 1. The least significant 16 bits (i.e. bits 0 to 15) specify the type of
|
||||
* the reparse point.
|
||||
* 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use.
|
||||
* 3. The most significant three bits are flags describing the reparse point.
|
||||
|
|
|
@ -124,7 +124,7 @@ typedef struct {
|
|||
when the restart area was last written.
|
||||
This happens often but what is the interval?
|
||||
Is it just fixed time or is it every time a
|
||||
check point is written or somethine else?
|
||||
check point is written or something else?
|
||||
On create set to 0. */
|
||||
/* 8*/ le16 log_clients; /* Number of log client records in the array of
|
||||
log client records which follows this
|
||||
|
@ -217,7 +217,7 @@ typedef struct {
|
|||
/* 24*/ sle64 file_size; /* Usable byte size of the log file. If the
|
||||
restart_area_offset + the offset of the
|
||||
file_size are > 510 then corruption has
|
||||
occured. This is the very first check when
|
||||
occurred. This is the very first check when
|
||||
starting with the restart_area as if it
|
||||
fails it means that some of the above values
|
||||
will be corrupted by the multi sector
|
||||
|
|
134
libntfs/attrib.c
134
libntfs/attrib.c
|
@ -264,7 +264,7 @@ static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni,
|
|||
* @na:
|
||||
* @non_resident:
|
||||
* @compressed:
|
||||
* @ecnrypted:
|
||||
* @encrypted:
|
||||
* @sparse:
|
||||
* @allocated_size:
|
||||
* @data_size:
|
||||
|
@ -1105,7 +1105,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
|
|||
/* The buffer is non zero, instantiate the hole. */
|
||||
cur_vcn = rl->vcn;
|
||||
from_vcn = rl->vcn + (ofs >> vol->cluster_size_bits);
|
||||
Dprintf("%s(): Isntantiate the hole with vcn 0x%llx.\n",
|
||||
Dprintf("%s(): Instantiate the hole with vcn 0x%llx.\n",
|
||||
__FUNCTION__, cur_vcn);
|
||||
/*
|
||||
* Search backwards to find the best lcn to start
|
||||
|
@ -1154,7 +1154,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
|
|||
if (ntfs_cluster_free_from_rl(vol, rlc)) {
|
||||
Dprintf("%s(): Failed to free just "
|
||||
"allocated clusters. Leaving "
|
||||
"inconsist metadata. "
|
||||
"inconstant metadata. "
|
||||
"Run chkdsk", __FUNCTION__);
|
||||
}
|
||||
errno = eo;
|
||||
|
@ -1167,7 +1167,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
|
|||
/*
|
||||
* It's definitely a BUG, if we failed to find
|
||||
* @cur_vcn, because we missed it during
|
||||
* instatiating of the hole.
|
||||
* instantiating of the hole.
|
||||
*/
|
||||
Dprintf("%s(): BUG! Failed to find run after "
|
||||
"instantiating. Please report to the "
|
||||
|
@ -1179,7 +1179,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
|
|||
/* If leaved part of the hole go to the next run. */
|
||||
if (rl->lcn < 0)
|
||||
rl++;
|
||||
/* Now LCN should shoudn't be lesser than 0. */
|
||||
/* Now LCN shoudn't be less than 0. */
|
||||
if (rl->lcn < 0) {
|
||||
Dprintf("%s(): BUG! LCN is lesser than 0. "
|
||||
"Please report to the "
|
||||
|
@ -1494,7 +1494,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt,
|
|||
* but not AT_UNNAMED search for a named attribute matching @name. Otherwise,
|
||||
* match both named and unnamed attributes.
|
||||
*
|
||||
* If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and
|
||||
* If @ic is IGNORE_CASE, the @name comparison is not case sensitive and
|
||||
* @ctx->ntfs_ino must be set to the ntfs inode to which the mft record
|
||||
* @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at
|
||||
* the upcase table. If @ic is CASE_SENSITIVE, the comparison is case
|
||||
|
@ -2260,7 +2260,7 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx)
|
|||
* @type in the $AttrDef system file.
|
||||
*
|
||||
* Return the attribute type definition record if found and NULL if not found
|
||||
* or an error occured. On error the error code is stored in errno. The
|
||||
* or an error occurred. On error the error code is stored in errno. The
|
||||
* following error codes are defined:
|
||||
* ENOENT - The attribute @type is not specified in $AttrDef.
|
||||
* EINVAL - Invalid parameters (e.g. @vol is not valid).
|
||||
|
@ -2299,7 +2299,7 @@ ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol,
|
|||
* Check whether the @size in bytes is valid for an attribute of @type on the
|
||||
* ntfs volume @vol. This information is obtained from $AttrDef system file.
|
||||
*
|
||||
* Return 0 if valid and -1 if not valid or an error occured. On error the
|
||||
* Return 0 if valid and -1 if not valid or an error occurred. On error the
|
||||
* error code is stored in errno. The following error codes are defined:
|
||||
* ERANGE - @size is not valid for the attribute @type.
|
||||
* ENOENT - The attribute @type is not specified in $AttrDef.
|
||||
|
@ -2348,7 +2348,7 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
|
|||
* be non-resident. This information is obtained from $AttrDef system file.
|
||||
*
|
||||
* Return 0 if the attribute is allowed to be non-resident and -1 if not or an
|
||||
* error occured. On error the error code is stored in errno. The following
|
||||
* error occurred. On error the error code is stored in errno. The following
|
||||
* error codes are defined:
|
||||
* EPERM - The attribute is not allowed to be non-resident.
|
||||
* ENOENT - The attribute @type is not specified in $AttrDef.
|
||||
|
@ -2382,7 +2382,7 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type)
|
|||
* allocation and extended attribute attributes.
|
||||
*
|
||||
* Return 0 if the attribute is allowed to be resident and -1 if not or an
|
||||
* error occured. On error the error code is stored in errno. The following
|
||||
* error occurred. On error the error code is stored in errno. The following
|
||||
* error codes are defined:
|
||||
* EPERM - The attribute is not allowed to be resident.
|
||||
* EINVAL - Invalid parameters (e.g. @vol is not valid).
|
||||
|
@ -2425,7 +2425,7 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size)
|
|||
Dprintf("%s(): Entering for pos 0x%d, size %u.\n",
|
||||
__FUNCTION__, (int)(pos - (u8*)m), (unsigned) size);
|
||||
|
||||
/* Make size 8-byte aligment. */
|
||||
/* Make size 8-byte alignment. */
|
||||
size = (size + 7) & ~7;
|
||||
|
||||
/* Rigorous consistency checks. */
|
||||
|
@ -2467,9 +2467,9 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size)
|
|||
* Return offset to attribute from the beginning of the mft record on success
|
||||
* and -1 on error. On error the error code is stored in errno.
|
||||
* Possible error codes are:
|
||||
* EINVAL - Invalid argumets passed to function.
|
||||
* EINVAL - Invalid arguments passed to function.
|
||||
* EEXIST - Attribute of such type and with same name already exists.
|
||||
* EIO - I/O error occured or damaged filesystem.
|
||||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
ntfschar *name, u8 name_len, ATTR_FLAGS flags)
|
||||
|
@ -2502,7 +2502,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Locate place where record shoud be. */
|
||||
/* Locate place where record should be. */
|
||||
ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec);
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
@ -2580,10 +2580,10 @@ put_err_out:
|
|||
* Return offset to attribute from the beginning of the mft record on success
|
||||
* and -1 on error. On error the error code is stored in errno.
|
||||
* Possible error codes are:
|
||||
* EINVAL - Invalid argumets passed to function.
|
||||
* EINVAL - Invalid arguments passed to function.
|
||||
* EEXIST - Attribute of such type, with same lowest vcn and with same
|
||||
* name already exists.
|
||||
* EIO - I/O error occured or damaged filesystem.
|
||||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
||||
ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size,
|
||||
|
@ -2618,7 +2618,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Locate place where record shoud be. */
|
||||
/* Locate place where record should be. */
|
||||
ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec);
|
||||
if (!ctx)
|
||||
return -1;
|
||||
|
@ -2699,7 +2699,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
|
|||
lowest_vcn, NULL, 0, ctx)) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Attribute lookup failed. Probably leaving "
|
||||
"inconsist metadata.\n", __FUNCTION__);
|
||||
"inconstant metadata.\n", __FUNCTION__);
|
||||
ntfs_attr_put_search_ctx(ctx);
|
||||
errno = err;
|
||||
return -1;
|
||||
|
@ -2716,15 +2716,15 @@ put_err_out:
|
|||
|
||||
/**
|
||||
* ntfs_attr_record_rm - remove attribute extent
|
||||
* @ctx: search context describing the attrubute which should be removed
|
||||
* @ctx: search context describing the attribute which should be removed
|
||||
*
|
||||
* If this function succeed, user should reinit search context if he/she wants
|
||||
* use it anymore.
|
||||
*
|
||||
* Return 0 on success and -1 on error. On error the error code is stored in
|
||||
* errno. Possible error codes are:
|
||||
* EINVAL - Invalid argumets passed to function.
|
||||
* EIO - I/O error occured or damaged filesystem.
|
||||
* EINVAL - Invalid arguments passed to function.
|
||||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
||||
{
|
||||
|
@ -2749,12 +2749,12 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
|
||||
/* Remove attribute itself. */
|
||||
if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) {
|
||||
Dprintf("%s(): Coudn't remove attribute record. Bug or "
|
||||
Dprintf("%s(): Couldn't remove attribute record. Bug or "
|
||||
"damaged MFT record.\n", __FUNCTION__);
|
||||
if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST)
|
||||
if (ntfs_attrlist_entry_add(ni, ctx->attr))
|
||||
Dprintf("%s(): Rollback failed. Leaving "
|
||||
"inconsist metadata.\n", __FUNCTION__);
|
||||
"inconstant metadata.\n", __FUNCTION__);
|
||||
err = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2767,7 +2767,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) {
|
||||
if (ntfs_attrlist_entry_rm(ctx)) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Coudn't delete record from "
|
||||
Dprintf("%s(): Couldn't delete record from "
|
||||
"$ATTRIBUTE_LIST.\n", __FUNCTION__);
|
||||
errno = err;
|
||||
return -1;
|
||||
|
@ -2788,7 +2788,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
le16_to_cpu(ctx->mrec->attrs_offset) == 8) {
|
||||
if (ntfs_mft_record_free(ni->vol, ni)) {
|
||||
// FIXME: We need rollback here.
|
||||
Dprintf("%s(): Coudn't free MFT record.\n",
|
||||
Dprintf("%s(): Couldn't free MFT record.\n",
|
||||
__FUNCTION__);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
@ -2811,7 +2811,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
* goes wrong because NInoAttrList(base_ni) returned
|
||||
* that we have got attribute list.
|
||||
*/
|
||||
Dprintf("%s(): Coudn't find attribute list. Succeed "
|
||||
Dprintf("%s(): Couldn't find attribute list. Succeed "
|
||||
"anyway.\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2842,7 +2842,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
* complain if it find MFT record with attribute list,
|
||||
* but without extents.
|
||||
*/
|
||||
Dprintf("%s(): Coudn't remove attribute list. Succeed "
|
||||
Dprintf("%s(): Couldn't remove attribute list. Succeed "
|
||||
"anyway.\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2855,10 +2855,10 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
|
|||
* @ni: opened ntfs inode to which add attribute
|
||||
* @type: type of the new attribute
|
||||
* @name: name in unicode of the new attribute
|
||||
* @name_len: name length in unicode charcters of the new attribute
|
||||
* @name_len: name length in unicode characters of the new attribute
|
||||
* @size: size of the new attribute
|
||||
*
|
||||
* If inode haven't got enogh space to add attribute, add attribute to one of it
|
||||
* If inode haven't got enough space to add attribute, add attribute to one of it
|
||||
* extents, if no extents present or no one of them have enough space, than
|
||||
* allocate new extent and add attribute to it.
|
||||
*
|
||||
|
@ -3013,7 +3013,7 @@ add_attr_record:
|
|||
__FUNCTION__);
|
||||
if (ntfs_attr_rm(na)) {
|
||||
Dprintf("%s(): Failed to remove just added attribute. "
|
||||
"Probably leaving inconsist metadata.\n",
|
||||
"Probably leaving inconstant metadata.\n",
|
||||
__FUNCTION__);
|
||||
}
|
||||
goto err_out;
|
||||
|
@ -3034,7 +3034,7 @@ free_err_out:
|
|||
le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) {
|
||||
if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) {
|
||||
Dprintf("%s(): Failed to free MFT record. Leaving "
|
||||
"inconsist metadata.\n", __FUNCTION__);
|
||||
"inconstant metadata.\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
err_out:
|
||||
|
@ -3071,7 +3071,7 @@ int ntfs_attr_rm(ntfs_attr *na)
|
|||
return -1;
|
||||
if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) {
|
||||
Dprintf("%s(): Failed to free cluster allocation. "
|
||||
"Leaving inconsist metadata.\n", __FUNCTION__);
|
||||
"Leaving inconstant metadata.\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3084,14 +3084,14 @@ int ntfs_attr_rm(ntfs_attr *na)
|
|||
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
|
||||
if (ntfs_attr_record_rm(ctx)) {
|
||||
Dprintf("%s(): Failed to remove attribute extent. "
|
||||
"Leaving inconsist metadata.\n", __FUNCTION__);
|
||||
"Leaving inconstant metadata.\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
}
|
||||
ntfs_attr_reinit_search_ctx(ctx);
|
||||
}
|
||||
if (errno != ENOENT) {
|
||||
Dprintf("%s(): Attribute lookup failed. Probably leaving "
|
||||
"inconsist metadata.\n", __FUNCTION__);
|
||||
"inconstant metadata.\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
|
@ -3165,7 +3165,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a,
|
|||
{
|
||||
/*
|
||||
* Check that the attribute name hasn't been placed after the
|
||||
* attribute valuy. Chkdsk treat this as corruption.
|
||||
* attribute value. Chkdsk treat this as corruption.
|
||||
*/
|
||||
if (a->name_length && le16_to_cpu(a->name_offset) >=
|
||||
le16_to_cpu(a->value_offset)) {
|
||||
|
@ -3201,7 +3201,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a,
|
|||
|
||||
/**
|
||||
* ntfs_attr_record_move_to - move attribute record to target inode
|
||||
* @ctx: attribute search context describing the attrubute record
|
||||
* @ctx: attribute search context describing the attribute record
|
||||
* @ni: opened ntfs inode to which move attribute record
|
||||
*
|
||||
* If this function succeed, user should reinit search context if he/she wants
|
||||
|
@ -3292,8 +3292,8 @@ put_err_out:
|
|||
|
||||
/**
|
||||
* ntfs_attr_record_move_away - move away attribute record from it's mft record
|
||||
* @ctx: attribute search context describing the attrubute record
|
||||
* @extra: minimum amount of free spase in the new holder of record
|
||||
* @ctx: attribute search context describing the attribute record
|
||||
* @extra: minimum amount of free space in the new holder of record
|
||||
*
|
||||
* New attribute record holder must have free @extra bytes after moving
|
||||
* attribute record to it.
|
||||
|
@ -3419,7 +3419,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na,
|
|||
|
||||
/*
|
||||
* Check that the attribute name hasn't been placed after the
|
||||
* attribute valuy. Chkdsk treat this as corruption.
|
||||
* attribute value. Chkdsk treat this as corruption.
|
||||
*/
|
||||
if (a->name_length && le16_to_cpu(a->name_offset) >=
|
||||
le16_to_cpu(a->value_offset)) {
|
||||
|
@ -3580,7 +3580,7 @@ cluster_free_err_out:
|
|||
* The following error codes are defined:
|
||||
* ENOMEM - Not enough memory to complete operation.
|
||||
* ERANGE - @newsize is not valid for the attribute type of @na.
|
||||
* ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST.
|
||||
* ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST.
|
||||
*/
|
||||
static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize)
|
||||
{
|
||||
|
@ -3689,7 +3689,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize)
|
|||
ntfs_attr_put_search_ctx(ctx);
|
||||
return ntfs_resident_attr_resize(na, newsize);
|
||||
}
|
||||
/* Check whether error occured. */
|
||||
/* Check whether error occurred. */
|
||||
if (errno != ENOENT) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__);
|
||||
|
@ -3921,7 +3921,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
|
|||
if (bytes_read < 0)
|
||||
err = errno;
|
||||
Dprintf("%s(): Eeek! Failed to read attribute data. "
|
||||
"Leaving inconsist metadata. Run chkdsk. "
|
||||
"Leaving inconstant metadata. Run chkdsk. "
|
||||
"Aborting...\n", __FUNCTION__);
|
||||
errno = err;
|
||||
return -1;
|
||||
|
@ -3975,7 +3975,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
|
|||
* On success return 0 and on error return -1 with errno set to the error code.
|
||||
* The following error codes are defined:
|
||||
* ENOMEM - Not enough memory to complete operation.
|
||||
* ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST.
|
||||
* ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST.
|
||||
*/
|
||||
int ntfs_attr_update_mapping_pairs(ntfs_attr *na)
|
||||
{
|
||||
|
@ -4177,7 +4177,7 @@ retry:
|
|||
/*
|
||||
* Mapping pairs of $ATTRIBUTE_LIST attribute must fit
|
||||
* in the base mft record. Try to move out other
|
||||
* attibutes and try again.
|
||||
* attributes and try again.
|
||||
*/
|
||||
if (na->type == AT_ATTRIBUTE_LIST) {
|
||||
ntfs_attr_put_search_ctx(ctx);
|
||||
|
@ -4201,7 +4201,7 @@ retry:
|
|||
ntfs_attr_put_search_ctx(ctx);
|
||||
if (ntfs_inode_add_attrlist(base_ni)) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Eeek! Coudn't add "
|
||||
Dprintf("%s(): Eeek! Couldn't add "
|
||||
"attribute list.\n",
|
||||
__FUNCTION__);
|
||||
errno = err;
|
||||
|
@ -4264,7 +4264,7 @@ retry:
|
|||
}
|
||||
a->highest_vcn = cpu_to_sle64(stop_vcn - 1);
|
||||
}
|
||||
/* Check whether error occured. */
|
||||
/* Check whether error occurred. */
|
||||
if (errno != ENOENT) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__);
|
||||
|
@ -4283,7 +4283,7 @@ retry:
|
|||
/* Remove unused attribute record. */
|
||||
if (ntfs_attr_record_rm(ctx)) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Coudn't remove unused attribute "
|
||||
Dprintf("%s(): Couldn't remove unused attribute "
|
||||
"record.\n", __FUNCTION__);
|
||||
goto put_err_out;
|
||||
}
|
||||
|
@ -4323,7 +4323,7 @@ retry:
|
|||
}
|
||||
m = ni->mrec;
|
||||
/*
|
||||
* If mapping size exceed avaible space, set them to
|
||||
* If mapping size exceed available space, set them to
|
||||
* possible maximum.
|
||||
*/
|
||||
cur_max_mp_size = le32_to_cpu(m->bytes_allocated) -
|
||||
|
@ -4334,7 +4334,7 @@ retry:
|
|||
((sizeof(ntfschar) * na->name_len + 7) & ~7);
|
||||
if (mp_size > cur_max_mp_size)
|
||||
mp_size = cur_max_mp_size;
|
||||
/* Add atribute extent to new record. */
|
||||
/* Add attribute extent to new record. */
|
||||
err = ntfs_non_resident_attr_record_add(ni, na->type,
|
||||
na->name, na->name_len, stop_vcn, mp_size, 0);
|
||||
if (err == -1) {
|
||||
|
@ -4342,7 +4342,7 @@ retry:
|
|||
Dprintf("%s(): Couldn't add attribute extent "
|
||||
"into the MFT record.\n", __FUNCTION__);
|
||||
if (ntfs_mft_record_free(na->ni->vol, ni)) {
|
||||
Dprintf("%s(): Coudn't free MFT record.\n",
|
||||
Dprintf("%s(): Couldn't free MFT record.\n",
|
||||
__FUNCTION__);
|
||||
}
|
||||
goto put_err_out;
|
||||
|
@ -4361,7 +4361,7 @@ retry:
|
|||
"linux-ntfs-dev@lists.sf.net.\n",
|
||||
__FUNCTION__);
|
||||
if (ntfs_mft_record_free(na->ni->vol, ni))
|
||||
Dprintf("%s(): Coudn't free MFT record.\n",
|
||||
Dprintf("%s(): Couldn't free MFT record.\n",
|
||||
__FUNCTION__);
|
||||
goto put_err_out;
|
||||
}
|
||||
|
@ -4466,7 +4466,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
|
|||
if (ntfs_attr_update_mapping_pairs(na)) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Eeek! Mapping pairs update failed. "
|
||||
"Leaving inconsist metadata. Run chkdsk.\n",
|
||||
"Leaving inconstant metadata. Run chkdsk.\n",
|
||||
__FUNCTION__);
|
||||
errno = err;
|
||||
return -1;
|
||||
|
@ -4479,10 +4479,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
|
|||
err = errno;
|
||||
if ((na->allocated_size >> vol->cluster_size_bits)
|
||||
!= first_free_vcn)
|
||||
Dprintf("%s(): Coudn't get attribute search context. "
|
||||
"Leaving inconsist metadata.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Couldn't get attribute search context. "
|
||||
"Leaving inconstant metadata.\n", __FUNCTION__);
|
||||
else
|
||||
Dprintf("%s(): Coudn't get attribute search context.\n",
|
||||
Dprintf("%s(): Couldn't get attribute search context.\n",
|
||||
__FUNCTION__);
|
||||
errno = err;
|
||||
return -1;
|
||||
|
@ -4493,7 +4493,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
|
|||
if (err == ENOENT)
|
||||
err = EIO;
|
||||
Dprintf("%s(): Eeek! Lookup of first attribute extent failed. "
|
||||
"Leaving inconsist metadata.\n", __FUNCTION__);
|
||||
"Leaving inconstant metadata.\n", __FUNCTION__);
|
||||
goto put_err_out;
|
||||
}
|
||||
a = ctx->attr;
|
||||
|
@ -4511,7 +4511,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
|
|||
new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl);
|
||||
if (new_compr_size == -1) {
|
||||
err = errno;
|
||||
Dprintf("%s(): BUG! Leaving inconsist metadata.\n",
|
||||
Dprintf("%s(): BUG! Leaving inconstant metadata.\n",
|
||||
__FUNCTION__);
|
||||
goto put_err_out;
|
||||
}
|
||||
|
@ -4561,7 +4561,7 @@ put_err_out:
|
|||
* The following error codes are defined:
|
||||
* ENOMEM - Not enough memory to complete operation.
|
||||
* ERANGE - @newsize is not valid for the attribute type of @na.
|
||||
* ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST.
|
||||
* ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST.
|
||||
*/
|
||||
static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
||||
{
|
||||
|
@ -4611,7 +4611,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
|
||||
/*
|
||||
* If we extend $DATA attribute on NTFS 3+ volume, we can add
|
||||
* sparse runs instead of real alloction of clusters.
|
||||
* sparse runs instead of real allocation of clusters.
|
||||
*/
|
||||
if (na->type == AT_DATA && vol->major_ver >= 3) {
|
||||
rl = malloc(0x1000);
|
||||
|
@ -4643,7 +4643,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
for (rl = na->rl; (rl + 1)->length; rl++)
|
||||
;
|
||||
/*
|
||||
* If the last LCN is a hole or simillar seek
|
||||
* If the last LCN is a hole or similar seek
|
||||
* back to last valid LCN.
|
||||
*/
|
||||
while (rl->lcn < 0 && rl != na->rl)
|
||||
|
@ -4733,7 +4733,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl);
|
||||
if (new_compr_size == -1) {
|
||||
err = errno;
|
||||
Dprintf("%s(): BUG! Leaving inconsist metadata.\n",
|
||||
Dprintf("%s(): BUG! Leaving inconstant metadata.\n",
|
||||
__FUNCTION__);
|
||||
goto put_err_out;
|
||||
}
|
||||
|
@ -4766,12 +4766,12 @@ rollback:
|
|||
*/
|
||||
free(na->rl);
|
||||
na->rl = NULL;
|
||||
Dprintf("%s(): Eeek! Coudn't truncate runlist. Rollback "
|
||||
Dprintf("%s(): Eeek! Couldn't truncate runlist. Rollback "
|
||||
"failed.\n", __FUNCTION__);
|
||||
} else {
|
||||
/* Retore mapping pairs. */
|
||||
/* Restore mapping pairs. */
|
||||
if (ntfs_attr_update_mapping_pairs(na)) {
|
||||
Dprintf("%s(): Eeek! Coudn't restore old mapping "
|
||||
Dprintf("%s(): Eeek! Couldn't restore old mapping "
|
||||
"pairs. Rollback failed.\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
@ -4818,7 +4818,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
|
|||
|
||||
if (!na || newsize < 0 ||
|
||||
(na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) {
|
||||
Dprintf("%s(): Invalid aruments passed.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -4852,8 +4852,8 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
|
|||
NInoFileNameSetDirty(na->ni);
|
||||
na->ni->data_size = na->data_size;
|
||||
/*
|
||||
* If attribute sparse or commpreseed then allocated size in
|
||||
* index should be euqal to compressed size, not to allocated
|
||||
* If attribute sparse or compressed then allocated size in
|
||||
* index should be equal to compressed size, not to allocated
|
||||
* size.
|
||||
*/
|
||||
if (NAttrCompressed(na) || NAttrSparse(na))
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
* ntfs_attrlist_need - check whether attribute need attribute list
|
||||
* @ni: opened ntfs inode for which perform check
|
||||
*
|
||||
* Check whether all are atributes belong to one MFT record, in that case
|
||||
* Check whether all are attributes belong to one MFT record, in that case
|
||||
* attribute list is not needed.
|
||||
*
|
||||
* Return 1 if inode need attribute list, 0 if not, -1 on error with errno set
|
||||
* to the error code. If function succeed errno set to 0. The following error
|
||||
* codes are defined:
|
||||
* EINVAL - Invalid argumets passed to function or attribute haven't got
|
||||
* EINVAL - Invalid arguments passed to function or attribute haven't got
|
||||
* attribute list.
|
||||
*/
|
||||
int ntfs_attrlist_need(ntfs_inode *ni)
|
||||
|
@ -51,7 +51,7 @@ int ntfs_attrlist_need(ntfs_inode *ni)
|
|||
ATTR_LIST_ENTRY *ale;
|
||||
|
||||
if (!ni) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ int ntfs_attrlist_need(ntfs_inode *ni)
|
|||
}
|
||||
|
||||
if (!ni->attr_list) {
|
||||
Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ int ntfs_attrlist_need(ntfs_inode *ni)
|
|||
*
|
||||
* Return 0 on success and -1 on error with errno set to the error code. The
|
||||
* following error codes are defined:
|
||||
* EINVAL - Invalid argumets passed to function.
|
||||
* EINVAL - Invalid arguments passed to function.
|
||||
* ENOMEM - Not enough memory to allocate necessary buffers.
|
||||
* EIO - I/O error occured or damaged filesystem.
|
||||
* EIO - I/O error occurred or damaged filesystem.
|
||||
*/
|
||||
int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr)
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr)
|
|||
(unsigned) le32_to_cpu(attr->type));
|
||||
|
||||
if (!ni || !attr) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr)
|
|||
entry_offset = ((u8 *)ale - ni->attr_list);
|
||||
/* Set pointer to new entry. */
|
||||
ale = (ATTR_LIST_ENTRY *)(new_al + entry_offset);
|
||||
/* Zero it to fix valgrid warning. */
|
||||
/* Zero it to fix valgrind warning. */
|
||||
memset(ale, 0, entry_len);
|
||||
/* Form new entry. */
|
||||
ale->type = attr->type;
|
||||
|
@ -226,7 +226,7 @@ err_out:
|
|||
|
||||
/**
|
||||
* ntfs_attrlist_entry_rm - remove an attribute list attribute entry
|
||||
* @ctx: attribute search context describing the attrubute list entry
|
||||
* @ctx: attribute search context describing the attribute list entry
|
||||
*
|
||||
* Remove the attribute list entry @ctx->al_entry from the attribute list.
|
||||
*
|
||||
|
@ -242,7 +242,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx)
|
|||
int err;
|
||||
|
||||
if (!ctx || !ctx->ntfs_ino || !ctx->al_entry) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ static ntfs_collate_func_t ntfs_do_collate0x1[4] = {
|
|||
* For speed we use the collation rule @cr as an index into two tables of
|
||||
* function pointers to call the appropriate collation function.
|
||||
*
|
||||
* Return NTFS_COLLATION_ERROR if error occured.
|
||||
* Return NTFS_COLLATION_ERROR if error occurred.
|
||||
*/
|
||||
int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr,
|
||||
const void *data1, const int data1_len,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* compat.c - Tweaks for Windows compatability
|
||||
* compat.c - Tweaks for Windows compatibility
|
||||
*
|
||||
* Copyright (c) 2002 Richard Russon
|
||||
* Copyright (c) 2002-2004 Anton Altaparmakov
|
||||
|
|
|
@ -307,7 +307,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count,
|
|||
* @dev at position @pos.
|
||||
*
|
||||
* On success, return the number of successfully written blocks. If this number
|
||||
* is lower than @count this means that the write has been interrutped or that
|
||||
* is lower than @count this means that the write has been interrupted or that
|
||||
* an error was encountered during the write so that the write is partial. 0
|
||||
* means nothing was written (also return 0 when @count or @bksize are 0).
|
||||
*
|
||||
|
|
|
@ -910,7 +910,7 @@ skip_index_root:
|
|||
if (br != bmp_buf_size) {
|
||||
if (br != -1)
|
||||
errno = EIO;
|
||||
Dperror("Failed to read from inde bitmap attribute");
|
||||
Dperror("Failed to read from index bitmap attribute");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
@ -933,7 +933,7 @@ find_next_index_buffer:
|
|||
if (br != bmp_buf_size) {
|
||||
if (br != -1)
|
||||
errno = EIO;
|
||||
Dperror("Failed to read from inde bitmap attribute");
|
||||
Dperror("Failed to read from index bitmap attribute");
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ done:
|
|||
break;
|
||||
/*
|
||||
* A match should never happen as the memcmp() call should have
|
||||
* cought it, but we still treat it correctly.
|
||||
* caught it, but we still treat it correctly.
|
||||
*/
|
||||
if (!rc)
|
||||
goto ir_done;
|
||||
|
@ -356,7 +356,7 @@ ia_done:
|
|||
break;
|
||||
/*
|
||||
* A match should never happen as the memcmp() call should have
|
||||
* cought it, but we still treat it correctly.
|
||||
* caught it, but we still treat it correctly.
|
||||
*/
|
||||
if (!rc)
|
||||
goto ia_done;
|
||||
|
|
|
@ -256,7 +256,7 @@ int ntfs_inode_close(ntfs_inode *ni)
|
|||
}
|
||||
/*
|
||||
* ElectricFence is unhappy with realloc(x,0) as free(x)
|
||||
* thus we explicitely separate these two cases.
|
||||
* thus we explicitly separate these two cases.
|
||||
*/
|
||||
if (base_ni->nr_extents) {
|
||||
/* Resize the memory buffer. */
|
||||
|
@ -375,8 +375,8 @@ err_out:
|
|||
}
|
||||
|
||||
/**
|
||||
* ntfs_inode_attach_all_extents - atach all extents for target inode
|
||||
* @ni: opened ntfs inode for which perform atach
|
||||
* ntfs_inode_attach_all_extents - attach all extents for target inode
|
||||
* @ni: opened ntfs inode for which perform attach
|
||||
*
|
||||
* Return 0 on success and -1 on error with errno set to the error code.
|
||||
*/
|
||||
|
@ -386,7 +386,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni)
|
|||
u64 prev_attached = 0;
|
||||
|
||||
if (!ni) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni)
|
|||
return 0;
|
||||
|
||||
if (!ni->attr_list) {
|
||||
Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni)
|
|||
}
|
||||
|
||||
/**
|
||||
* ntfs_inode_sync_standard_information - update standard informaiton attribute
|
||||
* ntfs_inode_sync_standard_information - update standard information attribute
|
||||
* @ni: ntfs inode to update standard information
|
||||
*
|
||||
* Return 0 on success or -1 on error with errno set to the error code.
|
||||
|
@ -499,7 +499,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni)
|
|||
if (MREF_LE(fn->parent_directory) == ni->mft_no) {
|
||||
/*
|
||||
* WARNING: We cheater here and obtain 2 attribute
|
||||
* search contextes for one inode (first we obtained
|
||||
* search contexts for one inode (first we obtained
|
||||
* above, second will be obtained inside
|
||||
* ntfs_index_lookup), it's acceptable for library,
|
||||
* but will lock kernel.
|
||||
|
@ -558,7 +558,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni)
|
|||
ntfs_index_ctx_put(ictx);
|
||||
ntfs_inode_close(index_ni);
|
||||
}
|
||||
/* Check for real error occured. */
|
||||
/* Check for real error occurred. */
|
||||
if (errno != ENOENT) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__);
|
||||
|
@ -723,9 +723,9 @@ int ntfs_inode_sync(ntfs_inode *ni)
|
|||
* Return 0 on success or -1 on error with errno set to the error code.
|
||||
* The following error codes are defined:
|
||||
* EINVAL - Invalid arguments were passed to the function.
|
||||
* EEXIST - Attibute list already exist.
|
||||
* EIO - Input/Ouput error occured.
|
||||
* ENOMEM - Not enogh memory to perform add.
|
||||
* EEXIST - Attribute list already exist.
|
||||
* EIO - Input/Ouput error occurred.
|
||||
* ENOMEM - Not enough memory to perform add.
|
||||
*/
|
||||
int ntfs_inode_add_attrlist(ntfs_inode *ni)
|
||||
{
|
||||
|
@ -737,7 +737,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni)
|
|||
ntfs_attr *na;
|
||||
|
||||
if (!ni) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni)
|
|||
ctx = ntfs_attr_get_search_ctx(ni, NULL);
|
||||
if (!ctx) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Coudn't get search context.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__);
|
||||
goto err_out;
|
||||
}
|
||||
/* Walk through all attributes. */
|
||||
|
@ -811,7 +811,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni)
|
|||
ctx->attr->name_length * sizeof(ntfschar));
|
||||
ale = (ATTR_LIST_ENTRY *)(al + al_len);
|
||||
}
|
||||
/* Check for real error occured. */
|
||||
/* Check for real error occurred. */
|
||||
if (errno != ENOENT) {
|
||||
err = errno;
|
||||
Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__);
|
||||
|
@ -885,7 +885,7 @@ remove_attrlist_record:
|
|||
Dprintf("%s(): Rollback failed. Failed to remove "
|
||||
"attribute list record.\n", __FUNCTION__);
|
||||
} else
|
||||
Dprintf("%s(): Rollback failed. Coudn't find attribute list "
|
||||
Dprintf("%s(): Rollback failed. Couldn't find attribute list "
|
||||
"record.\n", __FUNCTION__);
|
||||
/* Setup back in-memory runlist. */
|
||||
ni->attr_list = al;
|
||||
|
@ -944,7 +944,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size)
|
|||
int freed, err;
|
||||
|
||||
if (!ni || size < 0) {
|
||||
Dprintf("%s(): Invalid argumets.\n", __FUNCTION__);
|
||||
Dprintf("%s(): Invalid arguments.\n", __FUNCTION__);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
@ -968,9 +968,9 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size)
|
|||
}
|
||||
|
||||
/*
|
||||
* Chkdsk complain if $STANDART_INFORMATION is not in the base MFT
|
||||
* Chkdsk complain if $STANDARD_INFORMATION is not in the base MFT
|
||||
* record. FIXME: I'm not sure in this, need to recheck. For now simply
|
||||
* do not move $STANDART_INFORMATION at all.
|
||||
* do not move $STANDARD_INFORMATION at all.
|
||||
*
|
||||
* Also we can't move $ATTRIBUTE_LIST from base MFT_RECORD, so position
|
||||
* search context on first attribute after $STANDARD_INFORMATION and
|
||||
|
@ -1033,7 +1033,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size)
|
|||
}
|
||||
|
||||
/*
|
||||
* Repostion to first attribute after $STANDARD_INFORMATION and
|
||||
* Reposition to first attribute after $STANDARD_INFORMATION and
|
||||
* $ATTRIBUTE_LIST (see comments upwards).
|
||||
*/
|
||||
ntfs_attr_reinit_search_ctx(ctx);
|
||||
|
|
|
@ -222,7 +222,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp)
|
|||
"inconsistent log record header length.");
|
||||
return FALSE;
|
||||
}
|
||||
/* Dito for the log page data offset. */
|
||||
/* Ditto for the log page data offset. */
|
||||
if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) !=
|
||||
le16_to_cpu(ra->log_page_data_offset)) {
|
||||
ntfs_error(vi->i_sb, "$LogFile restart area specifies "
|
||||
|
@ -378,7 +378,7 @@ err_out:
|
|||
}
|
||||
|
||||
/**
|
||||
* ntfs_ckeck_logfile - check in the journal if the volume is consistent
|
||||
* ntfs_check_logfile - check in the journal if the volume is consistent
|
||||
* @log_na: ntfs attribute of loaded journal $LogFile to check
|
||||
*
|
||||
* Check the $LogFile journal for consistency and return TRUE if it is
|
||||
|
@ -442,7 +442,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na)
|
|||
* page header is at the beginning of a page we only need to search at
|
||||
* what could be the beginning of a page (for each page size) rather
|
||||
* than scanning the whole file byte by byte. If all potential places
|
||||
* contain empty and uninitialzed records, the log file can be assumed
|
||||
* contain empty and uninitialized records, the log file can be assumed
|
||||
* to be empty.
|
||||
*/
|
||||
for (pos = 0; pos < size; pos <<= 1) {
|
||||
|
@ -573,7 +573,7 @@ err_out:
|
|||
* of cases where we think that a volume is dirty when in fact it is clean.
|
||||
* This should only affect volumes that have not been shutdown cleanly but did
|
||||
* not have any pending, non-check-pointed i/o, i.e. they were completely idle
|
||||
* at least for the five seconds preceeding the unclean shutdown.
|
||||
* at least for the five seconds preceding the unclean shutdown.
|
||||
*
|
||||
* This function assumes that the $LogFile journal has already been consistency
|
||||
* checked by a call to ntfs_check_logfile() and in particular if the $LogFile
|
||||
|
|
|
@ -400,7 +400,7 @@ static inline unsigned int ntfs_ffz(unsigned int word)
|
|||
*
|
||||
* Return the free mft record on success and -1 on error with errno set to the
|
||||
* error code. An error code of ENOSPC means that there are no free mft
|
||||
* records in the currently initialized mft bitmal.
|
||||
* records in the currently initialized mft bitmap.
|
||||
*/
|
||||
static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni)
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol)
|
|||
ntfs_error(vol->sb, "Failed to merge runlists for mft "
|
||||
"bitmap.");
|
||||
if (ntfs_cluster_free_from_rl(vol, rl2))
|
||||
ntfs_error(vol->sb, "Failed to dealocate "
|
||||
ntfs_error(vol->sb, "Failed to deallocate "
|
||||
"cluster.%s", es);
|
||||
free(rl2);
|
||||
errno = ret;
|
||||
|
@ -665,7 +665,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol)
|
|||
// TODO: Deal with this by moving this extent to a new mft
|
||||
// record or by starting a new extent in a new mft record.
|
||||
ntfs_error(vol->sb, "Not enough space in this mft record to "
|
||||
"accomodate extended mft bitmap attribute "
|
||||
"accommodate extended mft bitmap attribute "
|
||||
"extent. Cannot handle this yet.");
|
||||
errno = ENOTSUP;
|
||||
goto undo_alloc;
|
||||
|
@ -931,7 +931,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol)
|
|||
ntfs_error(vol->sb, "Failed to merge runlists for mft data "
|
||||
"attribute.");
|
||||
if (ntfs_cluster_free_from_rl(vol, rl2))
|
||||
ntfs_error(vol->sb, "Failed to dealocate clusters "
|
||||
ntfs_error(vol->sb, "Failed to deallocate clusters "
|
||||
"from the mft data attribute.%s", es);
|
||||
free(rl2);
|
||||
errno = err;
|
||||
|
@ -987,7 +987,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol)
|
|||
// this extent is not required to find the mft record in
|
||||
// question.
|
||||
ntfs_error(vol->sb, "Not enough space in this mft record to "
|
||||
"accomodate extended mft data attribute "
|
||||
"accommodate extended mft data attribute "
|
||||
"extent. Cannot handle this yet.");
|
||||
errno = ENOTSUP;
|
||||
goto undo_alloc;
|
||||
|
@ -1133,7 +1133,7 @@ undo_alloc:
|
|||
* extend the initialized size (and data size) by 8 bytes, allocating another
|
||||
* cluster if required. The bitmap data size has to be at least equal to the
|
||||
* number of mft records in the mft, but it can be bigger, in which case the
|
||||
* superflous bits are padded with zeroes.
|
||||
* superfluous bits are padded with zeroes.
|
||||
*
|
||||
* Thus, when we return successfully (return value non-zero), we will have:
|
||||
* - initialized / extended the mft bitmap if necessary,
|
||||
|
@ -1144,7 +1144,7 @@ undo_alloc:
|
|||
* - return the ntfs_inode.
|
||||
*
|
||||
* On error (return value zero), nothing will have changed. If we had changed
|
||||
* anything before the error occured, we will have reverted back to the
|
||||
* anything before the error occurred, we will have reverted back to the
|
||||
* starting state before returning to the caller. Thus, except for bugs, we
|
||||
* should always leave the volume in a consistent state when returning from
|
||||
* this function.
|
||||
|
@ -1241,7 +1241,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni)
|
|||
bit = mftbmp_na->initialized_size << 3;
|
||||
if (ntfs_mft_bitmap_extend_initialized(vol))
|
||||
goto err_out;
|
||||
ntfs_debug("Status of mftbmp after initialized extention: "
|
||||
ntfs_debug("Status of mftbmp after initialized extension: "
|
||||
"allocated_size 0x%llx, data_size 0x%llx, "
|
||||
"initialized_size 0x%llx.",
|
||||
(long long)mftbmp_na->allocated_size,
|
||||
|
@ -1289,7 +1289,7 @@ found_free_rec:
|
|||
old_data_size = mft_na->data_size;
|
||||
/*
|
||||
* Extend mft data initialized size (and data size of course) to reach
|
||||
* the allocated mft record, formatting the mft records allong the way.
|
||||
* the allocated mft record, formatting the mft records along the way.
|
||||
* Note: We only modify the ntfs_attr structure as that is all that is
|
||||
* needed by ntfs_mft_record_format(). We will update the attribute
|
||||
* record itself in one fell swoop later on.
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* Return 0 on success and -1 on error, with errno set to the error code. The
|
||||
* following error codes are defined:
|
||||
* EINVAL Invalid arguments or invalid NTFS record in buffer @b.
|
||||
* EIO Mulit sector transfer error was detected. Magic of the NTFS
|
||||
* EIO Multi sector transfer error was detected. Magic of the NTFS
|
||||
* record in @b will have been set to "BAAD".
|
||||
*/
|
||||
int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
||||
|
@ -63,7 +63,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
|
|||
* u16 values before they are fixed up. Note no need to care for
|
||||
* endianness since we are comparing and moving data for on disk
|
||||
* structures which means the data is consistent. - If it is
|
||||
* consistenty the wrong endianness it doesn't make any difference.
|
||||
* consistency the wrong endianness it doesn't make any difference.
|
||||
*/
|
||||
usn = *usa_pos;
|
||||
/*
|
||||
|
|
|
@ -1261,7 +1261,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
|
|||
return -1;
|
||||
}
|
||||
prev_lcn = 0;
|
||||
/* Always need the termining zero byte. */
|
||||
/* Always need the terminating zero byte. */
|
||||
rls = 1;
|
||||
/* Do the first partial run if present. */
|
||||
if (start_vcn > rl->vcn) {
|
||||
|
@ -1331,7 +1331,7 @@ err_out:
|
|||
* write.
|
||||
*
|
||||
* This is used when building the mapping pairs array of a runlist to compress
|
||||
* a given logical cluster number (lcn) or a specific run length to the minumum
|
||||
* a given logical cluster number (lcn) or a specific run length to the minimum
|
||||
* size possible.
|
||||
*
|
||||
* Return the number of bytes written on success. On error, i.e. the
|
||||
|
|
|
@ -69,7 +69,7 @@ const u8 legal_ansi_char_array[0x40] = {
|
|||
*
|
||||
* Compare the names @s1 and @s2 and return TRUE (1) if the names are
|
||||
* identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE,
|
||||
* the @upcase table is used to performa a case insensitive comparison.
|
||||
* the @upcase table is used to perform a case insensitive comparison.
|
||||
*/
|
||||
BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len,
|
||||
const ntfschar *s2, size_t s2_len,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* unix_io.c - Unix stule disk io functions. Part of the Linux-NTFS project.
|
||||
* unix_io.c - Unix style disk io functions. Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2003 Anton Altaparmakov
|
||||
*
|
||||
|
@ -64,7 +64,7 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags)
|
|||
/* Setup our read-only flag. */
|
||||
if ((flags & O_RDWR) != O_RDWR)
|
||||
NDevSetReadOnly(dev);
|
||||
/* Acquire exlusive (mandatory) lock on the whole device. */
|
||||
/* Acquire exclusive (mandatory) lock on the whole device. */
|
||||
memset(&flk, 0, sizeof(flk));
|
||||
if (NDevReadOnly(dev))
|
||||
flk.l_type = F_RDLCK;
|
||||
|
@ -103,7 +103,7 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev)
|
|||
}
|
||||
if (NDevDirty(dev))
|
||||
fsync(DEV_FD(dev));
|
||||
/* Release exlusive (mandatory) lock on the whole device. */
|
||||
/* Release exclusive (mandatory) lock on the whole device. */
|
||||
memset(&flk, 0, sizeof(flk));
|
||||
flk.l_type = F_UNLCK;
|
||||
flk.l_whence = SEEK_SET;
|
||||
|
|
|
@ -199,7 +199,7 @@ static int ntfs_mft_load(ntfs_volume *vol)
|
|||
goto io_error_exit;
|
||||
}
|
||||
if (l != vol->mft_ni->attr_list_size) {
|
||||
Dputs("Error: got unexepected amount of data when reading "
|
||||
Dputs("Error: got unexpected amount of data when reading "
|
||||
"$MFT/$ATTRIBUTE_LIST.");
|
||||
goto io_error_exit;
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
|
|||
* Finally, check if the file system is mounted read-only, and if so set the
|
||||
* NTFS_MF_READONLY flag in *@mnt_flags.
|
||||
*
|
||||
* On sucess return 0 with *@mnt_flags set to the ntfs mount flags.
|
||||
* On success return 0 with *@mnt_flags set to the ntfs mount flags.
|
||||
*
|
||||
* On error return -1 with errno set to the error code.
|
||||
*/
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#if defined(linux) && defined(_IO) && !defined(BLKSSZGET)
|
||||
# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */
|
||||
# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
|
@ -211,7 +211,7 @@ struct {
|
|||
} opts;
|
||||
|
||||
/**
|
||||
* mkDprintf - debugging output (-vv); overriden by quiet (-q)
|
||||
* mkDprintf - debugging output (-vv); overridden by quiet (-q)
|
||||
*/
|
||||
static void mkDprintf(const char *fmt, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
@ -3015,7 +3015,7 @@ static void mkntfs_initialize_rl_mft(void)
|
|||
* The mft mirror is either 4kb (the first four records) or one cluster
|
||||
* in size, which ever is bigger. In either case, it contains a
|
||||
* byte-for-byte identical copy of the beginning of the mft (i.e. either
|
||||
* ther first four records (4kb) or the first cluster worth of records,
|
||||
* the first four records (4kb) or the first cluster worth of records,
|
||||
* whichever is bigger).
|
||||
*/
|
||||
j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size;
|
||||
|
@ -3731,7 +3731,7 @@ int main(int argc, char **argv)
|
|||
mkntfs_initialize_bitmaps();
|
||||
/* Initialize MFT & set opts.logfile_lcn. */
|
||||
mkntfs_initialize_rl_mft();
|
||||
/* Initlialize $LogFile. */
|
||||
/* Initialise $LogFile. */
|
||||
mkntfs_initialize_rl_logfile();
|
||||
/* Initialize $Boot. */
|
||||
mkntfs_initialize_rl_boot();
|
||||
|
|
|
@ -163,7 +163,7 @@ static int parse_options (int argc, char **argv)
|
|||
|
||||
attr = strtol(optarg, &s, 0);
|
||||
if (*s) {
|
||||
Eprintf("Coudn't parse attribute.\n");
|
||||
Eprintf("Couldn't parse attribute.\n");
|
||||
err++;
|
||||
} else
|
||||
opts.attribute = (ATTR_TYPES)attr;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
/* TODO:
|
||||
* - Remove the need for clipping at 64MiB.
|
||||
* - Add normal command line switchs (use getopt_long()).
|
||||
* - For a volume: allow dumping only uncommited records.
|
||||
* - For a volume: allow dumping only uncommitted records.
|
||||
* - For a file: get an optional command line parameter for the last SN.
|
||||
* - Sanity checks.
|
||||
*/
|
||||
|
|
|
@ -204,7 +204,7 @@ static int parse_options (int argc, char *argv[])
|
|||
opts.notime++;
|
||||
break;
|
||||
case 'T':
|
||||
/* 'T' is depreceted, notify */
|
||||
/* 'T' is deprecated, notify */
|
||||
Eprintf ("Option 'T' is deprecated, it was replaced by 't'.\n");
|
||||
err++;
|
||||
break;
|
||||
|
@ -287,7 +287,7 @@ static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock)
|
|||
|
||||
/**
|
||||
* ntfs_attr_get_name()
|
||||
* @attr: a vaild attribute record
|
||||
* @attr: a valid attribute record
|
||||
*
|
||||
* return multi-byte string containing the attribute name if exist. the user
|
||||
* is then responsible of freeing that memory.
|
||||
|
@ -569,7 +569,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol)
|
|||
printf("\tList name:\t\t '%s'\n",stream_name);
|
||||
free(stream_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol)
|
|||
for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *)
|
||||
((u8 *) entry + le16_to_cpu(entry->length))) {
|
||||
printf("\n");
|
||||
printf("\t\tAtrribute type:\t0x%x\n",
|
||||
printf("\t\tAttribute type:\t0x%x\n",
|
||||
(unsigned int)le32_to_cpu(entry->type));
|
||||
printf("\t\tRecord length:\t%u\n",
|
||||
le16_to_cpu(entry->length));
|
||||
|
@ -675,7 +675,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr)
|
|||
printf("\tFile Name:\t\t '%s'\n", mbs_file_name);
|
||||
free(mbs_file_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse file name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v
|
|||
data_size, sec_desc_attr);
|
||||
if (bytes_read != data_size) {
|
||||
Eprintf("ntfsinfo error: could not "
|
||||
"read secutiry descriptor\n");
|
||||
"read security descriptor\n");
|
||||
free(sec_desc_attr);
|
||||
return;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr)
|
|||
printf("\tVolume Name:\t\t '%s'\n",mbs_vol_name);
|
||||
free(mbs_vol_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr,"ntfsinfo error: could not parse volume name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol)
|
|||
printf("\tStream name:\t\t '%s'\n",stream_name);
|
||||
free(stream_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr)
|
|||
printf("\tIndex name:\t\t '%s'\n",index_name);
|
||||
free(index_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -1183,7 +1183,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr)
|
|||
type = le32_to_cpu(index_root->type);
|
||||
if (type) {
|
||||
if (index_root->type != AT_FILE_NAME) {
|
||||
/* wierd, this should be illgeal */
|
||||
/* weird, this should be illgeal */
|
||||
printf("0x%0X\n", type);
|
||||
fprintf(stderr, "ntfsinfo error: Unknown Indexed Attr Type: 0x%0X\n",
|
||||
type);
|
||||
|
@ -1375,7 +1375,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
|
|||
free(index_name);
|
||||
} else {
|
||||
/*
|
||||
* An error occured, errno holds the reason -
|
||||
* An error occurred, errno holds the reason -
|
||||
* notify the user
|
||||
*/
|
||||
fprintf(stderr, "ntfsinfo error: could not parse "
|
||||
|
@ -1395,7 +1395,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
|
|||
printf("\tUsed data size:\t\t %llu\n",
|
||||
(unsigned long long)le64_to_cpu(attr->data_size));
|
||||
} else {
|
||||
Eprintf("Invalid $INDEX_ALLOCTION attribute. Should be be"
|
||||
Eprintf("Invalid $INDEX_ALLOCATION attribute. Should be be"
|
||||
" non-resident\n");
|
||||
}
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr)
|
|||
printf("\tBitmap name:\t\t '%s'\n",bitmap_name);
|
||||
free(bitmap_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse bitmap name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -1567,7 +1567,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr)
|
|||
printf("\tAttribute name:\t '%s'\n",attr_name);
|
||||
free(attr_name);
|
||||
} else {
|
||||
/* an error occured, errno holds the reason - notify the user */
|
||||
/* an error occurred, errno holds the reason - notify the user */
|
||||
fprintf(stderr, "ntfsinfo error: could not parse attribute name: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -1666,7 +1666,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode)
|
|||
ntfs_attr_search_ctx *ctx = NULL;
|
||||
|
||||
/* then start enumerating attributes
|
||||
see ntfs_attr_lookup documentation for detailed explenation */
|
||||
see ntfs_attr_lookup documentation for detailed explanation */
|
||||
ctx = ntfs_attr_get_search_ctx(inode, NULL);
|
||||
while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) {
|
||||
switch (ctx->attr->type) {
|
||||
|
|
|
@ -447,7 +447,7 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent)
|
|||
if (tofree)
|
||||
free_dir(tofree);
|
||||
|
||||
/* if at the outter-most readdir_recursive, then clean up */
|
||||
/* if at the outer-most readdir_recursive, then clean up */
|
||||
if (ni_depth == 0) {
|
||||
free_dirs(&dirs.list);
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name,
|
|||
|
||||
result = 0;
|
||||
release:
|
||||
/* Release atrtibute search context and close the inode. */
|
||||
/* Release attribute search context and close the inode. */
|
||||
if (ctx)
|
||||
ntfs_attr_put_search_ctx(ctx);
|
||||
if (ni)
|
||||
|
|
|
@ -84,7 +84,7 @@ static struct {
|
|||
} opts;
|
||||
|
||||
/**
|
||||
* mkDprintf - debugging output (-vv); overriden by quiet (-q)
|
||||
* mkDprintf - debugging output (-vv); overridden by quiet (-q)
|
||||
*/
|
||||
static void mkDprintf(const char *fmt, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
@ -152,7 +152,7 @@ static void copyright(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* license - print licese statement
|
||||
* license - print license statement
|
||||
*/
|
||||
static void license(void)
|
||||
{
|
||||
|
|
|
@ -204,8 +204,8 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
|
|||
* after use.
|
||||
*
|
||||
* Return values:
|
||||
* <0 Error occured, return -errno;
|
||||
* 0 No stream name, @*stream is not allocated and set to AT_UNMAMED.
|
||||
* <0 Error occurred, return -errno;
|
||||
* 0 No stream name, @*stream is not allocated and set to AT_UNNAMED.
|
||||
* >0 Stream name length in unicode characters.
|
||||
*/
|
||||
static int ntfs_fuse_parse_path(const char *org_path, char **path,
|
||||
|
|
|
@ -640,7 +640,7 @@ static s64 move_runlist (ntfs_volume *vol, runlist_element *from,
|
|||
|
||||
// got to get the runlist out of this function
|
||||
// requires a mrec arg, not an ino (ino->mrec will do for now)
|
||||
// check size of new runlist before allocting / moving
|
||||
// check size of new runlist before allocating / moving
|
||||
// replace one datarun with another (by hand)
|
||||
static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec,
|
||||
runlist_element *run, u64 loc, int flags)
|
||||
|
|
|
@ -1049,7 +1049,7 @@ close_inode:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void build_resize_constrains(ntfs_resize_t *resize)
|
||||
static void build_resize_constraints(ntfs_resize_t *resize)
|
||||
{
|
||||
s64 i;
|
||||
runlist *rl;
|
||||
|
@ -1073,7 +1073,7 @@ static void build_resize_constrains(ntfs_resize_t *resize)
|
|||
free(rl);
|
||||
}
|
||||
|
||||
static void resize_constrains_by_attributes(ntfs_resize_t *resize)
|
||||
static void resize_constraints_by_attributes(ntfs_resize_t *resize)
|
||||
{
|
||||
if (!(resize->ctx = attr_get_search_ctx(resize->ni, NULL)))
|
||||
exit(1);
|
||||
|
@ -1081,18 +1081,18 @@ static void resize_constrains_by_attributes(ntfs_resize_t *resize)
|
|||
while (!ntfs_attrs_walk(resize->ctx)) {
|
||||
if (resize->ctx->attr->type == AT_END)
|
||||
break;
|
||||
build_resize_constrains(resize);
|
||||
build_resize_constraints(resize);
|
||||
}
|
||||
|
||||
ntfs_attr_put_search_ctx(resize->ctx);
|
||||
}
|
||||
|
||||
static void set_resize_constrains(ntfs_resize_t *resize)
|
||||
static void set_resize_constraints(ntfs_resize_t *resize)
|
||||
{
|
||||
s64 nr_mft_records, inode;
|
||||
ntfs_inode *ni;
|
||||
|
||||
printf("Collecting shrinkage constrains ...\n");
|
||||
printf("Collecting shrinkage constraints ...\n");
|
||||
|
||||
nr_mft_records = resize->vol->mft_na->initialized_size >>
|
||||
resize->vol->mft_record_size_bits;
|
||||
|
@ -1110,7 +1110,7 @@ static void set_resize_constrains(ntfs_resize_t *resize)
|
|||
goto close_inode;
|
||||
|
||||
resize->ni = ni;
|
||||
resize_constrains_by_attributes(resize);
|
||||
resize_constraints_by_attributes(resize);
|
||||
close_inode:
|
||||
if (inode_close(ni) != 0)
|
||||
exit(1);
|
||||
|
@ -1518,7 +1518,7 @@ static void rl_insert_at_run(runlist **rl, int run, runlist *ins)
|
|||
|
||||
return;
|
||||
|
||||
/* FIXME: fastpath if ins_items = 1 */
|
||||
/* FIXME: fast path if ins_items = 1 */
|
||||
// (*rl + run)->lcn = ins->lcn;
|
||||
}
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ int main(int argc, char **argv)
|
|||
if (new_size < vol->nr_clusters)
|
||||
resize.shrink = 1;
|
||||
|
||||
set_resize_constrains(&resize);
|
||||
set_resize_constraints(&resize);
|
||||
set_disk_usage_constraint(&resize);
|
||||
check_resize_constraints(&resize);
|
||||
|
||||
|
|
|
@ -1887,7 +1887,7 @@ static int ntfs_inode_close2 (ntfs_inode *ni)
|
|||
// unlink
|
||||
// ino->private_data
|
||||
|
||||
// XXX tempoarary until we have commit/rollback
|
||||
// XXX temporary until we have commit/rollback
|
||||
NInoClearDirty(ni);
|
||||
|
||||
return ntfs_inode_close (ni);
|
||||
|
@ -4524,7 +4524,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num)
|
|||
* successor.
|
||||
*/
|
||||
|
||||
// find the key nearest the root which has no descendents
|
||||
// find the key nearest the root which has no descendants
|
||||
printf ("\n");
|
||||
printf (BOLD YELLOW "Find childless parent:\n" END);
|
||||
for (par = del->parent, old = par; par; old = par, par = par->parent) {
|
||||
|
|
|
@ -93,7 +93,7 @@ struct {
|
|||
} opts;
|
||||
|
||||
/**
|
||||
* mkDprintf - debugging output (-vv); overriden by quiet (-q)
|
||||
* mkDprintf - debugging output (-vv); overridden by quiet (-q)
|
||||
*/
|
||||
static void mkDprintf(const char *fmt, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
@ -159,7 +159,7 @@ static void copyright(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* license - print licese statement
|
||||
* license - print license statement
|
||||
*/
|
||||
static void license(void)
|
||||
{
|
||||
|
|
|
@ -716,7 +716,7 @@ static void free_file (struct ufile *file)
|
|||
*
|
||||
* Check that @rec is the parent of the file represented by @name.
|
||||
* If @rec is a directory, but it is created after @name, then we
|
||||
* can't determine wheter @rec is really @name's parent.
|
||||
* can't determine whether @rec is really @name's parent.
|
||||
*
|
||||
* Return: @rec's filename, either same name space as @name or lowest space.
|
||||
* NULL if can't determine parenthood or on error.
|
||||
|
|
|
@ -91,7 +91,7 @@ struct data {
|
|||
long long size_init; /* Initialised size, may be less than data size */
|
||||
long long size_vcn; /* Highest VCN in the data runs */
|
||||
runlist_element *runlist; /* Decoded data runs */
|
||||
int percent; /* Amont potentially recoverable */
|
||||
int percent; /* Amount potentially recoverable */
|
||||
void *data; /* If resident, a pointer to the data */
|
||||
char padding[4]; /* Unused: padding to 64 bit. */
|
||||
};
|
||||
|
|
|
@ -352,7 +352,7 @@ static int parse_options (int argc, char *argv[])
|
|||
*
|
||||
* Read $Bitmap and wipe any clusters that are marked as not in use.
|
||||
*
|
||||
* Return: >0 Success, the atrribute was wiped
|
||||
* Return: >0 Success, the attribute was wiped
|
||||
* 0 Nothing to wipe
|
||||
* -1 Error, something went wrong
|
||||
*/
|
||||
|
@ -406,7 +406,7 @@ free:
|
|||
* @act: Wipe, test or info
|
||||
* @na: Opened ntfs attribute
|
||||
*
|
||||
* Return: >0 Success, the atrribute was wiped
|
||||
* Return: >0 Success, the attribute was wiped
|
||||
* 0 Nothing to wipe
|
||||
* -1 Error, something went wrong
|
||||
*/
|
||||
|
@ -511,7 +511,7 @@ next:
|
|||
* @act: Wipe, test or info
|
||||
* @na: Opened ntfs attribute
|
||||
*
|
||||
* Return: >0 Success, the atrribute was wiped
|
||||
* Return: >0 Success, the attribute was wiped
|
||||
* 0 Nothing to wipe
|
||||
* -1 Error, something went wrong
|
||||
*/
|
||||
|
@ -598,7 +598,7 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act)
|
|||
}
|
||||
|
||||
if (!NAttrNonResident(na)) {
|
||||
Vprintf ("Resident $DATA atrribute. Skipping.\n");
|
||||
Vprintf ("Resident $DATA attribute. Skipping.\n");
|
||||
goto close_attr;
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ free:
|
|||
* @byte: Overwrite with this value
|
||||
* @act: Wipe, test or info
|
||||
* @naa: Opened ntfs $INDEX_ALLOCATION attribute
|
||||
* @nab: Opened ntfs $BIMTAP attribute
|
||||
* @nab: Opened ntfs $BITMAP attribute
|
||||
* @indx_record_size: Size of INDX record
|
||||
*
|
||||
* Return: >0 Success, the clusters were wiped
|
||||
|
@ -1049,7 +1049,7 @@ close_inode:
|
|||
* @act: Wipe, test or info
|
||||
*
|
||||
* The logfile journals the metadata to give the volume fault-tolerance. If the
|
||||
* volume is in a consistant state, then this information can be erased.
|
||||
* volume is in a consistent state, then this information can be erased.
|
||||
*
|
||||
* Return: >0 Success, the clusters were wiped
|
||||
* 0 Nothing to wipe
|
||||
|
@ -1197,7 +1197,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act
|
|||
goto io_error_exit;
|
||||
}
|
||||
|
||||
/* Get length of pagfile.sys contents. */
|
||||
/* Get length of pagefile.sys contents. */
|
||||
len = na->data_size;
|
||||
if (!len) {
|
||||
Dprintf("pagefile.sys has zero length, no disk write needed.\n");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/**
|
||||
* init_system_file_sd
|
||||
*
|
||||
* NTFS 1.2 - System files security decriptors
|
||||
* NTFS 1.2 - System files security descriptors
|
||||
* ===========================================
|
||||
*
|
||||
* Create the security descriptor for system file number @sys_file_no and
|
||||
|
@ -15,14 +15,14 @@
|
|||
*
|
||||
* $Volume, $Quota, and system files 0xb-0xf are the same. They are almost the
|
||||
* same as the above, the only difference being that the two SIDs present in
|
||||
* the DACL grant GENERIC_WRITE and GENERIC_READ equivalent priviledges while
|
||||
* the above only grant GENERIC_READ equivalent priviledges. (For some reason
|
||||
* the DACL grant GENERIC_WRITE and GENERIC_READ equivalent privileges while
|
||||
* the above only grant GENERIC_READ equivalent privileges. (For some reason
|
||||
* the flags for GENERIC_READ/GENERIC_WRITE are not set by NT4, even though
|
||||
* the permissions are equivalent, so we comply.
|
||||
*
|
||||
* Root directory system file (".") is different altogether.
|
||||
*
|
||||
* The sd is recturned in *@sd_val and has length *@sd_val_len.
|
||||
* The sd is returned in *@sd_val and has length *@sd_val_len.
|
||||
*
|
||||
* Do NOT free *@sd_val as it is static memory. This also means that you can
|
||||
* only use *@sd_val until the next call to this function.
|
||||
|
|
Loading…
Reference in New Issue