http://linux-ntfs.sourceforge.net/snapshots/ntfsprogs-200309071734.tar.bz2
[ntfsprogs.git] / ntfsprogs / ntfsundelete.h
1 /*
2  * ntfsundelete - Part of the Linux-NTFS project.
3  *
4  * Copyright (c) 2002 Richard Russon
5  *
6  * This utility will recover deleted files from an NTFS volume.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program (in the main directory of the Linux-NTFS
20  * distribution in the file COPYING); if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #ifndef _NTFSUNDELETE_H_
25 #define _NTFSUNDELETE_H_
26
27 #include "types.h"
28 #include "list.h"
29 #include "runlist.h"
30
31 enum optmode {
32         MODE_NONE = 0,
33         MODE_SCAN,
34         MODE_UNDELETE,
35         MODE_COPY,
36         MODE_ERROR
37 };
38
39 struct options {
40         char            *device;        /* Device/File to work with */
41         enum optmode     mode;          /* Scan / Undelete / Copy */
42         int              percent;       /* Minimum recoverability */
43         int              uinode;        /* Undelete this inode */
44         char            *dest;          /* Save file to this directory */
45         char            *output;        /* With this filename */
46         char             fillbyte;      /* Use for unrecoverable sections */
47         char            *match;         /* Pattern for filename matching */
48         int              match_case;    /* Case sensitive matching */
49         int              quiet;         /* Less output */
50         int              verbose;       /* Extra output */
51         int              force;         /* Override common sense */
52         time_t           since;         /* Since this time */
53         long long        size_begin;    /* Range for file size */
54         long long        size_end;
55         long long        mft_begin;     /* Range for mft copy */
56         long long        mft_end;
57 };
58
59 struct filename {
60         struct list_head list;          /* Previous/Next links */
61         char            *name;          /* Filename in current locale */
62         FILE_NAME_TYPE_FLAGS name_space;
63         uchar_t         *uname;         /* Filename in unicode */
64         int              uname_len;     /* and its length */
65         long long        size_alloc;    /* Allocated size (multiple of cluster size) */
66         long long        size_data;     /* Actual size of data */
67         FILE_ATTR_FLAGS  flags;
68         time_t           date_c;        /* Time created */
69         time_t           date_a;        /*      altered */
70         time_t           date_m;        /*      mft record changed */
71         time_t           date_r;        /*      read */
72 };
73
74 struct data {
75         struct list_head list;          /* Previous/Next links */
76         char            *name;          /* Stream name in current locale */
77         uchar_t         *uname;         /* Unicode stream name */
78         int              uname_len;     /* and its length */
79         int              resident;      /* Stream is resident */
80         int              compressed;    /* Stream is compressed */
81         int              encrypted;     /* Stream is encrypted */
82         long long        size_alloc;    /* Allocated size (multiple of cluster size) */
83         long long        size_data;     /* Actual size of data */
84         long long        size_init;     /* Initialised size, may be less than data size */
85         long long        size_vcn;      /* Highest VCN in the data runs */
86         runlist_element *runlist;       /* Decoded data runs */
87         int              percent;       /* Amont potentially recoverable */
88         void            *data;          /* If resident, a pointer to the data */
89 };
90
91 struct ufile {
92         long long        inode;         /* MFT record number */
93         time_t           date;          /* Last modification date/time */
94         struct list_head name;          /* A list of filenames */
95         struct list_head data;          /* A list of data streams */
96         char            *pref_name;     /* Preferred filename */
97         long long        max_size;      /* Largest size we find */
98         int              attr_list;     /* MFT record may be one of many */
99         int              directory;     /* MFT record represents a directory */
100         MFT_RECORD      *mft;           /* Raw MFT record */
101 };
102
103 #endif /* _NTFSUNDELETE_H_ */
104