home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ntfs-3g / dir.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-26  |  3.4 KB  |  109 lines

  1. /*
  2.  * dir.h - Exports for directory handling. Originated from the Linux-NTFS project.
  3.  *
  4.  * Copyright (c) 2002      Anton Altaparmakov
  5.  * Copyright (c) 2005-2006 Yura Pakhuchiy
  6.  * Copyright (c) 2004-2005 Richard Russon
  7.  * Copyright (c) 2005-2008 Szabolcs Szakacsits
  8.  *
  9.  * This program/include file is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License as published
  11.  * by the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * This program/include file is distributed in the hope that it will be
  15.  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  16.  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program (in the main directory of the NTFS-3G
  21.  * distribution in the file COPYING); if not, write to the Free Software
  22.  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24.  
  25. #ifndef _NTFS_DIR_H
  26. #define _NTFS_DIR_H
  27.  
  28. #include "types.h"
  29.  
  30. #define PATH_SEP '/'
  31.  
  32. /*
  33.  * We do not have these under DJGPP, so define our version that do not conflict
  34.  * with other S_IFs defined under DJGPP.
  35.  */
  36. #ifdef DJGPP
  37. #ifndef S_IFLNK
  38. #define S_IFLNK  0120000
  39. #endif
  40. #ifndef S_ISLNK
  41. #define S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK)
  42. #endif
  43. #ifndef S_IFSOCK
  44. #define S_IFSOCK 0140000
  45. #endif
  46. #ifndef S_ISSOCK
  47. #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  48. #endif
  49. #endif
  50.  
  51. /*
  52.  * The little endian Unicode strings $I30, $SII, $SDH, $O, $Q, $R
  53.  * as a global constant.
  54.  */
  55. extern ntfschar NTFS_INDEX_I30[5];
  56. extern ntfschar NTFS_INDEX_SII[5];
  57. extern ntfschar NTFS_INDEX_SDH[5];
  58. extern ntfschar NTFS_INDEX_O[3];
  59. extern ntfschar NTFS_INDEX_Q[3];
  60. extern ntfschar NTFS_INDEX_R[3];
  61.  
  62. extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
  63.         const ntfschar *uname, const int uname_len);
  64.  
  65. extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent,
  66.         const char *pathname);
  67.  
  68. extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len,
  69.         dev_t type);
  70. extern ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni,
  71.         ntfschar *name, u8 name_len, dev_t type, dev_t dev);
  72. extern ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni,
  73.         ntfschar *name, u8 name_len, ntfschar *target, int target_len);
  74. extern int ntfs_check_empty_dir(ntfs_inode *ni);
  75. extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
  76.         u8 name_len);
  77.  
  78. extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
  79.         u8 name_len);
  80.  
  81. /*
  82.  * File types (adapted from include <linux/fs.h>)
  83.  */
  84. #define NTFS_DT_UNKNOWN        0
  85. #define NTFS_DT_FIFO        1
  86. #define NTFS_DT_CHR        2
  87. #define NTFS_DT_DIR        4
  88. #define NTFS_DT_BLK        6
  89. #define NTFS_DT_REG        8
  90. #define NTFS_DT_LNK        10
  91. #define NTFS_DT_SOCK        12
  92. #define NTFS_DT_WHT        14
  93.  
  94. /*
  95.  * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let
  96.  * the caller specify what kind of dirent layout it wants to have.
  97.  * This allows the caller to read directories into their application or
  98.  * to have different dirent layouts depending on the binary type.
  99.  */
  100. typedef int (*ntfs_filldir_t)(void *dirent, const ntfschar *name,
  101.         const int name_len, const int name_type, const s64 pos,
  102.         const MFT_REF mref, const unsigned dt_type);
  103.  
  104. extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
  105.         void *dirent, ntfs_filldir_t filldir);
  106.  
  107. #endif /* defined _NTFS_DIR_H */
  108.  
  109.