- Rename {find,lookup}_attr() to ntfs_attr_{find,lookup}() as well as
find_external_attr() to ntfs_external_attr_find() to cleanup the
namespace a bit and to be more consistent with libntfs.
+ - Rename {{re,}init,get,put}_attr_search_ctx() to
+ ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type
+ attr_search_context to ntfs_attr_search_ctx.
2.1.17 - Fix bugs in mount time error code paths and other updates.
s64 attr_pos;
ntfs_inode *ni, *base_ni;
u8 *kaddr;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
MFT_RECORD *mrec;
u32 attr_len;
int err = 0;
err = PTR_ERR(mrec);
goto err_out;
}
- ctx = get_attr_search_ctx(base_ni, mrec);
+ ctx = ntfs_attr_get_search_ctx(base_ni, mrec);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto unm_err_out;
SetPageUptodate(page);
put_unm_err_out:
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unm_err_out:
unmap_mft_record(base_ni);
err_out:
struct inode *vi;
ntfs_inode *ni, *base_ni;
char *kaddr;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
MFT_RECORD *m;
u32 attr_len, bytes;
int err;
ctx = NULL;
goto err_out;
}
- ctx = get_attr_search_ctx(base_ni, m);
+ ctx = ntfs_attr_get_search_ctx(base_ni, m);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto err_out;
/* Mark the mft record dirty, so it gets written back. */
mark_mft_record_dirty(ctx->ntfs_ino);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
return 0;
err_out:
}
unlock_page(page);
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(base_ni);
return err;
* We thus defer the uptodate bringing of the page region outside the
* region written to to ntfs_commit_write(). The reason for doing this
* is that we save one round of:
- * map_mft_record(), get_attr_search_ctx(), ntfs_attr_lookup(),
- * kmap_atomic(), kunmap_atomic(), put_attr_search_ctx(),
- * unmap_mft_record().
+ * map_mft_record(), ntfs_attr_get_search_ctx(),
+ * ntfs_attr_lookup(), kmap_atomic(), kunmap_atomic(),
+ * ntfs_attr_put_search_ctx(), unmap_mft_record().
* Which is obviously a very worthwhile save.
*
* Thus we just return success now...
struct inode *vi;
ntfs_inode *ni, *base_ni;
char *kaddr, *kattr;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
MFT_RECORD *m;
u32 attr_len, bytes;
int err;
ctx = NULL;
goto err_out;
}
- ctx = get_attr_search_ctx(base_ni, m);
+ ctx = ntfs_attr_get_search_ctx(base_ni, m);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto err_out;
/* Mark the mft record dirty, so it gets written back. */
mark_mft_record_dirty(ctx->ntfs_ino);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
ntfs_debug("Done.");
return 0;
SetPageError(page);
}
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(base_ni);
return err;
int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
{
ntfs_inode *base_ni;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
MFT_RECORD *mrec;
int err = 0;
mrec = map_mft_record(base_ni);
if (IS_ERR(mrec))
return PTR_ERR(mrec);
- ctx = get_attr_search_ctx(base_ni, mrec);
+ ctx = ntfs_attr_get_search_ctx(base_ni, mrec);
if (!ctx) {
err = -ENOMEM;
goto err_out;
}
if (!ntfs_attr_lookup(ni->type, ni->name, ni->name_len, CASE_SENSITIVE,
vcn, NULL, 0, ctx)) {
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
err = -ENOENT;
goto err_out;
}
}
up_write(&ni->runlist.lock);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
err_out:
unmap_mft_record(base_ni);
return err;
*/
BOOL ntfs_attr_find(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)
+ const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx)
{
ATTR_RECORD *a;
ntfs_volume *vol;
* in there and return it.
*
* On first search @ctx->ntfs_ino must be the base mft record and @ctx must
- * have been obtained from a call to get_attr_search_ctx(). On subsequent
+ * have been obtained from a call to ntfs_attr_get_search_ctx(). On subsequent
* calls @ctx->ntfs_ino can be any extent inode, too (@ctx->base_ntfs_ino is
* then the base inode).
*
* After finishing with the attribute/mft record you need to call
- * put_attr_search_ctx() to cleanup the search context (unmapping any mapped
- * inodes, etc).
+ * ntfs_attr_put_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
static BOOL ntfs_external_attr_find(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)
+ const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx)
{
ntfs_inode *base_ni, *ni;
ntfs_volume *vol;
*
* FIXME: Do we really want to do this here? Think about it... (AIA)
*/
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx);
ntfs_debug("Done, not found.");
return FALSE;
*
* Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must
* be the base mft record and @ctx must have been obtained from a call to
- * get_attr_search_ctx().
+ * ntfs_attr_get_search_ctx().
*
* This function transparently handles attribute lists and @ctx is used to
* continue searches where they were left off at.
*
* After finishing with the attribute/mft record you need to call
- * put_attr_search_ctx() to cleanup the search context (unmapping any mapped
- * inodes, etc).
+ * ntfs_attr_put_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
BOOL ntfs_attr_lookup(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_attr_search_ctx *ctx)
{
ntfs_inode *base_ni;
}
/**
- * init_attr_search_ctx - initialize an attribute search context
+ * ntfs_attr_init_search_ctx - initialize an attribute search context
* @ctx: attribute search context to initialize
* @ni: ntfs inode with which to initialize the search context
* @mrec: mft record with which to initialize the search context
*
* Initialize the attribute search context @ctx with @ni and @mrec.
*/
-static inline void init_attr_search_ctx(attr_search_context *ctx,
+static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx,
ntfs_inode *ni, MFT_RECORD *mrec)
{
ctx->mrec = mrec;
}
/**
- * reinit_attr_search_ctx - reinitialize an attribute search context
+ * ntfs_attr_reinit_search_ctx - reinitialize an attribute search context
* @ctx: attribute search context to reinitialize
*
* Reinitialize the attribute search context @ctx, unmapping an associated
* This is used when a search for a new attribute is being started to reset
* the search context to the beginning.
*/
-void reinit_attr_search_ctx(attr_search_context *ctx)
+void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx)
{
if (likely(!ctx->base_ntfs_ino)) {
/* No attribute list. */
} /* Attribute list. */
if (ctx->ntfs_ino != ctx->base_ntfs_ino)
unmap_extent_mft_record(ctx->ntfs_ino);
- init_attr_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec);
+ ntfs_attr_init_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec);
return;
}
/**
- * get_attr_search_ctx - allocate and initialize a new attribute search context
+ * ntfs_attr_get_search_ctx - allocate/initialize a new attribute search context
* @ni: ntfs inode with which to initialize the search context
* @mrec: mft record with which to initialize the search context
*
* Allocate a new attribute search context, initialize it with @ni and @mrec,
* and return it. Return NULL if allocation failed.
*/
-attr_search_context *get_attr_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec)
+ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec)
{
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ctx = kmem_cache_alloc(ntfs_attr_ctx_cache, SLAB_NOFS);
if (ctx)
- init_attr_search_ctx(ctx, ni, mrec);
+ ntfs_attr_init_search_ctx(ctx, ni, mrec);
return ctx;
}
/**
- * put_attr_search_ctx - release an attribute search context
+ * ntfs_attr_put_search_ctx - release an attribute search context
* @ctx: attribute search context to free
*
* Release the attribute search context @ctx, unmapping an associated extent
* mft record if present.
*/
-void put_attr_search_ctx(attr_search_context *ctx)
+void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx)
{
if (ctx->base_ntfs_ino && ctx->ntfs_ino != ctx->base_ntfs_ino)
unmap_extent_mft_record(ctx->ntfs_ino);
kmem_cache_free(ntfs_attr_ctx_cache, ctx);
return;
}
-
} LCN_SPECIAL_VALUES;
/**
- * attr_search_context - used in attribute search functions
+ * ntfs_attr_search_ctx - used in attribute search functions
* @mrec: buffer containing mft record to search
* @attr: attribute record in @mrec where to begin/continue search
* @is_first: if true ntfs_attr_lookup() begins search with @attr, else after
ntfs_inode *base_ntfs_ino;
MFT_RECORD *base_mrec;
ATTR_RECORD *base_attr;
-} attr_search_context;
+} ntfs_attr_search_ctx;
extern runlist_element *decompress_mapping_pairs(const ntfs_volume *vol,
const ATTR_RECORD *attr, runlist_element *old_rl);
extern BOOL ntfs_attr_find(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);
+ const u32 val_len, ntfs_attr_search_ctx *ctx);
BOOL ntfs_attr_lookup(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_attr_search_ctx *ctx);
extern int load_attribute_list(ntfs_volume *vol, runlist *rl, u8 *al_start,
const s64 size, const s64 initialized_size);
return sle64_to_cpu(a->data.non_resident.data_size);
}
-extern void reinit_attr_search_ctx(attr_search_context *ctx);
-extern attr_search_context *get_attr_search_ctx(ntfs_inode *ni,
+extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx);
+extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni,
MFT_RECORD *mrec);
-extern void put_attr_search_ctx(attr_search_context *ctx);
+extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx);
#endif /* _LINUX_NTFS_ATTRIB_H */
INDEX_ALLOCATION *ia;
u8 *index_end;
u64 mref;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
int err, rc;
VCN vcn, old_vcn;
struct address_space *ia_mapping;
-PTR_ERR(m));
return ERR_MREF(PTR_ERR(m));
}
- ctx = get_attr_search_ctx(dir_ni, m);
+ ctx = ntfs_attr_get_search_ctx(dir_ni, m);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto err_out;
*res = NULL;
}
mref = le64_to_cpu(ie->data.dir.indexed_file);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(dir_ni);
return mref;
}
*/
if (!(ie->flags & INDEX_ENTRY_NODE)) {
if (name) {
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(dir_ni);
return name->mref;
}
* We are done with the index root and the mft record. Release them,
* otherwise we deadlock with ntfs_map_page().
*/
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(dir_ni);
m = NULL;
ctx = NULL;
ntfs_unmap_page(page);
err_out:
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(dir_ni);
if (name) {
INDEX_ALLOCATION *ia;
u8 *index_end;
u64 mref;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
int err, rc;
IGNORE_CASE_BOOL ic;
VCN vcn, old_vcn;
-PTR_ERR(m));
return ERR_MREF(PTR_ERR(m));
}
- ctx = get_attr_search_ctx(dir_ni, m);
+ ctx = ntfs_attr_get_search_ctx(dir_ni, m);
if (!ctx) {
err = -ENOMEM;
goto err_out;
vol->upcase, vol->upcase_len)) {
found_it:
mref = le64_to_cpu(ie->data.dir.indexed_file);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(dir_ni);
return mref;
}
* We are done with the index root and the mft record. Release them,
* otherwise we deadlock with ntfs_map_page().
*/
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(dir_ni);
m = NULL;
ctx = NULL;
ntfs_unmap_page(page);
err_out:
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(dir_ni);
return ERR_MREF(err);
struct address_space *ia_mapping, *bmp_mapping;
struct page *bmp_page = NULL, *ia_page = NULL;
u8 *kaddr, *bmp, *index_end;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
fpos = filp->f_pos;
ntfs_debug("Entering for inode 0x%lx, fpos 0x%llx.",
m = NULL;
goto err_out;
}
- ctx = get_attr_search_ctx(ndir, m);
+ ctx = ntfs_attr_get_search_ctx(ndir, m);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto err_out;
/* Copy the index root value (it has been verified in read_inode). */
memcpy(ir, (u8*)ctx->attr +
le16_to_cpu(ctx->attr->data.resident.value_offset), rc);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ndir);
ctx = NULL;
m = NULL;
if (name)
kfree(name);
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(ndir);
if (!err)
if (ictx->entry) {
if (ictx->is_in_root) {
if (ictx->actx)
- put_attr_search_ctx(ictx->actx);
+ ntfs_attr_put_search_ctx(ictx->actx);
if (ictx->base_ni)
unmap_mft_record(ictx->base_ni);
} else {
INDEX_ENTRY *ie;
INDEX_ALLOCATION *ia;
u8 *index_end;
- attr_search_context *actx;
+ ntfs_attr_search_ctx *actx;
int rc, err = 0;
VCN vcn, old_vcn;
struct address_space *ia_mapping;
-PTR_ERR(m));
return PTR_ERR(m);
}
- actx = get_attr_search_ctx(base_ni, m);
+ actx = ntfs_attr_get_search_ctx(base_ni, m);
if (unlikely(!actx)) {
err = -ENOMEM;
goto err_out;
* We are done with the index root and the mft record. Release them,
* otherwise we deadlock with ntfs_map_page().
*/
- put_attr_search_ctx(actx);
+ ntfs_attr_put_search_ctx(actx);
unmap_mft_record(base_ni);
m = NULL;
actx = NULL;
ntfs_unmap_page(page);
err_out:
if (actx)
- put_attr_search_ctx(actx);
+ ntfs_attr_put_search_ctx(actx);
if (m)
unmap_mft_record(base_ni);
return err;
u16 data_len;
BOOL is_in_root;
INDEX_ROOT *ir;
- attr_search_context *actx;
+ ntfs_attr_search_ctx *actx;
ntfs_inode *base_ni;
INDEX_ALLOCATION *ia;
struct page *page;
* 0: file is not in $Extend directory
* -EIO: file is corrupt
*/
-static int ntfs_is_extended_system_file(attr_search_context *ctx)
+static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
{
int nr_links;
/* Restart search. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
/* Get number of hard links. */
nr_links = le16_to_cpu(ctx->mrec->link_count);
ntfs_inode *ni;
MFT_RECORD *m;
STANDARD_INFORMATION *si;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
int err = 0;
ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
err = PTR_ERR(m);
goto err_out;
}
- ctx = get_attr_search_ctx(ni, m);
+ ctx = ntfs_attr_get_search_ctx(ni, m);
if (!ctx) {
err = -ENOMEM;
goto unm_err_out;
vi->i_atime = ntfs2utc(si->last_access_time);
/* Find the attribute list attribute if present. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, 0, 0, NULL, 0, ctx)) {
if (vi->i_ino == FILE_MFT)
goto skip_attr_list_load;
char *ir_end, *index_end;
/* It is a directory, find index root attribute. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0,
NULL, 0, ctx)) {
// FIXME: File is corrupt! Hot-fix with empty index
vi->i_size = ni->initialized_size =
ni->allocated_size = 0;
/* We are done with the mft record, so we release it. */
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
m = NULL;
ctx = NULL;
} /* LARGE_INDEX: Index allocation present. Setup state. */
NInoSetIndexAllocPresent(ni);
/* Find index allocation attribute. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
if (!ntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4,
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute "
* We are done with the mft record, so we release it. Otherwise
* we would deadlock in ntfs_attr_iget().
*/
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
m = NULL;
ctx = NULL;
vi->i_mapping->a_ops = &ntfs_mst_aops;
} else {
/* It is a file. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
/* Setup the data attribute, even if not present. */
ni->type = AT_DATA;
}
no_data_attr_special_case:
/* We are done with the mft record, so we release it. */
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
m = NULL;
ctx = NULL;
if (!err)
err = -EIO;
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(ni);
err_out:
ntfs_volume *vol = NTFS_SB(vi->i_sb);
ntfs_inode *ni, *base_ni;
MFT_RECORD *m;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
int err = 0;
ntfs_debug("Entering for i_ino 0x%lx.", vi->i_ino);
err = PTR_ERR(m);
goto err_out;
}
- ctx = get_attr_search_ctx(base_ni, m);
+ ctx = ntfs_attr_get_search_ctx(base_ni, m);
if (!ctx) {
err = -ENOMEM;
goto unm_err_out;
ni->ext.base_ntfs_ino = base_ni;
ni->nr_extents = -1;
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
ntfs_debug("Done.");
if (!err)
err = -EIO;
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
err_out:
ntfs_error(vi->i_sb, "Failed with error code %i while reading "
ntfs_inode *ni, *base_ni, *bni;
struct inode *bvi;
MFT_RECORD *m;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
INDEX_ROOT *ir;
u8 *ir_end, *index_end;
int err = 0;
err = PTR_ERR(m);
goto err_out;
}
- ctx = get_attr_search_ctx(base_ni, m);
+ ctx = ntfs_attr_get_search_ctx(base_ni, m);
if (!ctx) {
err = -ENOMEM;
goto unm_err_out;
/* No index allocation. */
vi->i_size = ni->initialized_size = ni->allocated_size = 0;
/* We are done with the mft record, so we release it. */
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
m = NULL;
ctx = NULL;
} /* LARGE_INDEX: Index allocation present. Setup state. */
NInoSetIndexAllocPresent(ni);
/* Find index allocation attribute. */
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
if (!ntfs_attr_lookup(AT_INDEX_ALLOCATION, ni->name, ni->name_len,
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
ntfs_error(vi->i_sb, "$INDEX_ALLOCATION attribute is not "
* We are done with the mft record, so we release it. Otherwise
* we would deadlock in ntfs_attr_iget().
*/
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(base_ni);
m = NULL;
ctx = NULL;
if (!err)
err = -EIO;
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(base_ni);
err_out:
ntfs_inode *ni;
MFT_RECORD *m = NULL;
ATTR_RECORD *attr;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
unsigned int i, nr_blocks;
int err;
/* Provides readpage() and sync_page() for map_mft_record(). */
vi->i_mapping->a_ops = &ntfs_mft_aops;
- ctx = get_attr_search_ctx(ni, m);
+ ctx = ntfs_attr_get_search_ctx(ni, m);
if (!ctx) {
err = -ENOMEM;
goto err_out;
}
}
- reinit_attr_search_ctx(ctx);
+ ntfs_attr_reinit_search_ctx(ctx);
/* Now load all attribute extents. */
attr = NULL;
"saw this message to "
"linux-ntfs-dev@lists."
"sourceforge.net");
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
/* Revert to the safe super operations. */
ntfs_free(m);
return -1;
(unsigned long long)last_vcn - 1);
goto put_err_out;
}
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
ntfs_debug("Done.");
ntfs_free(m);
return 0;
ntfs_error(sb, "Couldn't find first extent of $DATA attribute in "
"attribute list. $MFT is corrupt. Run chkdsk.");
put_err_out:
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
err_out:
ntfs_error(sb, "Failed. Marking inode as bad.");
make_bad_inode(vi);
{
s64 nt;
ntfs_inode *ni = NTFS_I(vi);
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
MFT_RECORD *m;
STANDARD_INFORMATION *si;
int err = 0;
goto err_out;
}
/* Update the access times in the standard information attribute. */
- ctx = get_attr_search_ctx(ni, m);
+ ctx = ntfs_attr_get_search_ctx(ni, m);
if (unlikely(!ctx)) {
err = -ENOMEM;
goto unm_err_out;
}
if (unlikely(!ntfs_attr_lookup(AT_STANDARD_INFORMATION, NULL, 0,
CASE_SENSITIVE, 0, NULL, 0, ctx))) {
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
err = -ENOENT;
goto unm_err_out;
}
*/
if (modified && !NInoTestSetDirty(ctx->ntfs_ino))
__set_page_dirty_nobuffers(ctx->ntfs_ino->page);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
/* Now the access times are updated, write the base mft record. */
if (NInoDirty(ni))
err = write_mft_record(ni, m, sync);
{
struct dentry *real_dent, *new_dent;
MFT_RECORD *m;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ntfs_inode *ni = NTFS_I(dent_inode);
int err;
struct qstr nls_name;
ctx = NULL;
goto err_out;
}
- ctx = get_attr_search_ctx(ni, m);
+ ctx = ntfs_attr_get_search_ctx(ni, m);
if (!ctx) {
err = -ENOMEM;
goto err_out;
(ntfschar*)&fn->file_name, fn->file_name_length,
(unsigned char**)&nls_name.name, 0);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
}
m = NULL;
err = -EIO;
err_out:
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(ni);
iput(dent_inode);
struct inode *vi = child_dent->d_inode;
ntfs_inode *ni = NTFS_I(vi);
MFT_RECORD *mrec;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ATTR_RECORD *attr;
FILE_NAME_ATTR *fn;
struct inode *parent_vi;
if (IS_ERR(mrec))
return (struct dentry *)mrec;
/* Find the first file name attribute in the mft record. */
- ctx = get_attr_search_ctx(ni, mrec);
+ ctx = ntfs_attr_get_search_ctx(ni, mrec);
if (unlikely(!ctx)) {
unmap_mft_record(ni);
return ERR_PTR(-ENOMEM);
try_next:
if (unlikely(!ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE,
0, NULL, 0, ctx))) {
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
ntfs_error(vi->i_sb, "Inode 0x%lx does not have a file name "
"attribute. Run chkdsk.", vi->i_ino);
/* Get the inode number of the parent directory. */
parent_ino = MREF_LE(fn->parent_directory);
/* Release the search context and the mft record of the child. */
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
/* Get the inode of the parent directory. */
parent_vi = ntfs_iget(vi->i_sb, parent_ino);
ntfs_inode *ni = NTFS_I(vol->vol_ino);
MFT_RECORD *m;
VOLUME_INFORMATION *vi;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
int err;
ntfs_debug("Entering, old flags = 0x%x, new flags = 0x%x.",
err = PTR_ERR(m);
goto err_out;
}
- ctx = get_attr_search_ctx(ni, m);
+ ctx = ntfs_attr_get_search_ctx(ni, m);
if (!ctx) {
err = -ENOMEM;
goto put_unm_err_out;
vol->vol_flags = vi->flags = flags;
flush_dcache_mft_record_page(ctx->ntfs_ino);
mark_mft_record_dirty(ctx->ntfs_ino);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
done:
ntfs_debug("Done.");
return 0;
put_unm_err_out:
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
err_out:
ntfs_error(vol->sb, "Failed with error code %i.", -err);
struct super_block *sb = vol->sb;
MFT_RECORD *m;
VOLUME_INFORMATION *vi;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ntfs_debug("Entering.");
#ifdef NTFS_RW
iput(vol->vol_ino);
goto volume_failed;
}
- if (!(ctx = get_attr_search_ctx(NTFS_I(vol->vol_ino), m))) {
+ if (!(ctx = ntfs_attr_get_search_ctx(NTFS_I(vol->vol_ino), m))) {
ntfs_error(sb, "Failed to get attribute search context.");
goto get_ctx_vol_failed;
}
if (!ntfs_attr_lookup(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0,
ctx) || ctx->attr->non_resident || ctx->attr->flags) {
err_put_vol:
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
get_ctx_vol_failed:
unmap_mft_record(NTFS_I(vol->vol_ino));
goto iput_volume_failed;
vol->vol_flags = vi->flags;
vol->major_ver = vi->major_ver;
vol->minor_ver = vi->minor_ver;
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(NTFS_I(vol->vol_ino));
printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver,
vol->minor_ver);
goto ictx_err_out;
}
ntfs_attr_ctx_cache = kmem_cache_create(ntfs_attr_ctx_cache_name,
- sizeof(attr_search_context), 0 /* offset */,
+ sizeof(ntfs_attr_search_ctx), 0 /* offset */,
SLAB_HWCACHE_ALIGN, NULL /* ctor */, NULL /* dtor */);
if (!ntfs_attr_ctx_cache) {
printk(KERN_CRIT "NTFS: Failed to create %s!\n",