start of renames to ntfs_object_action() format
(Logical change 1.34)edge.strict_endians
parent
e15920920d
commit
9e79b61437
|
@ -17,13 +17,13 @@
|
|||
mft.[ch] provide: ntfs_{read,write}_mft_record(),
|
||||
ntfs_{read,write}_mft_records(), and
|
||||
ntfs_get_mft_record_data_size().
|
||||
- When writing mft records using the mft.c::ntfs_write_mft_record{s,}()
|
||||
- When writing mft records using the mft.c::ntfs_mft_record{s,}_write()
|
||||
interface, the mft mirror is now updated automatically.
|
||||
- Add -Wall to compiler options when ./configure is run with
|
||||
--enable-debug.
|
||||
- Fix minor error code path bugs in mkntfs.c that showed up with -Wall.
|
||||
- Fix all compiler warnings that showed up with -Wall.
|
||||
- Add new API function, provided by mft.[ch]: ntfs_read_file_record().
|
||||
- Add new API function, provided by mft.[ch]: ntfs_file_record_read().
|
||||
- Add new API calls provided by unistr.[ch]:
|
||||
ntfs_ucstombs() and ntfs_mbstoucs().
|
||||
- Define API for mst.[ch] providing:
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* mft.h - Exports for MFT record handling. Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2002 Anton Altaparmakov.
|
||||
|
@ -27,11 +25,11 @@
|
|||
#include "volume.h"
|
||||
#include "layout.h"
|
||||
|
||||
extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
||||
extern int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref,
|
||||
const s64 count, MFT_RECORD *b);
|
||||
|
||||
/**
|
||||
* ntfs_read_mft_record - read a record from the mft
|
||||
* ntfs_mft_record_read - read a record from the mft
|
||||
* @vol: volume to read from
|
||||
* @mref: mft record number to read
|
||||
* @b: output data buffer
|
||||
|
@ -45,20 +43,20 @@ extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
*
|
||||
* NOTE: @b has to be at least of size vol->mft_record_size.
|
||||
*/
|
||||
static __inline__ int ntfs_read_mft_record(const ntfs_volume *vol,
|
||||
static __inline__ int ntfs_mft_record_read(const ntfs_volume *vol,
|
||||
const MFT_REF mref, MFT_RECORD *b)
|
||||
{
|
||||
return ntfs_read_mft_records(vol, mref, 1, b);
|
||||
return ntfs_mft_records_read(vol, mref, 1, b);
|
||||
}
|
||||
|
||||
extern int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref,
|
||||
extern int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref,
|
||||
MFT_RECORD **mrec, ATTR_RECORD **attr);
|
||||
|
||||
extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
||||
extern int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref,
|
||||
const s64 count, MFT_RECORD *b);
|
||||
|
||||
/**
|
||||
* ntfs_write_mft_record - write an mft record to disk
|
||||
* ntfs_mft_record_write - write an mft record to disk
|
||||
* @vol: volume to write to
|
||||
* @mref: mft record number to write
|
||||
* @b: data buffer containing the mft record to write
|
||||
|
@ -72,10 +70,10 @@ extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
*
|
||||
* NOTE: @b has to be at least of size vol->mft_record_size.
|
||||
*/
|
||||
static __inline__ int ntfs_write_mft_record(const ntfs_volume *vol,
|
||||
static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol,
|
||||
const MFT_REF mref, MFT_RECORD *b)
|
||||
{
|
||||
return ntfs_write_mft_records(vol, mref, 1, b);
|
||||
return ntfs_mft_records_write(vol, mref, 1, b);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* attrib.c - Attribute handling code. Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2002 Anton Altaparmakov.
|
||||
|
@ -817,7 +815,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b)
|
|||
goto err_out;
|
||||
}
|
||||
memcpy(val + pos, b, count);
|
||||
if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no,
|
||||
if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
|
||||
ctx->mrec)) {
|
||||
/*
|
||||
* NOTE: We are in a bad state at this moment. We have
|
||||
|
@ -866,7 +864,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b)
|
|||
goto err_out;
|
||||
}
|
||||
ctx->attr->initialized_size = scpu_to_le64(pos + count);
|
||||
if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no,
|
||||
if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
|
||||
ctx->mrec)) {
|
||||
/*
|
||||
* Undo the change in the in-memory copy and send it
|
||||
|
@ -874,7 +872,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b)
|
|||
*/
|
||||
ctx->attr->initialized_size =
|
||||
scpu_to_le64(old_initialized_size);
|
||||
ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no,
|
||||
ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
|
||||
ctx->mrec);
|
||||
goto err_out;
|
||||
}
|
||||
|
@ -1013,7 +1011,7 @@ err_out:
|
|||
na->initialized_size = old_initialized_size;
|
||||
ctx->attr->initialized_size = scpu_to_le64(
|
||||
old_initialized_size);
|
||||
err = ntfs_write_mft_record(vol,
|
||||
err = ntfs_mft_record_write(vol,
|
||||
ctx->ntfs_ino->mft_no,
|
||||
ctx->mrec);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ already_have_the_base_and_is_first:
|
|||
}
|
||||
if (!type)
|
||||
return FALSE;
|
||||
if (ntfs_read_file_record(vol, mref, &ctx->mrec, &ctx->attr) < 0)
|
||||
if (ntfs_file_record_read(vol, mref, &ctx->mrec, &ctx->attr) < 0)
|
||||
return FALSE;
|
||||
ctx->base = ctx->mrec;
|
||||
find_attr(vol, type, name, name_len, ic, val, val_len, ctx);
|
||||
|
@ -250,7 +250,7 @@ compare_lowest_vcn:
|
|||
// FIXME: CcUnpinData(ctx->base);
|
||||
ctx->base = 0;
|
||||
}
|
||||
if (ntfs_read_file_record(vol,
|
||||
if (ntfs_file_record_read(vol,
|
||||
le64_to_cpu(al_pos->mft_reference),
|
||||
&m, &attr_pos) < 0)
|
||||
return FALSE;
|
||||
|
@ -310,7 +310,7 @@ loc_5217c:
|
|||
}
|
||||
if (!type)
|
||||
return FALSE;
|
||||
if (ntfs_read_file_record(vol, mref, &mrec, &ctx->attr) < 0)
|
||||
if (ntfs_file_record_read(vol, mref, &mrec, &ctx->attr) < 0)
|
||||
return FALSE;
|
||||
ctx->base = mrec;
|
||||
find_attr(vol, type, name, name_len, ic, val, val_len, ctx);
|
||||
|
@ -340,7 +340,7 @@ BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref,
|
|||
}
|
||||
if (ctx->base)
|
||||
goto already_have_the_base;
|
||||
if (ntfs_read_file_record(vol, mref, &m, &a) < 0)
|
||||
if (ntfs_file_record_read(vol, mref, &m, &a) < 0)
|
||||
return FALSE;
|
||||
ctx->base = ctx->mrec = m;
|
||||
ctx->attr = a;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* inode.c - Inode handling code. Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2002 Anton Altaparmakov.
|
||||
|
@ -116,7 +114,7 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref)
|
|||
ni = __allocate_ntfs_inode(vol);
|
||||
if (!ni)
|
||||
return NULL;
|
||||
if (ntfs_read_file_record(vol, mref, &ni->mrec, NULL))
|
||||
if (ntfs_file_record_read(vol, mref, &ni->mrec, NULL))
|
||||
goto err_out;
|
||||
if (!(ni->mrec->flags & MFT_RECORD_IN_USE))
|
||||
goto err_out;
|
||||
|
@ -279,7 +277,7 @@ ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref)
|
|||
ni = __allocate_ntfs_inode(base_ni->vol);
|
||||
if (!ni)
|
||||
return NULL;
|
||||
if (ntfs_read_file_record(base_ni->vol, le64_to_cpu(mref), &ni->mrec,
|
||||
if (ntfs_file_record_read(base_ni->vol, le64_to_cpu(mref), &ni->mrec,
|
||||
NULL))
|
||||
goto err_out;
|
||||
ni->mft_no = mft_no;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* mft.c - Mft record handling code. Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2002 Anton Altaparmakov.
|
||||
|
@ -32,7 +30,7 @@
|
|||
#include "attrib.h"
|
||||
|
||||
/**
|
||||
* ntfs_read_mft_records - read records from the mft from disk
|
||||
* ntfs_mft_records_read - read records from the mft from disk
|
||||
* @vol: volume to read from
|
||||
* @mref: starting mft record number to read
|
||||
* @count: number of mft records to read
|
||||
|
@ -48,7 +46,7 @@
|
|||
*
|
||||
* NOTE: @b has to be at least of size @count * vol->mft_record_size.
|
||||
*/
|
||||
int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
||||
int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref,
|
||||
const s64 count, MFT_RECORD *b)
|
||||
{
|
||||
s64 br;
|
||||
|
@ -79,7 +77,7 @@ int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
}
|
||||
|
||||
/**
|
||||
* ntfs_write_mft_records - write mft records to disk
|
||||
* ntfs_mft_records_write - write mft records to disk
|
||||
* @vol: volume to write to
|
||||
* @mref: starting mft record number to write
|
||||
* @count: number of mft records to write
|
||||
|
@ -98,7 +96,7 @@ int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
* record was successfully written, we write the appropriate mft records from
|
||||
* the copied buffer to the mft mirror, too.
|
||||
*/
|
||||
int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
||||
int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref,
|
||||
const s64 count, MFT_RECORD *b)
|
||||
{
|
||||
s64 bw;
|
||||
|
@ -161,7 +159,7 @@ int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
}
|
||||
|
||||
/**
|
||||
* ntfs_read_file_record - read a FILE record from the mft from disk
|
||||
* ntfs_file_record_read - read a FILE record from the mft from disk
|
||||
* @vol: volume to read from
|
||||
* @mref: mft reference specifying mft record to read
|
||||
* @mrec: address of pointer in which to return the mft record
|
||||
|
@ -184,14 +182,14 @@ int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
|
|||
* and for having a matching sequence number (if MSEQNO(*@mref) != 0).
|
||||
* If either of these fails, -1 is returned and errno is set to EIO. If you get
|
||||
* this, but you still want to read the mft record (e.g. in order to correct
|
||||
* it), use ntfs_read_mft_record() directly.
|
||||
* it), use ntfs_mft_record_read() directly.
|
||||
*
|
||||
* Note: Caller has to free *@mrec when finished.
|
||||
*
|
||||
* Note: We do not check if the mft record is flagged in use. The caller can
|
||||
* check if desired.
|
||||
*/
|
||||
int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref,
|
||||
int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref,
|
||||
MFT_RECORD **mrec, ATTR_RECORD **attr)
|
||||
{
|
||||
MFT_RECORD *m;
|
||||
|
@ -208,7 +206,7 @@ int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref,
|
|||
if (!m)
|
||||
return -1;
|
||||
}
|
||||
if (ntfs_read_mft_record(vol, mref, m)) {
|
||||
if (ntfs_mft_record_read(vol, mref, m)) {
|
||||
err = errno;
|
||||
goto read_failed;
|
||||
}
|
||||
|
@ -224,7 +222,7 @@ int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref,
|
|||
*attr = a;
|
||||
return 0;
|
||||
file_corrupt:
|
||||
Dputs("ntfs_read_file_record(): file is corrupt.");
|
||||
Dputs("ntfs_file_record_read(): file is corrupt.");
|
||||
err = EIO;
|
||||
read_failed:
|
||||
if (m != *mrec)
|
||||
|
|
|
@ -1038,7 +1038,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (ntfs_read_file_record(vol, FILE_Volume, &m, NULL)) {
|
||||
if (ntfs_file_record_read(vol, FILE_Volume, &m, NULL)) {
|
||||
Dperror("Failed to read $Volume");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags)
|
|||
/* Set the volume flags. */
|
||||
vol->flags = c->flags = cpu_to_le16(flags);
|
||||
|
||||
if (ntfs_write_mft_record(vol, FILE_Volume, m)) {
|
||||
if (ntfs_mft_record_write(vol, FILE_Volume, m)) {
|
||||
Dperror("Error writing $Volume");
|
||||
goto err_out;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
const char *EXEC_NAME = "NtfsDump_LogFile";
|
||||
const char *EXEC_VERSION = "1.0";
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* NtfsDump_LogFile - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000,2001 Anton Altaparmakov.
|
||||
* Copyright (c) 2000-2002 Anton Altaparmakov
|
||||
*
|
||||
* This utility will interpret the contents of the journal ($LogFile) of an
|
||||
* NTFS partition and display the results on stdout. Errors will be output to
|
||||
|
@ -120,7 +118,7 @@ version_error:
|
|||
goto error_exit;
|
||||
}
|
||||
/* Read in $LogFile. */
|
||||
if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) {
|
||||
if (ntfs_file_record_read(vol, FILE_LogFile, &m, NULL)) {
|
||||
fprintf(stderr, "Error reading mft record for $LogFile.\n");
|
||||
goto error_exit;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* NtfsFix - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2000-2002 Anton Altaparmakov.
|
||||
|
@ -228,7 +226,7 @@ int main(int argc, char **argv)
|
|||
printf("Correcting differences in "
|
||||
"$MFTMirr... ");
|
||||
}
|
||||
br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m +
|
||||
br = ntfs_mft_record_write(vol, i, (MFT_RECORD*)(m +
|
||||
i * vol->mft_record_size));
|
||||
if (br) {
|
||||
puts(FAILED);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ntfsinfo - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2002 Matthew J. Fanto
|
||||
|
@ -93,7 +91,7 @@ void get_file_attribute_value(const char *dev, long int i)
|
|||
mref = (MFT_REF) i;
|
||||
inode = ntfs_open_inode(vol, mref);
|
||||
|
||||
if (ntfs_read_file_record(vol, mref, &mrec, NULL)) {
|
||||
if (ntfs_file_record_read(vol, mref, &mrec, NULL)) {
|
||||
perror("Error reading file record!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ntfslabel - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2002 Matthew J. Fanto
|
||||
|
@ -147,7 +145,7 @@ void change_label(const char *dev, const unsigned long mnt_flags,
|
|||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (ntfs_read_file_record(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) {
|
||||
if (ntfs_file_record_read(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) {
|
||||
perror("Error reading file record");
|
||||
goto err_out;
|
||||
}
|
||||
|
@ -189,7 +187,7 @@ void change_label(const char *dev, const unsigned long mnt_flags,
|
|||
goto err_out;
|
||||
}
|
||||
memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len);
|
||||
if (ntfs_write_mft_record(vol, (MFT_REF)FILE_Volume, mrec)) {
|
||||
if (ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) {
|
||||
perror("Error writing MFT Record to disk");
|
||||
goto err_out;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* ntfsresize - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2002 Szabolcs Szakacsits
|
||||
* Copyright (c) 2002 Anton Altaparmakov
|
||||
*
|
||||
* This utility will resize an NTFS volume.
|
||||
*
|
||||
|
@ -429,7 +430,7 @@ void walk_inodes()
|
|||
progress_update(&progress, inode);
|
||||
|
||||
mref = (MFT_REF)inode;
|
||||
if (ntfs_read_file_record(vol, mref, &mrec, NULL)) {
|
||||
if (ntfs_file_record_read(vol, mref, &mrec, NULL)) {
|
||||
/* FIXME: continue only if it make sense, e.g.
|
||||
MFT record not in use based on $MFT bitmap */
|
||||
if (errno == EIO)
|
||||
|
@ -680,7 +681,7 @@ int write_mft_record(ntfs_attr_search_ctx *ctx)
|
|||
if (opt.ro_flag)
|
||||
return 0;
|
||||
|
||||
return ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, ctx->mrec);
|
||||
return ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue