⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blk_linux.c

📁 xen虚拟机源代码安装包
💻 C
字号:
#include <inttypes.h>#include <sys/ioctl.h>#include <linux/fs.h>#include "tapdisk.h"#include "blk.h"int blk_getimagesize(int fd, uint64_t *size){	int rc;	*size = 0;	rc = ioctl(fd, BLKGETSIZE, size);	if (rc) {		DPRINTF("ERR: BLKGETSIZE failed, couldn't stat image");		return -EINVAL;	}	return 0;}int blk_getsectorsize(int fd, uint64_t *sector_size){#if defined(BLKSSZGET)	int rc;	*sector_size = DEFAULT_SECTOR_SIZE;	rc = ioctl(fd, BLKSSZGET, sector_size);	if (rc) {		DPRINTF("ERR: BLKSSZGET failed. Falling back to use default sector size");		*sector_size = DEFAULT_SECTOR_SIZE;	}	if (*sector_size != DEFAULT_SECTOR_SIZE)		DPRINTF("Note: sector size is %"PRIu64" (not %u)\n",			*sector_size, DEFAULT_SECTOR_SIZE);#else	*sector_size = DEFAULT_SECTOR_SIZE;#endif	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -