Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21510/ntfsprogs
Modified Files:
Makefile.am ntfsrm.c ntfsrm.h utils.c utils.h
Log Message:
ntfsrm has been split up and merged into libntfs.
currently it's #ifdef'd out.
tree.c - code for handling directory trees
rich.c - a few helpers without a home (this file will go away soon)
Note: ntfsrm isn't in the build any more (you need to ./configure --enable-rich; make extras). When rm is less intrusive, again, I'll put it back in the build.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/Makefile.am,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -p -r1.53 -r1.54
--- Makefile.am 7 Oct 2005 23:01:23 -0000 1.53
+++ Makefile.am 16 Oct 2005 23:33:04 -0000 1.54
@@ -15,7 +15,7 @@ bin_PROGRAMS = ntfsfix ntfsinfo ntfsclu
sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \
ntfscp
EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \
- ntfsrm ntfsmftalloc ntfscmp
+ ntfsmftalloc ntfscmp
man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \
ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \
@@ -37,6 +37,10 @@ if ENABLE_CRYPTO
EXTRA_PROGRAMS += ntfsdecrypt
endif
+if ENABLE_RICH
+EXTRA_PROGRAMS += ntfsrm
+endif
+
# Set the include path.
AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes)
@@ -93,9 +97,11 @@ endif
# We don't distribute these
+if ENABLE_RICH
ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h
ntfsrm_LDADD = $(AM_LIBS)
ntfsrm_LDFLAGS = $(AM_LFLAGS)
+endif
ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h
ntfstruncate_LDADD = $(AM_LIBS)
Index: ntfsrm.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsrm.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -p -r1.65 -r1.66
--- ntfsrm.c 16 Oct 2005 21:37:12 -0000 1.65
+++ ntfsrm.c 16 Oct 2005 23:33:04 -0000 1.66
@@ -1,7 +1,6 @@
/**
* ntfsrm - Part of the Linux-NTFS project.
*
- * Copyright (c) 2005 Anton Altaparmakov
* Copyright (c) 2004-2005 Richard Russon
*
* This utility will delete files from an NTFS volume.
@@ -40,14 +39,18 @@
#include <time.h>
#endif
[...3860 lines suppressed...]
- dir->inode->ref_count = 2;
-
- vol->private_bmp1 = ntfs_bmp_create (vol->mft_ni, AT_BITMAP, NULL, 0);
- vol->private_bmp2 = ntfs_bmp_create (vol->lcnbmp_ni, AT_DATA, NULL, 0);
-
- if (!vol->private_bmp1 || !vol->private_bmp2) {
- printf ("can't find the bitmaps\n");
- ntfs_volume_umount2 (vol, FALSE);
- vol = NULL;
- goto done;
- }
-
-done:
- return vol;
-}
-
-/**
* utils_pathname_to_inode2
*/
static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found)
Index: ntfsrm.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsrm.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- ntfsrm.h 12 Jul 2005 17:13:30 -0000 1.11
+++ ntfsrm.h 16 Oct 2005 23:33:04 -0000 1.12
@@ -1,7 +1,7 @@
/*
* ntfsrm - Part of the Linux-NTFS project.
*
- * Copyright (c) 2004 Richard Russon
+ * Copyright (c) 2004-2005 Richard Russon
*
* This utility will delete files from an NTFS volume.
*
@@ -26,6 +26,11 @@
#include "types.h"
#include "layout.h"
+#include "volume.h"
+#include "inode.h"
+
+struct ntfs_dir;
+struct ntfs_dt;
/**
* struct options
@@ -43,54 +48,6 @@ struct options {
};
/**
- * struct ntfs_bmp
- * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA
- */
-struct ntfs_bmp {
- ntfs_volume *vol;
- ntfs_attr *attr;
- int count;
- u8 **data;
- VCN *data_vcn;
-};
-
-/**
- * struct ntfs_dt
- */
-struct ntfs_dt {
- struct ntfs_dir *dir;
- struct ntfs_dt *parent;
- u8 *data;
- int data_len;
- int child_count;
- INDEX_ENTRY **children;
- struct ntfs_dt **sub_nodes;
- ntfs_inode **inodes;
- VCN vcn;
- INDEX_HEADER *header;
- BOOL changed;
-};
-
-/**
- * struct ntfs_dir
- */
-struct ntfs_dir {
- ntfs_volume *vol;
- struct ntfs_dir *parent;
- ntfschar *name;
- int name_len;
- MFT_REF mft_num;
- struct ntfs_dt *index;
- struct ntfs_dir **children;
- int child_count;
- struct ntfs_bmp *bitmap;
- ntfs_inode *inode;
- ntfs_attr *iroot;
- ntfs_attr *ialloc;
- int index_size;
-};
-
-/**
* struct ntfs_find
*/
struct ntfs_find {
@@ -102,18 +59,5 @@ struct ntfs_find {
};
-#define RED "[31m"
-#define GREEN "[32m"
-#define YELLOW "[33m"
-#define BLUE "[34m"
-#define MAGENTA "[35m"
-#define CYAN "[36m"
-#define BOLD "[01m"
-#define END "[0m"
-
-#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1))
-#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1))
-#define ATTR_SIZE(s) ROUND_UP(s,8)
-
#endif /* _NTFSRM_H_ */
Index: utils.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/utils.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -p -r1.51 -r1.52
--- utils.c 16 Oct 2005 22:37:48 -0000 1.51
+++ utils.c 16 Oct 2005 23:33:04 -0000 1.52
@@ -97,6 +97,7 @@ int utils_set_locale (void)
}
}
+#ifndef NTFS_RICH
/**
* utils_valid_device - Perform some safety checks on the device, before we start
* @name: Full pathname of the device/file to work with
@@ -206,6 +207,7 @@ ntfs_volume * utils_mount_volume (const
return vol;
}
+#endif
/**
* utils_parse_size - Convert a string representing a size
* @value: String to be parsed
@@ -327,6 +329,7 @@ int utils_parse_range (const char *strin
return 1;
}
+#ifndef NTFS_RICH
/**
* find_attribute - Find an attribute of the given type
* @type: An attribute type, e.g. AT_FILE_NAME
@@ -396,6 +399,7 @@ ATTR_RECORD * find_first_attribute (cons
return rec;
}
+#endif
/**
* utils_inode_get_name
*
Index: utils.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/utils.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -r1.26 -r1.27
--- utils.h 30 Sep 2005 16:58:20 -0000 1.26
+++ utils.h 16 Oct 2005 23:33:04 -0000 1.27
@@ -1,7 +1,7 @@
/*
* utils.h - Part of the Linux-NTFS project.
*
- * Copyright (c) 2002-2003 Richard Russon
+ * Copyright (c) 2002-2005 Richard Russon
* Copyright (c) 2004 Anton Altaparmakov
*
* A set of shared functions for ntfs utilities
@@ -77,9 +77,7 @@ extern DEC_PRINTF(Eprintf)
extern DEC_PRINTF(Vprintf)
extern DEC_PRINTF(Qprintf)
-int utils_valid_device (const char *name, int force);
int utils_set_locale (void);
-ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force);
int utils_parse_size (const char *value, s64 *size, BOOL scale);
int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale);
int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize);
@@ -89,8 +87,15 @@ int utils_mftrec_in_use (ntfs_volume *vo
int utils_is_metadata (ntfs_inode *inode);
void utils_dump_mem (void *buf, int start, int length, int ascii);
+#ifndef _RICH_H_
ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx);
ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft);
+#endif
+
+#if !(defined (_NTFS_VOLUME_H) && defined (NTFS_RICH))
+int utils_valid_device (const char *name, int force);
+ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force);
+#endif
/**
* defines...
@@ -131,4 +136,27 @@ int mft_next_record (struct mft_search_c
#define DM_BLUE (1 << 5)
#define DM_BOLD (1 << 6)
+#ifdef NTFS_RICH
+
+#include "layout.h"
+#include "volume.h"
+#include "inode.h"
+#include "bitmap.h"
+#include "dir.h"
+
+#define RED "\e[31m"
+#define GREEN "\e[32m"
+#define YELLOW "\e[33m"
+#define BLUE "\e[34m"
+#define MAGENTA "\e[35m"
+#define CYAN "\e[36m"
+#define BOLD "\e[01m"
+#define END "\e[0m"
+
+#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1))
+#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1))
+#define ATTR_SIZE(s) ROUND_UP(s,8)
+
+#endif /* NTFS_RICH */
+
#endif /* _NTFS_UTILS_H_ */
|