CentOS读写ntfs内核

  • t6_164641
    了解作者
  • 1.1MB
    文件大小
  • 文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-20 02:56
    上传日期
本人将ntfs-3g作了很小的修改,编译安装后可共直接读写ntfs分区,不用修改fstab,也不用手动挂载,方便使用。
ntfs-3g_ntfsprogs-2011.4.12.tar.gz
  • ntfs-3g_ntfsprogs-2011.4.12
  • src
  • ntfs.probe.c
    3.5KB
  • secaudit.h
    19.2KB
  • secaudit.c
    169.2KB
  • usermap.c
    31.7KB
  • ntfs.c
    96.2KB
  • ntfs_common.c
    17.9KB
  • Makefile.am
    2.3KB
  • ntfs.probe.8.in
    2KB
  • ntfs_common.h
    4.3KB
  • Makefile.in
    37.6KB
  • ntfs.secaudit.8.in
    6KB
  • ntfs.8.in
    15.3KB
  • lowntfs.c
    97.4KB
  • ntfs.usermap.8.in
    3.4KB
  • ntfsprogs
  • ntfsck.c
    26.8KB
  • attrdef.h
    138B
  • ntfsundelete.h
    3.9KB
  • ntfscluster.h
    1.8KB
  • list.h
    5.1KB
  • ntfsinfo.c
    65.2KB
  • cluster.h
    1.3KB
  • utils.c
    29.1KB
  • ntfsresize.8.in
    10.2KB
  • sd.h
    246B
  • ntfswipe.h
    1.7KB
  • ntfscat.c
    10.6KB
  • ntfswipe.c
    34.7KB
  • ntfsfix.c
    26.2KB
  • boot.h
    119B
  • boot.c
    20.4KB
  • ntfsfix.8.in
    1.9KB
  • ntfsprogs.8.in
    1.9KB
  • ntfscluster.8.in
    3.1KB
  • sd.c
    20.6KB
  • ntfsmftalloc.c
    9.8KB
  • ntfscp.c
    14.4KB
  • ntfsdump_logfile.c
    23.9KB
  • Makefile.am
    4KB
  • ntfsmove.c
    19.7KB
  • mkntfs.c
    153.7KB
  • ntfsresize.c
    64.6KB
  • ntfscat.h
    1.5KB
  • ntfsundelete.c
    55KB
  • ntfscmp.c
    21.4KB
  • ntfsmove.h
    1.6KB
  • ntfscp.8.in
    3.8KB
  • ntfsls.8.in
    3.2KB
  • ntfstruncate.c
    19.9KB
  • ntfsinfo.8.in
    2.3KB
  • ntfsls.c
    16.5KB
  • ntfsclone.c
    49.8KB
  • utils.h
    3.5KB
  • ntfsundelete.8.in
    9.1KB
  • ntfscmp.8.in
    2.1KB
  • ntfscluster.c
    14.1KB
  • attrdef.c
    15.1KB
  • ntfscat.8.in
    3.4KB
  • ntfslabel.8.in
    2.6KB
  • Makefile.in
    51.8KB
  • ntfslabel.c
    10.8KB
  • mkntfs.8.in
    6.5KB
  • cluster.c
    2.9KB
  • ntfsclone.8.in
    11.4KB
  • ntfsdecrypt.c
    40.1KB
  • libntfs
  • volume.c
    45.5KB
  • runlist.c
    61.4KB
  • xattrs.c
    18.9KB
  • dir.c
    72.8KB
  • compat.c
    7.6KB
  • lcnalloc.c
    19.9KB
  • libntfs.pc.in
    237B
  • bitmap.c
    7.9KB
  • unistr.c
    41.5KB
  • reparse.c
    30.8KB
  • Makefile.am
    1.7KB
  • acls.c
    108.1KB
  • bootsect.c
    9.7KB
  • logging.c
    16.8KB
  • cache.c
    15.3KB
  • win32_io.c
    40.6KB
  • unix_io.c
    8KB
  • device.c
    20.5KB
  • libntfs.script.so.in
    51B
  • misc.c
    1.5KB
  • collate.c
    6.1KB
  • attrlist.c
    8.8KB
  • object_id.c
    16.2KB
  • attrib.c
    197.5KB
  • mft.c
    57.8KB
  • inode.c
    42.1KB
  • Makefile.in
    52.6KB
  • index.c
    48.5KB
  • efs.c
    11KB
  • compress.c
    49.3KB
  • debug.c
    2.2KB
  • mst.c
    7.5KB
