File: api_salv.html

package info (click to toggle)
unadf 0.7.11a-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,660 kB
  • sloc: ansic: 5,455; cpp: 404; makefile: 127; sh: 78
file content (119 lines) | stat: -rw-r--r-- 2,380 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<HTML>
<HEAD><TITLE> Salvage </TITLE></HEAD>

<BODY>

<H1 ALIGN=CENTER>the Salvage API</H1>


<HR>
<H1>Typical usage</H1>


<PRE>
#include"adflib.h"


int main()
{
    struct List *list, *cell;

    /* initialization */    
    /* the device and volume are mounted */

    cell = list = adfGetDelEnt(vol);
    while(cell) {
        block =(struct Block*) cell->content;
        printf("%s %d %d %ld\n",block->name,block->type,block->secType,
            block->sect);
        cell = cell->next;
    }
    /* we noted the entry 883 and 885 */
    adfFreeDelList(list);

    /* 883 is a file */
    if (adfCheckEntry(vol,883,0)==RC_OK)
        adfUndelEntry(vol,vol->curDirPtr,883); 

    /* 885 is a directory */
    if (adfCheckEntry(vol,885,0)==RC_OK)
        adfUndelEntry(vol,vol->curDirPtr,885);
 
    /* unmounts done */
    /* cleanup */
}
</PRE>



<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfGetDelEnt() </FONT></P>

<H2>Syntax</H2>

<B>struct List*</B> adfGetDelEnt(<B>struct Volume *</B>vol) 

<H2>Description</H2>

Returns the list of the files/directories that MIGHT be undeleted. The
entries must be checked before !
<P>
See <B>adfFreeDelList()</B> to free this list.<BR>
See <B>adfCheckEntry()</B> to check if the entry could be undeleted.

<H2>Internals</H2>

Scans all the blocks of the volume to find directory blocks 
and file header blocks that are not allocated in the bitmap.
<P>

<HR>

<P ALIGN=CENTER><FONT SIZE=+2> adfCheckEntry() </FONT></P>

<H2>Syntax</H2>

<B>RETCODE</B> adfCheckEntry(<B>struct Volume*</B> vol, <B>SECTNUM</B> nSect, <B>int</B> level)

<H2>Description</H2>

Checks if an entry (directory or file) could be undeleted.
<P>
The 'level' argument is not used yet. Could be set to 0.

<P>

<HR>
<P ALIGN=CENTER><FONT SIZE=+2> adfUndelEntry()</FONT></P>

<H2>Syntax</H2>

<B>RETCODE</B> adfUndelEntry(<B>struct Volume*</B> vol, <B>SECTNUM</B> parent, <B>SECTNUM</B> nSect)

<H2>Description</H2>

Undelete a directory or a file. The parent directory of an entry must exist.

<H2>Internals</H2>

Add the entry first block pointer in the parent directory list and allocated
the related blocks in the bitmap.

<HR>

<P ALIGN=CENTER><FONT SIZE=+2> void adfFreeDelList(struct List* list) </FONT></P>

<H2>Syntax</H2>

<B>void</B> adfFreeDelList(<B>struct List*</B> list)

<H2>Description</H2>

Free the list of deleted entries.
<P>


</BODY>

</HTML>