Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/include/ntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9102/include/ntfs
Modified Files:
Makefile.am Makefile.in
Added Files:
collate.h index.h
Log Message:
- Port collate.[ch] from kernel to library and implement
ntfs_collate_file_name. Thus we have new API's: ntfs_collate and
ntfs_is_collation_rule_supported. (Yura)
- Port index.[ch] from kernel to library. New API's: ntfs_index_lookup,
ntfs_index_ctx_{get,put}, ntfs_index_entry_mark_dirty. (Yura)
Just finished porting, it's 03:41 here, so this code should defenitely segfault or at least not work. Today after sleep I will integrate it to library and test it by the way.
--- NEW FILE ---
/*
* collate.h - Defines for NTFS kernel collation handling. Part of the
* Linux-NTFS project.
*
* Copyright (c) 2004 Anton Altaparmakov
* Copyright (c) 2005 Yura Pakhuchiy
*
* 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 Linux-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
*/
#ifndef _NTFS_COLLATE_H
#define _NTFS_COLLATE_H
#include "types.h"
#include "volume.h"
#define NTFS_COLLATION_ERROR -2
static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) {
int i;
/*
* FIXME: At the moment we only support COLLATION_BINARY,
* COLLATION_NTOFS_ULONG and COLLATION_FILE_NAME so we return false
* for everything else.
*/
if (cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG &&
cr != COLLATION_FILE_NAME)
return FALSE;
i = le32_to_cpu(cr);
if (((i >= 0) && (i <= 0x02)) ||
((i >= 0x10) && (i <= 0x13)))
return TRUE;
return FALSE;
}
extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr,
const void *data1, const int data1_len,
const void *data2, const int data2_len);
#endif /* _NTFS_COLLATE_H */
--- NEW FILE ---
/*
* index.h - Defines for NTFS index handling. Part of the Linux-NTFS project.
*
* Copyright (c) 2004 Anton Altaparmakov
* Copyright (c) 2005 Yura Pakhuchiy
*
* 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 Linux-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
*/
#ifndef _NTFS_INDEX_H
#define _NTFS_INDEX_H
#include "attrib.h"
#include "types.h"
#include "layout.h"
#include "inode.h"
#include "mft.h"
/**
* @ni: inode containing the @entry described by this context
* @entry: index entry (points into @ir or @ia)
* @data: index entry data (points into @entry)
* @data_len: length in bytes of @data
* @is_in_root: TRUE if @entry is in @ir and FALSE if it is in @ia
* @ir: index root if @is_in_root and NULL otherwise
* @actx: attribute search context if @is_in_root and NULL otherwise
* @ia: index block if @is_in_root is FALSE and NULL otherwise
* @ia_na: opened INDEX_ALLOCATION attribute
* @ia_vcn: VCN from which @ia where read from
* @ia_dirty: TRUE if index block was changed
* @block_size: index block size
*
* @ni is the inode this context belongs to.
*
* @entry is the index entry described by this context. @data and @data_len
* are the index entry data and its length in bytes, respectively. @data
* simply points into @entry. This is probably what the user is interested in.
*
* If @is_in_root is TRUE, @entry is in the index root attribute @ir described
* by the attribute search context @actx and inode @ni. @ia, @ia_vcn and
* @ia_dirty are undifined in this case.
*
* If @is_in_root is FALSE, @entry is in the index allocation attribute and @ia
* and @ia_vcn point to the index allocation block and VCN where it's placed,
* respectively. @ir and @actx are NULL in this case. @ia_na is opened
* INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and
* FALSE otherwise.
*
* To obtain a context call ntfs_index_ctx_get().
*
* When finished with the @entry and its @data, call ntfs_index_ctx_put() to
* free the context and other associated resources.
*
* If the index entry was modified, call ntfs_index_entry_mark_dirty() before
* the call to ntfs_index_ctx_put() to ensure that the changes are written
* to disk.
*/
typedef struct {
ntfs_inode *ni;
INDEX_ENTRY *entry;
void *data;
u16 data_len;
BOOL is_in_root;
INDEX_ROOT *ir;
ntfs_attr_search_ctx *actx;
INDEX_ALLOCATION *ia;
ntfs_attr *ia_na;
VCN ia_vcn;
BOOL ia_dirty;
u32 block_size;
} ntfs_index_context;
extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni);
extern void ntfs_index_ctx_put(ntfs_index_context *ictx);
extern int ntfs_index_lookup(const void *key, const int key_len,
ntfs_index_context *ictx);
/**
* ntfs_index_entry_mark_dirty - mark an index entry dirty
* @ictx: ntfs index context describing the index entry
*
* Mark the index entry described by the index entry context @ictx dirty.
*
* If the index entry is in the index root attribute, simply mark the inode
* containing the index root attribute dirty. This ensures the mftrecord, and
* hence the index root attribute, will be written out to disk later.
*
* If the index entry is in an index block belonging to the index allocation
* attribute, set ia_dirty to TRUE, thus index block will be updated during
* ntfs_index_ctx_put.
*/
static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx)
{
if (ictx->is_in_root)
ntfs_inode_mark_dirty(ictx->actx->ntfs_ino);
else
ictx->ia_dirty = TRUE;
}
#endif /* _NTFS_INDEX_H */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/include/ntfs/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- Makefile.am 19 Mar 2004 17:36:45 -0000 1.4
+++ Makefile.am 4 Jun 2005 00:58:01 -0000 1.5
@@ -5,6 +5,7 @@ linux_ntfsinclude_HEADERS = \
attrlist.h \
bitmap.h \
bootsect.h \
+ collate.h \
compat.h \
compress.h \
debug.h \
@@ -14,6 +15,7 @@ linux_ntfsinclude_HEADERS = \
endians.h \
gnome-vfs-method.h \
gnome-vfs-module.h \
+ index.h \
inode.h \
layout.h \
lcnalloc.h \
Index: Makefile.in
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/include/ntfs/Makefile.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -r1.18 -r1.19
--- Makefile.in 19 Apr 2005 12:00:26 -0000 1.18
+++ Makefile.in 4 Jun 2005 00:58:01 -0000 1.19
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# Makefile.in generated by automake 1.9.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -65,7 +65,6 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
-AR = @AR@
AUTOCONF = @AUTOCONF@
AUTODIRS = @AUTODIRS@
AUTOHEADER = @AUTOHEADER@
@@ -76,10 +75,6 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@@ -91,8 +86,6 @@ EGREP = @EGREP@
ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@
ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -122,18 +115,13 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -177,6 +165,7 @@ linux_ntfsinclude_HEADERS = \
attrlist.h \
bitmap.h \
bootsect.h \
+ collate.h \
compat.h \
compress.h \
debug.h \
@@ -186,6 +175,7 @@ linux_ntfsinclude_HEADERS = \
endians.h \
gnome-vfs-method.h \
gnome-vfs-module.h \
+ index.h \
inode.h \
layout.h \
lcnalloc.h \
|