summaryrefslogtreecommitdiff
path: root/src/fileops/fileops.src
blob: 3cb874b74e2d94d91c459cd8ac76609ccb019e64 (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2001, 2015 Oracle and/or its affiliates.  All rights reserved.
 *
 * $Id$
 */

DBPRIVATE
PREFIX	__fop

INCLUDE #include "db_int.h"
INCLUDE #include "dbinc/crypto.h"
INCLUDE #include "dbinc/db_page.h"
INCLUDE #include "dbinc/db_am.h"
INCLUDE #include "dbinc/txn.h"
INCLUDE #include "dbinc/fop.h"
INCLUDE

/*
 * create -- create a file system object.
 *
 * name: name in the file system
 * appname: indicates if the name needs to go through __db_appname
 * mode: file system mode
 */
BEGIN_COMPAT create		42	143
DBT	name		DBT		s
ARG	appname		u_int32_t	lu
ARG	mode		u_int32_t	o
END

BEGIN_COMPAT create		60	143
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
ARG	mode		u_int32_t	o
END

BEGIN create		60p1	143
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
ARG	mode		u_int32_t	o
END

/*
 * remove -- remove a file system object.
 *
 * name: name in the file system
 * appname: indicates if the name needs to go through __db_appname
 */
BEGIN_COMPAT remove		60	144
DBT	name		DBT		s
DBT	fid		DBT		s
ARG	appname		u_int32_t	lu
END

BEGIN remove		60p1	144
DBT	name		DBT		s
DBT	fid		DBT		s
ARG	appname		u_int32_t	lu
END

/*
 * write: log the writing of data into an object.
 *
 * name: file containing the page.
 * appname: indicates if the name needs to go through __db_appname
 * pgsize: page size.
 * pageno: page number in the file.
 * offset: offset on the page.
 * page: the actual meta-data page.
 * flag: non-0 indicates that this is a tempfile, so we needn't undo
 *	these modifications (we'll toss the file).
 */
BEGIN_COMPAT write	42	145
DBT	name		DBT		s
ARG	appname		u_int32_t	lu
ARG	pgsize		u_int32_t	lu
ARG	pageno		db_pgno_t	lu
ARG	offset		u_int32_t	lu
DBT	page		DBT		s
ARG	flag		u_int32_t	lu
END

BEGIN_COMPAT write	60	145
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
ARG	pgsize		u_int32_t	lu
ARG	pageno		db_pgno_t	lu
ARG	offset		u_int32_t	lu
DBT	page		DBT		s
ARG	flag		u_int32_t	lu
END

BEGIN write	60p1	145
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
ARG	pgsize		u_int32_t	lu
ARG	pageno		db_pgno_t	lu
ARG	offset		u_int32_t	lu
DBT	page		DBT		s
ARG	flag		u_int32_t	lu
END

/*
 * write_file: log the writing of data into a file.
 *
 * name: file containing the data.
 * appname: indicates if the name needs to go through __db_appname
 * offset_lo: offset in the file, low part of a 64 bit integer.
 * offset_hi: offset in the file, high part of a 64 bit integer.
 * old_data: Data being overwritten, if there is any
 * new_data: Data being written to the file.
 * flag: DB_FOP_APPEND (0x00000001), DB_FOP_CREATE (0x00000002) and
 *  DB_FOP_REDO (0x00000008).  Used to tell how the operation can be
 *  undone, truncating in the case of append and deleting the file in
 *  the case of create, and whether enough information was logged so
 *  that the operation can be redone.
 */
BEGIN_COMPAT write_file	60	86
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
ARG	offset_lo	u_int32_t	lu
ARG	offset_hi	u_int32_t	lu
DBT	old_data	DBT		s
DBT	new_data	DBT		s
ARG	flag		u_int32_t	lu
END

BEGIN write_file	60p1	86
DBT	name		DBT		s
DBT	dirname		DBT		s
ARG	appname		u_int32_t	lu
LONGARG	offset		u_int64_t	llu
DBT	old_data	DBT		s
DBT	new_data	DBT		s
ARG	flag		u_int32_t	lu
END

/*
 * rename: move a file from one name to another.
 * The appname value indicates if this is a path name that should be used
 * directly (i.e., no interpretation) or if it is a pathname that should
 * be interpreted via calls to __db_appname.  The fileid is the 20-byte
 * DB fileid of the file being renamed.  We need to check it on recovery
 * so that we don't inadvertently overwrite good files.
 *
 * There are two variants of this log record: one that must be both done
 * and undone and one that is not undone (used for renaming tmp files, see
 * SR #15119)
 *
 * These two record types use the same structure, read, and print functions,
 * but have different recovery functions.
 */
BEGIN_COMPAT rename	42	146
DUPLICATE rename_noundo	46	150
DBT	oldname		DBT		s
DBT	newname		DBT		s
DBT	fileid		DBT		s
ARG	appname		u_int32_t	lu
END

BEGIN_COMPAT rename	60	146
DUPLICATE rename_noundo 60	150
DBT	oldname		DBT		s
DBT	newname		DBT		s
DBT	dirname		DBT		s
DBT	fileid		DBT		s
ARG	appname		u_int32_t	lu
END

BEGIN rename	60p1	146
DUPLICATE rename_noundo	60p1	150
DBT	oldname		DBT		s
DBT	newname		DBT		s
DBT	dirname		DBT		s
DBT	fileid		DBT		s
ARG	appname		u_int32_t	lu
END

/*
 * File removal record.  This is a DB-level log record that indicates
 * we've just completed some form of file removal.  The purpose of this
 * log record is to logically identify the particular instance of the
 * named file so that during recovery, in deciding if we should roll-forward
 * a remove or a rename, we can make sure that we don't roll one forward and
 * delete or overwrite the wrong file.
 * real_fid:	The 20-byte unique file identifier of the original file being
 *		removed.
 * tmp_fid:	The unique fid of the tmp file that is removed.
 * name:	The pre- __db_appname name of the file
 * child:	The transaction that removed or renamed the file.
 */
 */
BEGIN_COMPAT file_remove	60	141
DBT	real_fid	DBT	s
DBT	tmp_fid		DBT	s
DBT	name		DBT	s
ARG	appname		u_int32_t	lu
ARG	child		u_int32_t	lx
END

BEGIN file_remove	60p1	141
DBT	real_fid	DBT	s
DBT	tmp_fid		DBT	s
DBT	name		DBT	s
ARG	appname		u_int32_t	lu
ARG	child		u_int32_t	lx
END