* It is up to the caller to serialize access to the run lists @dst and @src.
*
* Return: TRUE Success, the run lists can be merged.
- * FALSE Failure, the run lists cannot be merged.
+ * FALSE Failure, the run lists cannot be merged.
*/
static inline BOOL ntfs_are_rl_mergeable(run_list_element *dst,
run_list_element *src)
* It is up to the caller to serialize access to the run lists @dst and @src.
*
* Return: TRUE Success, the run lists have been merged.
- * FALSE Failure, the run lists cannot be merged and have not been
+ * FALSE Failure, the run lists cannot be merged and have not been
* modified.
*/
static inline BOOL ntfs_rl_merge(run_list_element *dst, run_list_element *src)
BUG_ON(!src);
/* disc => Discontinuity between the end of @dst and the start of @src.
- * This means we might need to insert a hole.
+ * This means we might need to insert a hole.
* hole => @dst ends with a hole or an unmapped region which we can
- * extend to match the discontinuity. */
+ * extend to match the discontinuity. */
if (loc == 0)
disc = (src[0].vcn > 0);
else {
ntfs_rl_mc(dst, loc + 1, src, 0, ssize);
/* Adjust the size of the holes either size of @src. */
- dst[loc].length = dst[loc+1].vcn - dst[loc].vcn;
+ dst[loc].length = dst[loc+1].vcn - dst[loc].vcn;
dst[loc+ssize+1].vcn = dst[loc+ssize].vcn + dst[loc+ssize].length;
dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn;
ntfs_debug_dump_runlist(srl);
#endif
- /* Check for silly calling... */
+ /* Check for silly calling... */
if (unlikely(!srl))
return drl;
if (unlikely(IS_ERR(srl) || IS_ERR(drl)))
if (drl[ds].vcn == marker_vcn) {
ntfs_debug("Old marker = 0x%llx, replacing "
- "with LCN_ENOENT.\n",
+ "with LCN_ENOENT.",
(unsigned long long)
drl[ds].lcn);
drl[ds].lcn = (LCN)LCN_ENOENT;
*
* The following error codes are defined:
* -ENOMEM - Not enough memory to allocate run list array.
- * -EIO - Corrupt run list.
- * -EINVAL - Invalid parameters were passed in.
- * -ERANGE - The two run lists overlap.
+ * -EIO - Corrupt run list.
+ * -EINVAL - Invalid parameters were passed in.
+ * -ERANGE - The two run lists overlap.
*
* FIXME: For now we take the conceptionally simplest approach of creating the
* new run list disregarding the already existing one and then splicing the
const ATTR_RECORD *attr, run_list_element *old_rl)
{
VCN vcn; /* Current vcn. */
- LCN lcn; /* Current lcn. */
+ LCN lcn; /* Current lcn. */
s64 deltaxcn; /* Change in [vl]cn. */
run_list_element *rl; /* The output run list. */
u8 *buf; /* Current position in mapping pairs array. */
*/
if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) {
run_list_element *rl2;
-
+
rl2 = ntfs_malloc_nofs(rlsize + (int)PAGE_SIZE);
if (unlikely(!rl2)) {
ntfs_free(rl);
attr_search_context *ctx;
MFT_RECORD *mrec;
int err = 0;
-
+
ntfs_debug("Mapping run list part containing vcn 0x%llx.",
(unsigned long long)vcn);
err = -ENOMEM;
goto err_out;
}
- if (!lookup_attr(ni->type, ni->name, ni->name_len, IGNORE_CASE, vcn,
+ if (!lookup_attr(ni->type, ni->name, ni->name_len, CASE_SENSITIVE, vcn,
NULL, 0, ctx)) {
put_attr_search_ctx(ctx);
err = -ENOENT;
ni->run_list.rl = rl;
}
up_write(&ni->run_list.lock);
-
+
put_attr_search_ctx(ctx);
err_out:
unmap_mft_record(base_ni);
* Warning: Never use @val when looking for attribute types which can be
* non-resident as this most likely will result in a crash!
*/
-BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
+BOOL find_attr(const ATTR_TYPES type, const ntfschar *name, const u32 name_len,
const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len,
attr_search_context *ctx)
{
ATTR_RECORD *a;
ntfs_volume *vol;
- uchar_t *upcase;
+ ntfschar *upcase;
u32 upcase_len;
if (ic == IGNORE_CASE) {
if (a->name_length)
return FALSE;
} else if (!ntfs_are_names_equal(name, name_len,
- (uchar_t*)((u8*)a + le16_to_cpu(a->name_offset)),
+ (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)),
a->name_length, ic, upcase, upcase_len)) {
register int rc;
-
+
rc = ntfs_collate_names(name, name_len,
- (uchar_t*)((u8*)a +
+ (ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)),
a->name_length, 1, IGNORE_CASE,
upcase, upcase_len);
return FALSE;
/* If the strings are not equal, continue search. */
if (rc)
- continue;
+ continue;
rc = ntfs_collate_names(name, name_len,
- (uchar_t*)((u8*)a +
+ (ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)),
a->name_length, 1, CASE_SENSITIVE,
upcase, upcase_len);
* base inode).
*
* After finishing with the attribute/mft record you need to call
- * release_attr_search_ctx() to cleanup the search context (unmapping any
- * mapped inodes, etc).
+ * put_attr_search_ctx() to cleanup the search context (unmapping any mapped
+ * inodes, etc).
*
* Return TRUE if the search was successful and FALSE if not. When TRUE,
* @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When
* and if there is not enough space, the attribute should be placed in an
* extent mft record.
*/
-static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
+static BOOL find_external_attr(const ATTR_TYPES type, const ntfschar *name,
const u32 name_len, const IGNORE_CASE_BOOL ic,
const VCN lowest_vcn, const u8 *val, const u32 val_len,
attr_search_context *ctx)
ATTR_LIST_ENTRY *al_entry, *next_al_entry;
u8 *al_start, *al_end;
ATTR_RECORD *a;
- uchar_t *al_name;
+ ntfschar *al_name;
u32 al_name_len;
ni = ctx->ntfs_ino;
* missing, assume we want an unnamed attribute.
*/
al_name_len = al_entry->name_length;
- al_name = (uchar_t*)((u8*)al_entry + al_entry->name_offset);
+ al_name = (ntfschar*)((u8*)al_entry + al_entry->name_offset);
if (!name) {
if (al_name_len)
goto not_found;
if (lowest_vcn && (u8*)next_al_entry >= al_start &&
(u8*)next_al_entry + 6 < al_end &&
(u8*)next_al_entry + le16_to_cpu(
- next_al_entry->length) <= al_end &&
+ next_al_entry->length) <= al_end &&
sle64_to_cpu(next_al_entry->lowest_vcn) <=
sle64_to_cpu(lowest_vcn) &&
next_al_entry->type == al_entry->type &&
next_al_entry->name_length == al_name_len &&
- ntfs_are_names_equal((uchar_t*)((u8*)
+ ntfs_are_names_equal((ntfschar*)((u8*)
next_al_entry +
next_al_entry->name_offset),
next_al_entry->name_length,
if (name) {
if (a->name_length != al_name_len)
continue;
- if (!ntfs_are_names_equal((uchar_t*)((u8*)a +
+ if (!ntfs_are_names_equal((ntfschar*)((u8*)a +
le16_to_cpu(a->name_offset)),
a->name_length, al_name, al_name_len,
CASE_SENSITIVE, vol->upcase,
goto do_next_attr_loop;
}
ntfs_error(base_ni->vol->sb, "Inode contains corrupt attribute list "
- "attribute.\n");
+ "attribute.");
if (ni != base_ni) {
unmap_extent_mft_record(ni);
ctx->ntfs_ino = base_ni;
* continue searches where they were left off at.
*
* After finishing with the attribute/mft record you need to call
- * release_attr_search_ctx() to cleanup the search context (unmapping any
- * mapped inodes, etc).
+ * put_attr_search_ctx() to cleanup the search context (unmapping any mapped
+ * inodes, etc).
*
* Return TRUE if the search was successful and FALSE if not. When TRUE,
* @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When
* being searched for, i.e. if one wants to add the attribute to the mft
* record this is the correct place to insert it into.
*/
-BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
- const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val,
- const u32 val_len, attr_search_context *ctx)
+BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name,
+ const u32 name_len, const IGNORE_CASE_BOOL ic,
+ const VCN lowest_vcn, const u8 *val, const u32 val_len,
+ attr_search_context *ctx)
{
ntfs_inode *base_ni;