亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? device.c

?? LINUX下讀寫NTFS分區的工具。 已經集成了通過LIBCONV庫支持中文的代碼。
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** * device.c - Low level device io functions. Originated from the Linux-NTFS project. * * Copyright (c) 2004-2006 Anton Altaparmakov * Copyright (c) 2004-2006 Szabolcs Szakacsits * * 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 NTFS-3G * distribution in the file COPYING); if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#ifdef HAVE_STDLIB_H#include <stdlib.h>#endif#ifdef HAVE_STRING_H#include <string.h>#endif#ifdef HAVE_ERRNO_H#include <errno.h>#endif#ifdef HAVE_STDIO_H#include <stdio.h>#endif#ifdef HAVE_SYS_TYPES_H#include <sys/types.h>#endif#ifdef HAVE_SYS_STAT_H#include <sys/stat.h>#endif#ifdef HAVE_FCNTL_H#include <fcntl.h>#endif#ifdef HAVE_SYS_IOCTL_H#include <sys/ioctl.h>#endif#ifdef HAVE_SYS_PARAM_H#include <sys/param.h>#endif#ifdef HAVE_SYS_MOUNT_H#include <sys/mount.h>#endif#ifdef HAVE_LINUX_FD_H#include <linux/fd.h>#endif#ifdef HAVE_LINUX_HDREG_H#include <linux/hdreg.h>#endif#include "types.h"#include "mst.h"#include "debug.h"#include "device.h"#include "logging.h"#include "misc.h"#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE)#define BLKGETSIZE	_IO(0x12,96)  /* Get device size in 512-byte blocks. */#endif#if defined(linux) && defined(_IOR) && !defined(BLKGETSIZE64)#define BLKGETSIZE64	_IOR(0x12,114,size_t)	/* Get device size in bytes. */#endif#if defined(linux) && !defined(HDIO_GETGEO)#define HDIO_GETGEO	0x0301	/* Get device geometry. */#endif#if defined(linux) && defined(_IO) && !defined(BLKSSZGET)#	define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */#endif#if defined(linux) && defined(_IO) && !defined(BLKBSZSET)#	define BLKBSZSET _IOW(0x12,113,size_t) /* Set device block size in bytes. */#endif/** * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it * @name:	name of the device (must be present) * @state:	initial device state (usually zero) * @dops:	ntfs device operations to use with the device (must be present) * @priv_data:	pointer to private data (optional) * * Allocate an ntfs device structure and pre-initialize it with the user- * specified device operations @dops, device state @state, device name @name, * and optional private data @priv_data. * * Note, @name is copied and can hence be freed after this functions returns. * * On success return a pointer to the allocated ntfs device structure and on * error return NULL with errno set to the error code returned by ntfs_malloc(). */struct ntfs_device *ntfs_device_alloc(const char *name, const long state,		struct ntfs_device_operations *dops, void *priv_data){	struct ntfs_device *dev;	if (!name) {		errno = EINVAL;		return NULL;	}	dev = ntfs_malloc(sizeof(struct ntfs_device));	if (dev) {		if (!(dev->d_name = strdup(name))) {			int eo = errno;			free(dev);			errno = eo;			return NULL;		}		dev->d_ops = dops;		dev->d_state = state;		dev->d_private = priv_data;	}	return dev;}/** * ntfs_device_free - free an ntfs device structure * @dev:	ntfs device structure to free * * Free the ntfs device structure @dev. * * Return 0 on success or -1 on error with errno set to the error code. The * following error codes are defined: *	EINVAL		Invalid pointer @dev. *	EBUSY		Device is still open. Close it before freeing it! */int ntfs_device_free(struct ntfs_device *dev){	if (!dev) {		errno = EINVAL;		return -1;	}	if (NDevOpen(dev)) {		errno = EBUSY;		return -1;	}	free(dev->d_name);	free(dev);	return 0;}/** * ntfs_pread - positioned read from disk * @dev:	device to read from * @pos:	position in device to read from * @count:	number of bytes to read * @b:		output data buffer * * This function will read @count bytes from device @dev at position @pos into * the data buffer @b. * * On success, return the number of successfully read bytes. If this number is * lower than @count this means that we have either reached end of file or * encountered an error during the read so that the read is partial. 0 means * end of file or nothing to read (@count is 0). * * On error and nothing has been read, return -1 with errno set appropriately * to the return code of either seek, read, or set to EINVAL in case of * invalid arguments. */s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b){	s64 br, total;	struct ntfs_device_operations *dops;	ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count);		if (!b || count < 0 || pos < 0) {		errno = EINVAL;		return -1;	}	if (!count)		return 0;		dops = dev->d_ops;	for (total = 0; count; count -= br, total += br) {		br = dops->pread(dev, (char*)b + total, count, pos + total);		/* If everything ok, continue. */		if (br > 0)			continue;		/* If EOF or error return number of bytes read. */		if (!br || total)			return total;		/* Nothing read and error, return error status. */		return br;	}	/* Finally, return the number of bytes read. */	return total;}/** * ntfs_pwrite - positioned write to disk * @dev:	device to write to * @pos:	position in file descriptor to write to * @count:	number of bytes to write * @b:		data buffer to write to disk * * This function will write @count bytes from data buffer @b to the device @dev * at position @pos. * * On success, return the number of successfully written bytes. If this number * is lower than @count this means that the write has been interrupted in * flight 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 is 0). * * On error and nothing has been written, return -1 with errno set * appropriately to the return code of either seek, write, or set * to EINVAL in case of invalid arguments. */s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,		const void *b){	s64 written, total, ret = -1;	struct ntfs_device_operations *dops;	ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count);	if (!b || count < 0 || pos < 0) {		errno = EINVAL;		goto out;	}	if (!count)		return 0;	if (NDevReadOnly(dev)) {		errno = EROFS;		goto out;	}		dops = dev->d_ops;	NDevSetDirty(dev);	for (total = 0; count; count -= written, total += written) {		written = dops->pwrite(dev, (const char*)b + total, count,				       pos + total);		/* If everything ok, continue. */		if (written > 0)			continue;		/*		 * If nothing written or error return number of bytes written.		 */		if (!written || total)			break;		/* Nothing written and error, return error status. */		total = written;		break;	}	ret = total;out:		return ret;}/** * ntfs_mst_pread - multi sector transfer (mst) positioned read * @dev:	device to read from * @pos:	position in file descriptor to read from * @count:	number of blocks to read * @bksize:	size of each block that needs mst deprotecting * @b:		output data buffer * * Multi sector transfer (mst) positioned read. This function will read @count * blocks of size @bksize bytes each from device @dev at position @pos into the * the data 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, that the read * was interrupted, or that an error was encountered during the read so that * the read is partial. 0 means end of file or nothing was read (also return 0 * when @count or @bksize are 0). * * On error and nothing was read, return -1 with errno set appropriately to the * return code of either seek, read, or set to EINVAL in case of invalid * arguments. * * 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. Thus 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". */s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count,		const u32 bksize, void *b){	s64 br, i;	if (bksize & (bksize - 1) || bksize % NTFS_BLOCK_SIZE) {		errno = EINVAL;		return -1;	}	/* Do the read. */	br = ntfs_pread(dev, pos, count * bksize, b);	if (br < 0)		return br;	/*	 * Apply fixups to successfully read data, disregarding any errors	 * returned from the MST fixup function. This is because we want to	 * fixup everything possible and we rely on the fact that the "BAAD"	 * magic will be detected later on.	 */	count = br / bksize;	for (i = 0; i < count; ++i)		ntfs_mst_post_read_fixup((NTFS_RECORD*)				((u8*)b + i * bksize), bksize);	/* Finally, return the number of complete blocks read. */	return count;}/** * ntfs_mst_pwrite - multi sector transfer (mst) positioned write * @dev:	device to write to * @pos:	position in file descriptor to write to * @count:	number of blocks to write * @bksize:	size of each block that needs mst protecting * @b:		data buffer to write to disk * * Multi sector transfer (mst) positioned write. This function will write * @count blocks of size @bksize bytes each from data buffer @b to the device * @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 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). * * On error and nothing has been written, return -1 with errno set * appropriately to the return code of either seek, write, or set * to EINVAL in case of invalid arguments. * * NOTE: We mst protect the data, write it, then mst deprotect it using a quick * deprotect algorithm (no checking). This saves us from making a copy before * the write and at the same time causes the usn to be incremented in the * buffer. This conceptually fits in better with the idea that cached data is * always deprotected and protection is performed when the data is actually * going to hit the disk and the cache is immediately deprotected again * simulating an mst read on the written data. This way cache coherency is * achieved. */s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,		const u32 bksize, void *b){	s64 written, i;	if (count < 0 || bksize % NTFS_BLOCK_SIZE) {		errno = EINVAL;		return -1;	}	if (!count)		return 0;	/* Prepare data for writing. */	for (i = 0; i < count; ++i) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看一二区| 久久久99免费| www久久久久| 玉足女爽爽91| 国产成人高清在线| 7777精品伊人久久久大香线蕉| 国产亚洲精品中文字幕| 天天操天天干天天综合网| 99久久99久久精品免费看蜜桃| 69堂成人精品免费视频| 亚洲少妇30p| 国产99久久精品| 欧美精品一区二区三区四区 | 国产午夜精品一区二区三区嫩草 | 色播五月激情综合网| 久久久久久亚洲综合影院红桃| 亚洲图片欧美色图| 一本色道a无线码一区v| 中文字幕av一区二区三区免费看 | 亚洲大片精品永久免费| 91性感美女视频| 中文字幕在线观看不卡| 高清国产一区二区三区| 久久影音资源网| 精品一区在线看| 欧美电视剧在线观看完整版| 日本亚洲电影天堂| 欧美高清视频不卡网| 五月激情综合婷婷| 欧美日韩高清一区| 首页国产欧美日韩丝袜| 欧美午夜精品理论片a级按摩| 尤物在线观看一区| 在线精品视频一区二区三四| 国产一区二区成人久久免费影院| 91精品国产91热久久久做人人| 丝袜美腿亚洲一区二区图片| 欧美日韩久久不卡| 蜜臀av性久久久久av蜜臀妖精 | 国产传媒日韩欧美成人| 久久久久国产一区二区三区四区| 久久99久久99| 中文字幕+乱码+中文字幕一区| 丰满亚洲少妇av| 日韩美女啊v在线免费观看| 色综合久久天天| 亚洲一级二级三级| 欧美一区二区三区爱爱| 狠狠色综合色综合网络| 国产欧美精品一区二区三区四区| 成人精品国产免费网站| 亚洲色图.com| 91精品婷婷国产综合久久性色| 九九**精品视频免费播放| 日本一区二区三区电影| 日本韩国欧美一区二区三区| 亚洲成人av福利| 精品成人佐山爱一区二区| 国产成人亚洲综合a∨猫咪| 1024精品合集| 51精品国自产在线| 成人性生交大片免费| 一区二区三区丝袜| 日韩欧美电影在线| 日韩一区二区影院| 成人av先锋影音| 日韩国产高清在线| 国产精品美女久久久久久久久| 日本道在线观看一区二区| 美女视频网站久久| 一区二区三区中文免费| 欧美精品一区二| 在线免费观看日本欧美| 国产精品一区二区三区乱码| 一区二区三区中文在线观看| 精品国产青草久久久久福利| 一本到三区不卡视频| 狠狠狠色丁香婷婷综合激情| 一区二区三区欧美视频| 精品精品国产高清一毛片一天堂| 91免费在线播放| 国产精品亚洲专一区二区三区| 亚洲一区二区在线视频| 日本一区二区三区在线不卡| 91精品免费在线观看| 99re成人在线| 国产成人免费在线视频| 免费在线观看一区| 亚洲女同一区二区| 日本一区二区视频在线| 日韩欧美一区二区在线视频| 91福利在线观看| av日韩在线网站| 国产成人无遮挡在线视频| 秋霞电影网一区二区| 亚洲一区二区av在线| 国产精品传媒视频| 欧美国产日韩a欧美在线观看 | 亚洲成人激情自拍| 亚洲人成人一区二区在线观看| 久久久久99精品一区| 日韩欧美高清dvd碟片| 777奇米四色成人影色区| 在线观看免费成人| 色综合久久综合网97色综合 | 国产精品污污网站在线观看| 精品剧情在线观看| 欧美理论片在线| 欧美精品xxxxbbbb| 欧美日韩中文国产| 欧美日韩国产小视频| 欧美影片第一页| 在线观看国产91| 色婷婷av一区二区| 91精品福利视频| 在线观看亚洲a| 在线精品亚洲一区二区不卡| 91精品91久久久中77777| 91色婷婷久久久久合中文| 91影视在线播放| 91麻豆国产福利在线观看| 色婷婷国产精品久久包臀 | 国产精品99久久久久久久vr| 国产真实乱偷精品视频免| 开心九九激情九九欧美日韩精美视频电影| 亚洲大型综合色站| 麻豆高清免费国产一区| 国产综合久久久久影院| 国产乱人伦精品一区二区在线观看 | 国产亚洲婷婷免费| 国产日韩欧美高清| 亚洲精品你懂的| 五月婷婷色综合| 欧美96一区二区免费视频| 韩国中文字幕2020精品| 国产91精品欧美| 在线免费视频一区二区| 在线播放91灌醉迷j高跟美女| 日韩亚洲欧美中文三级| 久久精品视频免费| 最新久久zyz资源站| 亚洲成人av电影在线| 蜜桃久久av一区| av在线一区二区| 555www色欧美视频| 日本一区二区三区免费乱视频 | 日韩欧美三级在线| 日本一区二区视频在线观看| 亚洲一级二级在线| 狠狠色狠狠色综合| 91国产福利在线| 欧美精品一区二区久久久| 亚洲日本va午夜在线影院| 日本aⅴ精品一区二区三区| 成人综合婷婷国产精品久久免费| 欧美亚洲图片小说| 久久久久国产成人精品亚洲午夜| 亚洲免费资源在线播放| 蜜桃av一区二区三区电影| 99国产精品国产精品久久| 日韩三级高清在线| 亚洲蜜臀av乱码久久精品| 精品一二三四区| 欧美在线视频不卡| 国产日韩欧美高清在线| 三级欧美韩日大片在线看| 波多野结衣中文字幕一区二区三区| 欧美日韩夫妻久久| 亚洲人精品一区| 国产成人精品免费视频网站| 555www色欧美视频| 一区二区成人在线视频| 国产精品资源网| 日韩精品专区在线| 亚洲一区二区三区国产| 97精品视频在线观看自产线路二 | 欧美三级在线视频| 国产精品不卡视频| 国产精品一区二区久久不卡| 欧美日本国产视频| 亚洲精品伦理在线| 成人动漫视频在线| 久久久久久一级片| 国产一区二区三区黄视频| 日韩欧美三级在线| 日日摸夜夜添夜夜添亚洲女人| 色94色欧美sute亚洲线路二| 国产精品久99| www.亚洲精品| 中文字幕一区二区三区乱码在线| 韩国精品在线观看| 精品国产精品一区二区夜夜嗨| 日韩激情在线观看| 欧美一区二区三区在线| 日韩黄色免费网站| 91麻豆精品久久久久蜜臀| 日韩激情视频网站| 日韩一级完整毛片| 久久国产精品露脸对白| 精品粉嫩aⅴ一区二区三区四区|