MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / SDW_add_file

Function SDW_add_file

src/jrd/sdw.cpp:121–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120
121int SDW_add_file(thread_db* tdbb, const TEXT* file_name, SLONG start, USHORT shadow_number)
122{
123/**************************************
124 *
125 * S D W _ a d d _ f i l e
126 *
127 **************************************
128 *
129 * Functional description
130 * Add a file to a shadow set.
131 * Return the sequence number for the new file.
132 *
133 **************************************/
134 SET_TDBB(tdbb);
135 Database* dbb = tdbb->getDatabase();
136
137 SyncLockGuard guard(&dbb->dbb_shadow_sync, SYNC_EXCLUSIVE, "SDW_add_file");
138
139 // Find the file to be extended
140
141 jrd_file* shadow_file = 0;
142 Shadow* shadow;
143 for (shadow = dbb->dbb_shadow; shadow; shadow = shadow->sdw_next)
144 {
145 if ((shadow->sdw_number == shadow_number) &&
146 !(shadow->sdw_flags & (SDW_IGNORE | SDW_rollover)))
147 {
148 shadow_file = shadow->sdw_file;
149 break;
150 }
151 }
152
153 if (!shadow) {
154 return 0;
155 }
156
157 // find the last file in the list, open the new file
158
159 jrd_file* file = shadow_file;
160 while (file->fil_next) {
161 file = file->fil_next;
162 }
163
164 // Verify shadow file path against DatabaseAccess entry of firebird.conf
165 if (!JRD_verify_database_access(file_name))
166 {
167 ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("database shadow") <<
168 Arg::Str(file_name));
169 }
170
171 const SLONG sequence = PIO_add_file(tdbb, shadow_file, file_name, start);
172 if (!sequence)
173 return 0;
174
175 jrd_file* next = file->fil_next;
176
177 if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
178 {

Callers

nothing calls this directly

Calls 14

SET_TDBBFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
copy_headerFunction · 0.85
PAG_add_header_entryFunction · 0.85
getDatabaseMethod · 0.80
getAlignedBufferMethod · 0.80
getIOBlockSizeMethod · 0.80
getPageNumMethod · 0.80
ERR_postFunction · 0.70
PIO_add_fileFunction · 0.50

Tested by

no test coverage detected