1/* 2 * device_io.h - Exports for default device io. Originated from the Linux-NTFS project. 3 * 4 * Copyright (c) 2000-2006 Anton Altaparmakov 5 * 6 * This program/include file is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as published 8 * by the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program/include file is distributed in the hope that it will be 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (in the main directory of the NTFS-3G 18 * distribution in the file COPYING); if not, write to the Free Software 19 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22#ifndef _NTFS_DEVICE_IO_H 23#define _NTFS_DEVICE_IO_H 24 25#ifdef HAVE_CONFIG_H 26#include "config.h" 27#endif 28 29#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS 30 31#if defined(linux) || defined(__uClinux__) || defined(__sun) \ 32 || defined(__APPLE__) || defined(__DARWIN__) 33 /* Make sure the presence of <windows.h> means compiling for Windows */ 34#undef HAVE_WINDOWS_H 35#endif 36 37#ifndef HAVE_WINDOWS_H 38 39/* Not for Windows use standard Unix style low level device operations. */ 40#define ntfs_device_default_io_ops ntfs_device_unix_io_ops 41 42#else /* HAVE_WINDOWS_H */ 43 44#ifndef HDIO_GETGEO 45# define HDIO_GETGEO 0x301 46/** 47 * struct hd_geometry - 48 */ 49struct hd_geometry { 50 unsigned char heads; 51 unsigned char sectors; 52 unsigned short cylinders; 53 unsigned long start; 54}; 55#endif 56#ifndef BLKGETSIZE 57# define BLKGETSIZE 0x1260 58#endif 59#ifndef BLKSSZGET 60# define BLKSSZGET 0x1268 61#endif 62#ifndef BLKGETSIZE64 63# define BLKGETSIZE64 0x80041272 64#endif 65#ifndef BLKBSZSET 66# define BLKBSZSET 0x40041271 67#endif 68 69/* On Windows (and Cygwin) : use Win32 low level device operations. */ 70#define ntfs_device_default_io_ops ntfs_device_win32_io_ops 71 72/* A few useful functions */ 73int ntfs_win32_set_sparse(int); 74int ntfs_win32_ftruncate(int fd, s64 size); 75int ntfs_device_win32_ftruncate(struct ntfs_device*, s64); 76 77#endif /* HAVE_WINDOWS_H */ 78 79 80/* Forward declaration. */ 81struct ntfs_device_operations; 82 83extern struct ntfs_device_operations ntfs_device_default_io_ops; 84 85#endif /* NO_NTFS_DEVICE_DEFAULT_IO_OPS */ 86 87#endif /* defined _NTFS_DEVICE_IO_H */ 88 89