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

📄 getlabel.ntfs.c

📁 linux下的一个mount工具
💻 C
字号:
/* *  This program 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 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 Library General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* * $Id: getlabel.ntfs.c,v 1.1.1.1 2000/09/13 19:36:45 lyonel Exp $ * * Copyright (c) 2000, Lyonel VINCENT <vincentl@ec-lyon.fr> * */#include <stdio.h>#include <string.h>#include <ctype.h>#include <fcntl.h>#include <unistd.h>#include <stdint.h>/* p is supposed to be a char*, unsigned char* or uint8_t* */#define NTFS_GETU8(p)	((uint8_t*)p[0])#define NTFS_GETS8(p)	((int8_t*)p[0])#define NTFS_GETU16(p)	((uint16_t)NTFS_GETU8(p)+(uint16_t)NTFS_GETU8(p+1)<<8)#define NTFS_GETS16(p)	((int16_t)NTFS_GETS8(p)+(int16_t)NTFS_GETS8(p+1)<<8)#define NTFS_GETU32(p)	((uint32_t)NTFS_GETU16(p)+(uint32_t)NTFS_GETU16(p+2))#define NTFS_GETU64(p)	((uint64_t)NTFS_GETU32(p)+(uint64_t)NTFS_GETU32(p+4))#define NTFS_MAGIC	"NTFS"#define BLOCKSIZE	512int ntfs_getlabel(int fd, char *label){	char buffer[1024];		if (lseek(fd, 0, SEEK_SET) != 0	    || read(fd, buffer, sizeof(buffer)) != sizeof(buffer)	    || (strncmp(buffer+3, NTFS_MAGIC, strlen(NTFS_MAGIC)) != 0))		return 0;	strcpy(label, "");	return 1;}

⌨️ 快捷键说明

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