Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv21617
Added Files:
disk_io.h
Log Message:
Added disk_io.h header file.
--- NEW FILE ---
/*
* disk_io.h - Exports for disk io. Part of the Linux-NTFS project.
*
* Copyright (c) 2000,2001 Anton Altaparmakov.
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DISK_IO_H
#define DISK_IO_H
#include <linux/types.h>
#include "volume.h"
/**
* ntfs_pwrite - positioned write to disk
* @fd: file descriptor to write to
* @b: data buffer to write to disk
* @count: number of bytes to write
* @pos: position in file descriptor to write to
*
* This function will write @count bytes of data @b to file descriptor @fd at
* position @pos.
* On success return bytes written (0 means nothing written).
* On error return -1 with errno set appropriately to the return code of
* either lseek, malloc, write or fdatasync.
*/
ssize_t ntfs_pwrite(int fd, const void *b, size_t count, off_t pos);
/**
* mst_pwrite - multi sector transfer (mst) positioned write
* @fd: file descriptor to write to
* @b: data buffer to write to disk
* @count: number of bytes to write
* @pos: position in file descriptor to write to
*
* Multi sector transfer (mst) positioned write. This function will write
* @count bytes of data @b to file descriptor @fd at position @pos.
*
* On success return bytes written (0 means nothing written).
* On error return -1 with errno set appropriately to the return code of
* either lseek, malloc, write or fdatasync.
*/
ssize_t mst_pwrite(int fd, const void *b, size_t count, off_t pos);
/**
* ntfs_pread - positioned read from disk
* @fd: file descriptor to read from
* @b: output data buffer
* @bksize: size of each block
* @count: number of blocks to read
* @pos: position in file descriptor to read from
*
* This function will read @count @blocks of size @bksize bytes each from file
* descriptor @fd at position @pos into the buffer @b.
*
* On success, return the number of successfully read blocks. If this number is
* lower than @count this means that we have reached end of file. 0 means end
* of file or nothing to read (@count or @bksize is 0). On error, return -1
* with errno set appropriately to the return code of either lseek or read, or
* to EINVAL in case the data pointer @b was NULL or the block size (@bksize)
* was not a multiple of NTFS_SECTOR_SIZE or @bksize was not a power of two.
*
* NOTE: If a read error is encountered we return -1 even if we have already
* read some blocks successfully (this is subject to change!!!).
*/
ssize_t ntfs_pread(int fd, void *b, size_t bksize, size_t count, off_t pos);
/**
* mst_pread - multi sector transfer (mst) positioned read
* @fd: file descriptor to read from
* @b: output data buffer
* @bksize: size of each block
* @count: number of blocks to read
* @pos: position in file descriptor to read from
*
* Multi sector transfer (mst) positioned read. This function will read @count
* @blocks of size @bksize bytes each from file descriptor @fd at position @pos
* into the buffer @b.
*
* On success, return the number of successfully read blocks. If this number is
* lower than @count this means that we have reached end of file. 0 means end
* of file or nothing to read (@count or @bksize is 0). On error, return -1
* with errno set appropriately to the return code of either lseek or read, or
* to EINVAL in case the data pointer @b was NULL or the block size (@bksize)
* was not a multiple of NTFS_SECTOR_SIZE or @bksize was not a power of two.
*
* NOTE: If an incomplete multi sector transfer has been detected the magic
* will have been changed to magic_BAAD but no error will be returned.
* I.e. it is possible that we return count blocks as being read but that
* any number (between zero and count!) of these blocks is actually
* subject to a multi sector transfer error. This should be detected by
* the caller by checking for the magic being "BAAD".
*
* NOTE: If a read error is encountered we return -1 even if we have already
* read some blocks successfully (this is subject to change!!!).
*/
ssize_t mst_pread(int fd, void *b, size_t bksize, size_t count, off_t pos);
/**
* get_clusters - read ntfs clusters
* @vol: volume to read from
* @buf: output data buffer
* @lcn: starting logical cluster number
* @count: number of clusters to read
*
* Read @count ntfs clusters starting at logical cluster number @lcn from volume
* @vol into buffer @buf. Return number of clusters read or -ERRNO on error,
* where ERRNO is the error code. This function will do the error reporting so
* caller really only needs to check for sucess / failure.
*
* NOTE: @buf has to be at least of size vol->ClusterSize * @count. No checking
* is performed for this!
*/
int get_clusters(ntfs_volume *vol, __u8 *buf, __s64 lcn, int count);
/**
* put_clusters - write ntfs clusters
* @vol: volume to write to
* @buf: data buffer to write to disk
* @lcn: starting logical cluster number
* @count: number of clusters to write
*
* Write @count ntfs clusters starting at logical cluster number @lcn from
* buffer @buf to volume @vol. Return @count on success or -ERRNO on error,
* where ERRNO is the error code. This function will do the error reporting so
* caller really only needs to check for sucess / failure.
*/
int put_clusters(ntfs_volume *vol, const __u8 *buf, __s64 lcn, int count);
/**
* get_mft_records - read records from the mft
* @vol: volume to read from
* @buf: output data buffer
* @mftrec: starting mft record number
* @count: number of mft records to read
*
* Read @count mft records starting at @mftrec from volume @vol into buffer
* @buf. Return @count on success or -ERRNO on error, where ERRNO is the error
* code. This function will do the error reporting so caller really only needs
* to check for sucess / failure.
*
* NOTE: @buf has to be at least of size @count * vol->MftRecordSize.
*/
int get_mft_records(ntfs_volume *vol, __u8 *buf, __s64 mftrec, int count);
/**
* put_mft_record - write a record to the mft
* @vol: volume to write to
* @buf: data buffer containing the mft record to write
* @mftrec: mft record number to write to
*
* Write mft record @mftrec from buffer @buf to volume @vol. Return 1 on
* success or -ERRNO on error, where ERRNO is the error code. This function
* will do the error reporting so caller really only needs to check for sucess
* / failure.
*/
int put_mft_record(ntfs_volume *vol, const __u8 *buf, __s64 mftrec);
#endif /* defined DISK_IO_H */
|