内容介绍
/** * attrib.c - Attribute handling code. Originated from the Linux-NTFS project. * * Copyright (c) 2000-2010 Anton Altaparmakov * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2002-2008 Szabolcs Szakacsits * Copyright (c) 2004-2007 Yura Pakhuchiy * Copyright (c) 2007-2011 Jean-Pierre Andre * Copyright (c) 2010 Erik Larsson * * 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 * 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_STDIO_H #include <stdio.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif #ifdef HAVE_LIMITS_H #include <limits.h> #endif #include "param.h" #include "compat.h" #include "attrib.h" #include "attrlist.h" #include "device.h" #include "mft.h" #include "debug.h" #include "mst.h" #include "volume.h" #include "types.h" #include "layout.h" #include "inode.h" #include "runlist.h" #include "lcnalloc.h" #include "dir.h" #include "compress.h" #include "bitmap.h" #include "logging.h" #include "misc.h" #include "efs.h" ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; ntfschar STREAM_SDS[] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), const_cpu_to_le16('D'), const_cpu_to_le16('S'), const_cpu_to_le16('\0') }; ntfschar TXF_DATA[] = { const_cpu_to_le16('$'), const_cpu_to_le16('T'), const_cpu_to_le16('X'), const_cpu_to_le16('F'), const_cpu_to_le16('_'), const_cpu_to_le16('D'), const_cpu_to_le16('A'), const_cpu_to_le16('T'), const_cpu_to_le16('A'), const_cpu_to_le16('\0') }; static int NAttrFlag(ntfs_attr *na, FILE_ATTR_FLAGS flag) { if (na->type == AT_DATA && na->name == AT_UNNAMED) return (na->ni->flags & flag); return 0; } static void NAttrSetFlag(ntfs_attr *na, FILE_ATTR_FLAGS flag) { if (na->type == AT_DATA && na->name == AT_UNNAMED) na->ni->flags |= flag; else ntfs_log_trace("Denied setting flag %d for not unnamed data " "attribute\n", flag); } static void NAttrClearFlag(ntfs_attr *na, FILE_ATTR_FLAGS flag) { if (na->type == AT_DATA && na->name == AT_UNNAMED) na->ni->flags &= ~flag; } #define GenNAttrIno(func_name, flag) \ int NAttr##func_name(ntfs_attr *na) { return NAttrFlag (na, flag); } \ void NAttrSet##func_name(ntfs_attr *na) { NAttrSetFlag (na, flag); } \ void NAttrClear##func_name(ntfs_attr *na){ NAttrClearFlag(na, flag); } GenNAttrIno(Compressed, FILE_ATTR_COMPRESSED) GenNAttrIno(Encrypted, FILE_ATTR_ENCRYPTED) GenNAttrIno(Sparse, FILE_ATTR_SPARSE_FILE) /** * ntfs_get_attribute_value_length - Find the length of an attribute * @a: * * Description... * * Returns: */ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) { if (!a) { errno = EINVAL; return 0; } errno = 0; if (a->non_resident) return sle64_to_cpu(a->data_size); return (s64)le32_to_cpu(a->value_length); } /** * ntfs_get_attribute_value - Get a copy of an attribute * @vol: * @a: * @b: * * Description... * * Returns: */ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const ATTR_RECORD *a, u8 *b) { runlist *rl; s64 total, r; int i; /* Sanity checks. */ if (!vol || !a || !b) { errno = EINVAL; return 0; } /* Complex attribute? */ /* * Ignore the flags in case they are not zero for an attribute list * attribute. Windows does not complain about invalid flags and chkdsk * does not detect or fix them so we need to cope with it, too. */ if (a->type != AT_ATTRIBUTE_LIST && a->flags) { ntfs_log_error("Non-zero (%04x) attribute flags. Cannot handle " "this yet.\n", le16_to_cpu(a->flags)); errno = EOPNOTSUPP; return 0; } if (!a->non_resident) { /* Attribute is resident. */ /* Sanity check. */ if (le32_to_cpu(a->value_length) + le16_to_cpu(a->value_offset) > le32_to_cpu(a->length)) { return 0; } memcpy(b, (const char*)a + le16_to_cpu(a->value_offset), le32_to_cpu(a->value_length)); errno = 0; return (s64)le32_to_cpu(a->value_length); } /* Attribute is not resident. */ /* If no data, return 0. */ if (!(a->data_size)) { errno = 0; return 0; } /* * FIXME: What about attribute lists?!? (AIA) */ /* Decompress the mapping pairs array into a runlist. */ rl = ntfs_mapping_pairs_decompress(vol, a, NULL); if (!rl) { errno = EINVAL; return 0; } /* * FIXED: We were overflowing here in a nasty fashion when we * reach the last cluster in the runlist as the buffer will * only be big enough to hold data_size bytes while we are * reading in allocated_size bytes which is usually larger * than data_size, since the actual data is unlikely to have a * size equal to a multiple of the cluster size! * FIXED2: We were also overflowing here in the same fashion * when the data_size was more than one run smaller than the * allocated size which happens with Windows XP sometimes. */ /* Now load all clusters in the runlist into b. */ for (i = 0, total = 0; rl[i].length; i++) { if (total + (rl[i].length << vol->cluster_size_bits) >= sle64_to_cpu(a->data_size)) { unsigned char *intbuf = NULL; /* * We have reached the last run so we were going to * overflow when executing the ntfs_pread() which is * BAAAAAAAD! * Temporary fix: * Allocate a new buffer with size: * rl[i].length << vol->cluster_size_bits, do the * read into our buffer, then memcpy the correct * amount of data into the caller supplied buffer, * free our buffer, and continue. * We have reached the end of data size so we were * going to overflow in the same fashion. * Temporary fix: same as above. */ intbuf = ntfs_malloc(rl[i].length << vol->cluster_size_bits); if (!intbuf) { free(rl); return 0; } /* * FIXME: If compressed file: Only read if lcn != -1. * Otherwise, we are dealing with a sparse run and we * just memset the user buffer to 0 for the length of * the run, which should be 16 (= compression unit * size). * FIXME: Really only when file is compressed, or can * we have sparse runs in uncompressed files as well? * - Yes we can, in sparse files! But not necessarily * size of 16, just run length. */ r = ntfs_pread(vol->dev, rl[i].lcn << vol->cluster_size_bits, rl[i].length << vol->cluster_size_bits, intbuf); if (r != rl[i].length << vol->cluster_size_bits) { #define ESTR "Error reading attribute value" if (r == -1) ntfs_log_perror(ESTR); else if (r < rl[i].length << vol->cluster_size_bits) { ntfs_log_debug(ESTR ": Ran out of input data.\n"); errno = EIO; } else { ntfs_log_debug(ESTR ": unknown error\n"); errno = EIO; } #undef ESTR free(rl); free(intbuf); return 0; } memcpy(b + total, intbuf, sle64_to_cpu(a->data_size) - total); free(intbuf); total = sle64_to_cpu(a->data_size); break; } /* * FIXME: If compressed file: Only read if lcn != -1. * Otherwise, we are dealing with a sparse run and we just * memset the user buffer to 0 for the length of the run, which * should be 16 (= compression unit size). * FIXME: Really only when file is compressed, or can * we have sparse runs in uncompressed
评论
    相关推荐
    • mount-usb.tar.gz
      目前脚本测试机centos7系统 使用fdisk和findmnt工具通过脚本实现自动挂载NTFS格式的U盘,挂载在/mnt下,支持多个NTFS格式的U盘一起挂载,使用脚本请安装epel源的ntfs-3g文件系统 取消挂载时,同时会自动删除挂载点 ...
    • CentOS 8 NTFS文件系统RPM包/SRPM包
      CentOS 8发布后,在EPEL软件仓库还未跟进的情况下,CentOS访问NTFS文件系统解决方案变得复杂,此附件提供从fedora 31上取得的ntfs-3g的srpm包及其在CentOS下重编译后的结果。使用方法,解压后,使用rpm、yum或者dnf...
    • CentOS-WSL:Travis CI自动将CentOS RootFS与WSL一起使用
      CentOS WSL 与相同,但基于CentOS QCOW2映像。 当前版本:
    • CentOS-5-32-ntfs-3g.rar
      linux下挂在ntfs
    • linux识别ntfs文件系统包
      安装这两个rpm包,使centos之类的可以安装rpm包的系统能够识别ntfs,但是需要注意,ntfs对于权限和安全的支持并不是那么好
    • centos支持ntfs
      CentOS 5默认是不支持NTFS,网上找了些,看ntfs-3g支持读和写,装来试下效果确实不错,在支持ntfs的时候安装centos的时候要把开发工具包都安装好,如gcc+等! 1:先安装fuse ./configure --prefix=/usr make make ...
    • ntfs-3g_ntfsprogs-2015.3.14.tgz
      centos没有可用软件包 ntfsfix。
    • ntfs-3g-2010.8.8.tgz
      您的centos是不是不支持ntfs啊,下载这个吧,让linux支持ntfs。
    • rhel5.4 centos 5.4 挂载可读写ntfs分区rpm包
      安装方法请参考: http://www.twoee.com/bbs/viewtopic.php?f=1&t=70
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档