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

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

?? device.c

?? 上一個上傳的有問題,這個是好的。visopsys包括系統內核和GUI的全部SOURCE code ,還包括一些基本的docs文檔。里面src子目錄對應所有SOURCE code.對于想研究操作系統的朋
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** * device.c - Low level device io functions. Part of the Linux-NTFS project. * * Copyright (c) 2004-2006 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 * * Modified 01/2007 by Andy McLaughlin for Visopsys port. */#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"#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 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 = (struct ntfs_device *)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;	/* Locate to position. */	if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) {		ntfs_log_perror("ntfs_pread: device seek to 0x%llx returned error",				pos);		return -1;	}	/* Read the data. */	for (total = 0; count; count -= br, total += br) {		br = dops->read(dev, (char*)b + total, count);		/* 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;	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;	if (NDevReadOnly(dev)) {		errno = EROFS;		return -1;	}	dops = dev->d_ops;	/* Locate to position. */	if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) {		ntfs_log_perror("ntfs_pwrite: seek to 0x%llx returned error",				pos);		return -1;	}	NDevSetDirty(dev);	/* Write the data. */	for (total = 0; count; count -= written, total += written) {		written = dops->write(dev, (const char*)b + total, count);		/* 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. */		return written;	}	/* Finally, return the number of bytes written. */	return total;}/** * 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;}#ifndef __VISOPSYS__/** * 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97久久超碰国产精品电影| 日韩主播视频在线| 91丨九色porny丨蝌蚪| 美女免费视频一区二区| 视频一区二区中文字幕| 亚洲国产日韩一级| 亚洲综合视频网| 亚洲欧美激情插 | 亚洲美女免费在线| 中文字幕亚洲综合久久菠萝蜜| 久久久久久久久蜜桃| 久久免费的精品国产v∧| 欧美成人精品福利| 精品国产欧美一区二区| 国产色产综合产在线视频| 久久久久国产成人精品亚洲午夜 | 激情五月婷婷综合| 国产精品一卡二卡| 丁香六月久久综合狠狠色| 国产久卡久卡久卡久卡视频精品| 福利一区福利二区| 91网站黄www| 欧美日韩二区三区| 精品久久久久久久久久久久包黑料| 日韩欧美国产精品一区| 精品国产一区二区在线观看| 国产欧美精品国产国产专区| 国产精品超碰97尤物18| 夜夜嗨av一区二区三区四季av| 亚洲精品日日夜夜| 日韩一区精品字幕| 国产一区二区三区精品欧美日韩一区二区三区 | 国产真实乱子伦精品视频| 国产精品99久久不卡二区| 欧美日本韩国一区| 欧美videossexotv100| 国产精品色哟哟| 亚洲自拍偷拍av| 久久99日本精品| 成人污污视频在线观看| 欧美日韩中字一区| 精品精品欲导航| 国产精品国产自产拍高清av王其| 亚洲欧美偷拍另类a∨色屁股| 天堂久久久久va久久久久| 国产激情精品久久久第一区二区| 一本到高清视频免费精品| 欧美一区二区福利在线| 久久久激情视频| 亚洲成a天堂v人片| 国产福利一区二区| 欧美日韩中字一区| 日本一区二区三区四区在线视频| 午夜欧美一区二区三区在线播放| 精品一区二区日韩| 91国模大尺度私拍在线视频| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲视频免费在线观看| 美女诱惑一区二区| 在线看国产一区| 久久免费美女视频| 亚洲第一激情av| 成人激情av网| 精品国产成人在线影院| 亚洲一区二区在线视频| 粉嫩绯色av一区二区在线观看| 欧美日韩精品久久久| 国产精品天天看| 麻豆久久一区二区| 91黄色激情网站| 国产精品私房写真福利视频| 美腿丝袜在线亚洲一区| 在线精品视频一区二区| 26uuu精品一区二区| 午夜精品久久久久久久99樱桃| av中文字幕亚洲| 国产欧美一区二区精品婷婷| 青青草原综合久久大伊人精品 | 久久色.com| 婷婷开心激情综合| 99视频热这里只有精品免费| 久久久影视传媒| 久久精品国产77777蜜臀| 欧美老肥妇做.爰bbww| 亚洲欧美二区三区| 丁香激情综合国产| 久久久久久久久岛国免费| 麻豆中文一区二区| 欧美欧美午夜aⅴ在线观看| 亚洲精品乱码久久久久久日本蜜臀| 国产91丝袜在线观看| 欧美成人精品3d动漫h| 男女男精品视频网| 欧美日韩大陆在线| 亚洲一区视频在线| 欧美性xxxxxxxx| 中文字幕不卡的av| 国产精品毛片高清在线完整版| 丁香婷婷深情五月亚洲| 亚洲精品在线一区二区| 日本午夜精品一区二区三区电影| 欧美日韩一区二区在线观看视频 | 国产精品99久久久久久久vr| 欧美成人一区二区三区在线观看| 免费观看在线综合| 欧美久久久久久蜜桃| 丝袜诱惑制服诱惑色一区在线观看| 在线中文字幕不卡| 亚洲国产精品久久久久婷婷884| 在线精品视频免费播放| 一区二区三区不卡视频| 日本韩国精品一区二区在线观看| 亚洲激情图片小说视频| 91极品视觉盛宴| 亚洲bdsm女犯bdsm网站| 在线播放一区二区三区| 日本特黄久久久高潮| 日韩欧美亚洲另类制服综合在线| 麻豆精品一区二区综合av| 91精品中文字幕一区二区三区| 天天综合天天做天天综合| 欧美一区二区私人影院日本| 美女看a上一区| 久久久精品黄色| 91在线porny国产在线看| 亚洲男人的天堂在线aⅴ视频| 麻豆视频一区二区| 99这里只有久久精品视频| 欧美色爱综合网| 大胆欧美人体老妇| 人人超碰91尤物精品国产| 亚洲激情一二三区| 中文字幕一区二区三区四区| 精品久久久久久久久久久院品网 | 91精品一区二区三区久久久久久| 日韩主播视频在线| 精品成人一区二区| 国产福利一区二区三区视频| 一区在线中文字幕| 欧美色区777第一页| 精品一区精品二区高清| 国产欧美日韩麻豆91| 日本国产一区二区| 精品亚洲免费视频| 亚洲精品水蜜桃| 日韩美女在线视频 | 欧美一级一级性生活免费录像| 精品一区二区三区在线观看| 国产精品欧美一区二区三区| 欧美日韩成人一区二区| 国产一区二区三区免费看| 亚洲欧洲制服丝袜| 欧美白人最猛性xxxxx69交| 99久精品国产| 美日韩一级片在线观看| 综合久久综合久久| 日韩一级免费一区| 欧美一级xxx| 99久久精品国产毛片| 免费人成网站在线观看欧美高清| 国产精品三级久久久久三级| 正在播放亚洲一区| 91免费观看视频在线| 久久成人免费日本黄色| 亚洲最新在线观看| 久久久www成人免费无遮挡大片| 欧美性感一区二区三区| 成人av影视在线观看| 免费一区二区视频| 亚洲精品国产无套在线观| 久久久久久久久久久久久夜| 欧美色老头old∨ideo| 成人开心网精品视频| 日韩成人午夜精品| 亚洲欧美日韩成人高清在线一区| 日韩精品中文字幕一区| 在线精品国精品国产尤物884a| 国产成人av福利| 青青草91视频| 亚洲一区二区视频在线观看| 国产精品网站在线观看| 久久久美女毛片| 欧美一区二区精品在线| 欧美色手机在线观看| aaa亚洲精品| 成人手机电影网| 国产综合一区二区| 蜜臀99久久精品久久久久久软件 | 91亚洲男人天堂| 国产精品白丝jk黑袜喷水| 亚洲成a人片在线观看中文| 亚洲精品久久7777| 亚洲三级在线免费观看| 中文字幕不卡三区| 国产日产亚洲精品系列| 久久久久久久久久久久久夜| 久久综合网色—综合色88| 日韩欧美亚洲国产精品字幕久久久| 4438x亚洲最大成人网| 欧美久久一二区|