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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? device.c

?? 上一個(gè)上傳的有問題,這個(gè)是好的。visopsys包括系統(tǒng)內(nèi)核和GUI的全部SOURCE code ,還包括一些基本的docs文檔。里面src子目錄對(duì)應(yīng)所有SOURCE code.對(duì)于想研究操作系統(tǒng)的朋
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/** * 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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区资源| 日韩不卡一区二区| 午夜精品aaa| 国产成人自拍网| 欧美日韩一级片网站| 欧美国产日韩一二三区| 日韩国产一区二| 91在线小视频| 国产精品网友自拍| 国产精品资源站在线| 欧美人伦禁忌dvd放荡欲情| 中文字幕乱码日本亚洲一区二区| 日韩二区在线观看| 欧美在线观看视频在线| 国产精品盗摄一区二区三区| 久久99在线观看| 制服丝袜亚洲色图| 午夜精品aaa| 欧美日韩国产天堂| 亚洲地区一二三色| 日本韩国欧美国产| 亚洲欧美在线另类| 成人福利在线看| 中文子幕无线码一区tr| 福利一区二区在线| 欧美国产日韩精品免费观看| 国产伦精品一区二区三区免费| 日韩欧美亚洲国产另类| 日韩精品久久久久久| 宅男噜噜噜66一区二区66| 午夜精品爽啪视频| 欧美丰满少妇xxxbbb| 蜜臀av国产精品久久久久 | 久久精品亚洲麻豆av一区二区| 婷婷一区二区三区| 欧美高清一级片在线| 性做久久久久久久免费看| 欧美色综合久久| 天天色综合成人网| 日韩情涩欧美日韩视频| 激情综合色综合久久| 精品日韩一区二区三区| 国产.精品.日韩.另类.中文.在线.播放| 精品国产一区二区三区四区四 | 亚洲bt欧美bt精品777| 欧美视频一区二区三区| 秋霞午夜鲁丝一区二区老狼| 国产午夜精品美女毛片视频| 欧美日韩一级二级三级| 亚洲va欧美va国产va天堂影院| 欧美三级三级三级爽爽爽| 日韩精品色哟哟| 欧美精品一区二区三区四区| 国产福利一区二区| 国产精品成人免费| 欧美日韩国产首页| 国产美女久久久久| 怡红院av一区二区三区| 欧美日韩一级片在线观看| 久久国产尿小便嘘嘘| 国产精品三级视频| 欧美日韩免费视频| 国产麻豆视频精品| 亚洲国产精品一区二区久久| 日韩欧美一二三四区| 99精品热视频| 久热成人在线视频| 亚洲欧美电影院| 日韩欧美国产麻豆| 色综合天天综合网国产成人综合天| 亚洲风情在线资源站| 国产日产欧美精品一区二区三区| 91浏览器在线视频| 久久er99精品| 一区二区三区av电影| 欧美zozo另类异族| 欧美亚洲动漫另类| 国产成人午夜高潮毛片| 日一区二区三区| 自拍偷拍欧美激情| 久久一二三国产| 欧美日韩国产系列| 91在线视频18| 成人在线视频首页| 狂野欧美性猛交blacked| 亚洲丝袜另类动漫二区| 精品88久久久久88久久久 | 视频在线观看国产精品| 综合激情网...| 久久九九久久九九| 日韩视频一区二区| 欧美日韩一区三区| 色综合一区二区三区| 国产成人精品亚洲午夜麻豆| 免费在线看成人av| 视频一区二区欧美| 亚洲国产精品一区二区尤物区| 中文字幕一区二区在线播放| 久久天天做天天爱综合色| 欧美高清视频一二三区 | 一区二区三区四区不卡在线 | 成人毛片视频在线观看| 麻豆成人免费电影| 日欧美一区二区| 亚洲成人综合视频| 亚洲成人免费观看| 亚洲午夜视频在线| 亚洲午夜免费视频| 亚洲最新视频在线播放| 一区二区在线观看av| 国产精品二三区| 亚洲色图20p| 亚洲精品网站在线观看| 综合久久久久综合| 亚洲bdsm女犯bdsm网站| 亚洲电影视频在线| 爽好久久久欧美精品| 天堂蜜桃91精品| 美腿丝袜亚洲综合| 麻豆91免费看| 久久99精品久久只有精品| 久久99久久久久| 狠狠色丁香久久婷婷综合丁香| 捆绑调教一区二区三区| 国产美女精品一区二区三区| 国产成人在线观看免费网站| 成人av在线看| 91成人在线观看喷潮| 欧美日韩国产不卡| 精品久久久久久久人人人人传媒| 久久夜色精品一区| 国产精品国产三级国产专播品爱网 | 免费精品视频在线| 美腿丝袜亚洲三区| 国产成a人无v码亚洲福利| 成人av综合在线| 欧美日韩精品一区二区三区四区| 欧美日韩国产一级二级| 2欧美一区二区三区在线观看视频| 久久精品夜色噜噜亚洲aⅴ| 日韩一区中文字幕| 日本视频免费一区| 成人午夜电影小说| 欧美怡红院视频| 久久久久综合网| 一区二区日韩av| 久88久久88久久久| 色婷婷久久久久swag精品| 91精品国产色综合久久ai换脸 | 91丨porny丨最新| 在线播放一区二区三区| 欧美极品aⅴ影院| 五月天激情综合| 成人精品国产一区二区4080| 在线观看三级视频欧美| 精品国产一区二区三区av性色 | 热久久久久久久| 99久免费精品视频在线观看 | 久久精品国产亚洲高清剧情介绍| 福利一区二区在线| 欧美一区二区日韩一区二区| 国产精品无人区| 精品一区二区在线看| 色婷婷av一区二区三区大白胸| 欧美岛国在线观看| 亚洲成人一二三| 91免费版pro下载短视频| 精品国内二区三区| 亚洲成人免费观看| 91美女片黄在线观看91美女| 日韩精品中文字幕一区| 久久99国产精品麻豆| 在线视频综合导航| 欧美国产精品久久| 国产真实精品久久二三区| 欧美日韩亚洲高清一区二区| 中文字幕亚洲成人| 国产成人亚洲精品狼色在线| 欧美大片在线观看一区二区| 婷婷成人激情在线网| 色哟哟国产精品免费观看| 国产精品久久久久久久久快鸭 | 午夜日韩在线电影| 91猫先生在线| 1000部国产精品成人观看| 国产乱人伦精品一区二区在线观看| 精品1区2区3区| 一区二区三区电影在线播| 97精品视频在线观看自产线路二| 久久久精品tv| 国产成人av一区二区三区在线| 欧美成人艳星乳罩| 国产一区二区三区电影在线观看| 日韩精品一区国产麻豆| 免费看日韩精品| 日韩欧美中文字幕公布| 久久精品国产第一区二区三区| 日韩视频一区二区在线观看| 美女在线观看视频一区二区| 日韩一区二区三区电影在线观看|