Skip to content

Commit 336739d

Browse files
committed
adf_err: rename return code constants.
Separating ADFlib's namespace.
1 parent 91278c6 commit 336739d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+537
-533
lines changed

examples/adf_bitmap.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int main ( int argc,
8585
}
8686

8787
ADF_RETCODE rc = adfDevMount ( dev );
88-
if ( rc != RC_OK ) {
88+
if ( rc != ADF_RC_OK ) {
8989
fprintf ( stderr, "Cannot get volume info for file/device '%s' - aborting...\n",
9090
adfname );
9191
goto dev_cleanup;
@@ -112,7 +112,7 @@ int main ( int argc,
112112

113113
if ( command == COMMAND_REBUILD ) {
114114
ADF_RETCODE rc = rebuild_bitmap ( vol );
115-
status = ( rc == RC_OK ? 0 : 1 );
115+
status = ( rc == ADF_RC_OK ? 0 : 1 );
116116
} else { // COMMAND_SHOW
117117
status = show_block_allocation_bitmap ( vol );
118118
}
@@ -133,7 +133,7 @@ int main ( int argc,
133133
ADF_RETCODE rebuild_bitmap ( struct AdfVolume * const vol )
134134
{
135135
ADF_RETCODE rc = adfVolRemount ( vol, ADF_ACCESS_MODE_READWRITE );
136-
if ( rc != RC_OK ) {
136+
if ( rc != ADF_RC_OK ) {
137137
fprintf ( stderr, "Remounting the volume read-write has failed -"
138138
" aborting...\n" );
139139
return rc;
@@ -142,28 +142,28 @@ ADF_RETCODE rebuild_bitmap ( struct AdfVolume * const vol )
142142
struct AdfRootBlock root;
143143
//printf ("reading root block from %u\n", vol->rootBlock );
144144
rc = adfReadRootBlock ( vol, (uint32_t) vol->rootBlock, &root );
145-
if ( rc != RC_OK ) {
145+
if ( rc != ADF_RC_OK ) {
146146
adfEnv.eFct ( "Invalid RootBlock, sector %u - aborting...",
147147
vol->rootBlock );
148148
return rc;
149149
}
150150
//printf ("root block read, name %s\n", root.diskName );
151151

152152
rc = adfReconstructBitmap ( vol, &root );
153-
if ( rc != RC_OK ) {
153+
if ( rc != ADF_RC_OK ) {
154154
adfEnv.eFct ( "Error rebuilding the bitmap (%d)", rc );
155155
return rc;
156156
}
157157

158158
rc = adfUpdateBitmap ( vol );
159-
if ( rc != RC_OK ) {
159+
if ( rc != ADF_RC_OK ) {
160160
adfEnv.eFct ( "Error writing updated bitmap (%d)", rc );
161161
return rc;
162162
}
163163

164164
printf ("Bitmap reconstruction complete.\n");
165165

166-
return RC_OK;
166+
return ADF_RC_OK;
167167
}
168168

169169

@@ -177,7 +177,7 @@ int show_block_allocation_bitmap ( struct AdfVolume * const vol )
177177
struct AdfRootBlock rb;
178178
struct AdfBitmapBlock bm;
179179

180-
if ( adfReadRootBlock ( vol, (uint32_t) vol->rootBlock, &rb ) != RC_OK ) {
180+
if ( adfReadRootBlock ( vol, (uint32_t) vol->rootBlock, &rb ) != ADF_RC_OK ) {
181181
fprintf ( stderr, "invalid RootBlock on orig. volume, sector %u\n",
182182
vol->rootBlock );
183183
return 1;
@@ -202,7 +202,7 @@ int show_block_allocation_bitmap ( struct AdfVolume * const vol )
202202
continue;
203203

204204
ADF_RETCODE rc = adfReadBitmapBlock ( vol, bmPage, &bm );
205-
if ( rc != RC_OK ) {
205+
if ( rc != ADF_RC_OK ) {
206206
fprintf ( stderr, "error reading bitmap block on vol. %s, block %u\n",
207207
vol->volName, bmPage );
208208
nerrors++;
@@ -235,7 +235,7 @@ int show_block_allocation_bitmap ( struct AdfVolume * const vol )
235235
while ( bmExtBlkPtr != 0 ) {
236236
struct AdfBitmapExtBlock bmExtBlk;
237237
ADF_RETCODE rc = adfReadBitmapExtBlock ( vol, bmExtBlkPtr, &bmExtBlk );
238-
if ( rc != RC_OK ) {
238+
if ( rc != ADF_RC_OK ) {
239239
adfFreeBitmap ( vol );
240240
return 1;
241241
}
@@ -250,7 +250,7 @@ int show_block_allocation_bitmap ( struct AdfVolume * const vol )
250250
}
251251

252252
rc = adfReadBitmapBlock ( vol, bmBlkPtr, &bm );
253-
if ( rc != RC_OK ) {
253+
if ( rc != ADF_RC_OK ) {
254254
fprintf ( stderr, "error reading bitmap block on vol. %s, block %u\n",
255255
vol->volName, bmBlkPtr );
256256
nerrors++;

examples/adf_floppy_format.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main ( int argc,
3737
}
3838

3939
ADF_RETCODE rc = adfDevMount ( device );
40-
if ( rc != RC_OK ) {
40+
if ( rc != ADF_RC_OK ) {
4141
fprintf ( stderr, "adfDevMount failed on %s - aborting...\n",
4242
adfname );
4343
adfDevUnMount ( device );
@@ -74,7 +74,7 @@ int main ( int argc,
7474
adfDevInfo ( device );
7575

7676
printf ( "Formatting floppy (%s) disk '%s'...\n", fdtype, adfname );
77-
if ( adfCreateFlop ( device, label, (unsigned char) type ) != RC_OK ) {
77+
if ( adfCreateFlop ( device, label, (unsigned char) type ) != ADF_RC_OK ) {
7878
fprintf ( stderr, "Error formatting the disk image '%s'!", adfname );
7979
adfDevClose ( device );
8080
adfEnvCleanUp();

examples/adf_show_metadata.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main ( const int argc,
6161
}
6262

6363
ADF_RETCODE rc = adfDevMount ( dev );
64-
if ( rc != RC_OK ) {
64+
if ( rc != ADF_RC_OK ) {
6565
fprintf ( stderr, "Cannot get volume info for file/device '%s' - aborting...\n",
6666
args.adfname );
6767
goto dev_cleanup;
@@ -159,7 +159,7 @@ void show_dentry_metadata ( struct AdfVolume * const vol,
159159

160160
//printf ( "Directory:\t%s\n", dir_path );
161161
if ( strcmp ( dir_path, "." ) != 0 ) {
162-
if ( adfChangeDir ( vol, dir_path ) != RC_OK ) {
162+
if ( adfChangeDir ( vol, dir_path ) != ADF_RC_OK ) {
163163
fprintf ( stderr, "Invalid dir: '%s'\n", dir_path );
164164
goto show_entry_cleanup;
165165
}

examples/adf_show_metadata_dir.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void show_directory_metadata ( struct AdfVolume * const vol,
1414
struct AdfDirBlock //AdfEntryBlock
1515
dir_block;
1616
if ( adfReadEntryBlock ( vol, dir_sector,
17-
( struct AdfEntryBlock * ) &dir_block ) != RC_OK )
17+
( struct AdfEntryBlock * ) &dir_block ) != ADF_RC_OK )
1818
{
1919
fprintf ( stderr, "Error reading directory entry block (%d)\n",
2020
dir_sector );

examples/adf_show_metadata_file.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void show_file_metadata ( struct AdfVolume * const vol,
1313
{
1414
struct AdfFileHeaderBlock fheader_block;
1515
if ( adfReadEntryBlock ( vol, fheader_sector,
16-
( struct AdfEntryBlock * ) &fheader_block ) != RC_OK )
16+
( struct AdfEntryBlock * ) &fheader_block ) != ADF_RC_OK )
1717
{
1818
fprintf ( stderr, "Error reading file header block (sector: %d).\n",
1919
fheader_sector );
@@ -136,7 +136,7 @@ void show_file_ext_blocks ( struct AdfVolume * const vol,
136136
extblock.extension = fheader_block->extension; // copy initial extension pointer (sector)
137137
while ( extblock.extension ) {
138138
int32_t extblock_sector = extblock.extension;
139-
if ( adfReadFileExtBlock ( vol, extblock_sector, &extblock ) != RC_OK ) {
139+
if ( adfReadFileExtBlock ( vol, extblock_sector, &extblock ) != ADF_RC_OK ) {
140140
fprintf ( stderr, "Error reading ext block from sector 0x%x (%u).\n",
141141
extblock_sector, extblock_sector );
142142
return;

examples/adf_show_metadata_volume.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void show_volume_metadata ( struct AdfVolume * const vol )
2121
adfVolInfo ( vol );
2222

2323
struct AdfBootBlock bblock;
24-
if ( adfReadBootBlock ( vol, &bblock ) != RC_OK ) {
24+
if ( adfReadBootBlock ( vol, &bblock ) != ADF_RC_OK ) {
2525
fprintf ( stderr, "Error reading rootblock\n");
2626
return;
2727
}
@@ -30,7 +30,7 @@ void show_volume_metadata ( struct AdfVolume * const vol )
3030
SECTNUM root_block_sector = adfVolCalcRootBlk ( vol );
3131
printf ("\nRoot block sector:\t%u\n", root_block_sector );
3232
struct AdfRootBlock rblock;
33-
if ( adfReadRootBlock ( vol, (uint32_t)root_block_sector, &rblock ) != RC_OK ) {
33+
if ( adfReadRootBlock ( vol, (uint32_t)root_block_sector, &rblock ) != ADF_RC_OK ) {
3434
fprintf ( stderr, "Error reading rootblock at sector %u.\n", root_block_sector );
3535
return;
3636
}
@@ -165,7 +165,7 @@ static void show_bmpages ( struct AdfVolume * const vol,
165165
while ( nSect != 0 ) {
166166
struct AdfBitmapExtBlock bmExtBlock;
167167
ADF_RETCODE rc = adfReadBitmapExtBlock ( vol, nSect, &bmExtBlock );
168-
if ( rc == RC_OK ) {
168+
if ( rc == ADF_RC_OK ) {
169169
show_bmpages_array ( (const int32_t * const) &bmExtBlock.bmPages,
170170
ADF_BM_PAGES_EXT_SIZE );
171171
} else {

examples/unadf.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
100100
}
101101

102102
/* mount device */
103-
if (adfDevMount(dev) != RC_OK) {
103+
if (adfDevMount(dev) != ADF_RC_OK) {
104104
fprintf(stderr, "%s: can't mount device\n", adf_file);
105105
goto error_handler;
106106
}
@@ -376,7 +376,7 @@ void extract_tree(struct AdfVolume *vol, struct AdfList *node, char *path)
376376
/* recurse into subdirectories */
377377
if (node->subdir) {
378378
char *newpath = join_path(path, e->name);
379-
if (adfChangeDir(vol, e->name) == RC_OK) {
379+
if (adfChangeDir(vol, e->name) == ADF_RC_OK) {
380380
extract_tree(vol, node->subdir, newpath);
381381
adfParentDir(vol);
382382
}
@@ -405,7 +405,7 @@ void extract_filepath(struct AdfVolume *vol, char *filepath)
405405
if (*p == '/') {
406406
*p = 0;
407407
if (*element) {
408-
if (adfChangeDir(vol, element) != RC_OK) {
408+
if (adfChangeDir(vol, element) != ADF_RC_OK) {
409409
fprintf(stderr, "%s: can't find directory %s in volume\n",
410410
adf_file, filepath);
411411
return;

regtests/Test/access.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
4141
adfDevInfo ( hd );
4242

4343
if ( adfCreateFlop ( hd, "empty", ADF_DOSFS_FFS |
44-
ADF_DOSFS_DIRCACHE ) != RC_OK )
44+
ADF_DOSFS_DIRCACHE ) != ADF_RC_OK )
4545
{
4646
fprintf(stderr, "can't create floppy\n");
4747
adfDevUnMount ( hd );

regtests/Test/bitmap_read_segfault.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int main ( const int argc,
4747
exit(1);
4848
}
4949
ADF_RETCODE rc = adfDevMount ( dev );
50-
if ( rc != RC_OK ) {
50+
if ( rc != ADF_RC_OK ) {
5151
log_error ( stderr, "can't mount device %s\n", argv[1] );
5252
error_status = true;
5353
goto close_dev;

regtests/Test/bitmap_recreate.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main ( const int argc,
6464
bool error_status = false;
6565

6666
/* make a copy for updating */
67-
if ( copy_file ( adfUpdate, adfOrig ) != RC_OK ) {
67+
if ( copy_file ( adfUpdate, adfOrig ) != ADF_RC_OK ) {
6868
error_status = true;
6969
goto delete_adf_copy;
7070
}
@@ -84,7 +84,7 @@ int main ( const int argc,
8484
}
8585

8686
ADF_RETCODE rc = adfDevMount ( devOrig );
87-
if ( rc != RC_OK ) {
87+
if ( rc != ADF_RC_OK ) {
8888
log_error ( stderr, "can't mount device %s\n", adfOrig );
8989
error_status = true;
9090
goto close_dev_orig;
@@ -110,7 +110,7 @@ int main ( const int argc,
110110
}
111111

112112
rc = adfDevMount ( devUpdate );
113-
if ( rc != RC_OK ) {
113+
if ( rc != ADF_RC_OK ) {
114114
log_error ( stderr, "can't mount device %s\n", adfUpdate );
115115
error_status = true;
116116
goto close_dev_updated;
@@ -127,7 +127,7 @@ int main ( const int argc,
127127

128128
/* update the block allocation bitmap */
129129
rc = adfVolRemount ( volUpdate, ADF_ACCESS_MODE_READWRITE );
130-
if ( rc != RC_OK ) {
130+
if ( rc != ADF_RC_OK ) {
131131
log_error (
132132
stderr, "error remounting read-write, volume %d\n", 0 );
133133
error_status = true;
@@ -136,15 +136,15 @@ int main ( const int argc,
136136

137137
struct AdfRootBlock root;
138138
rc = adfReadRootBlock ( volUpdate, (uint32_t) volUpdate->rootBlock, &root );
139-
if ( rc != RC_OK ) {
139+
if ( rc != ADF_RC_OK ) {
140140
adfEnv.eFct ( "Invalid RootBlock, volume %s, sector %u - aborting...",
141141
volUpdate->volName, volUpdate->rootBlock );
142142
error_status = true;
143143
goto umount_vol_updated;
144144
}
145145

146146
rc = adfReconstructBitmap ( volUpdate, &root );
147-
if ( rc != RC_OK ) {
147+
if ( rc != ADF_RC_OK ) {
148148
adfEnv.eFct ( "Error rebuilding the bitmap (%d), volume %s",
149149
rc, volUpdate->volName );
150150
error_status = true;
@@ -153,7 +153,7 @@ int main ( const int argc,
153153

154154
/*
155155
rc = adfUpdateBitmap ( vol );
156-
if ( rc != RC_OK ) {
156+
if ( rc != ADF_RC_OK ) {
157157
adfEnv.eFct ( "Error writing updated bitmap (%d), volume %s",
158158
rc, volUpdate->volName );
159159
return rc;
@@ -216,22 +216,22 @@ ADF_RETCODE copy_file ( const char * const dst_fname,
216216
log_info ( stdout, "Copying %s to %s... ", src_fname, dst_fname );
217217
FILE * const src = fopen ( src_fname, "rb" );
218218
if ( src == NULL )
219-
return RC_ERROR;
219+
return ADF_RC_ERROR;
220220

221221
FILE * const dst = fopen ( dst_fname, "wb" );
222222
if ( src == NULL ) {
223223
fclose ( src );
224-
return RC_ERROR;
224+
return ADF_RC_ERROR;
225225
}
226226

227-
ADF_RETCODE status = RC_OK;
227+
ADF_RETCODE status = ADF_RC_OK;
228228
char buffer[BUFSIZE];
229229
size_t bytes_read;
230230
while ( ( bytes_read = fread ( buffer, 1, BUFSIZE, src ) ) > 0 ) {
231231
size_t bytes_written = fwrite ( buffer, 1, bytes_read, dst );
232232
if ( bytes_written != bytes_read ) {
233233
log_error ( stderr, "error writing copy to %s\n", dst_fname );
234-
status = RC_ERROR;
234+
status = ADF_RC_ERROR;
235235
break;
236236
}
237237
}
@@ -250,7 +250,7 @@ unsigned compare_bitmaps ( struct AdfVolume * const volOrig,
250250
struct AdfBitmapBlock bmOrig, bmUpdate;
251251

252252
if ( adfReadRootBlock ( volOrig, (uint32_t) volOrig->rootBlock,
253-
&rbOrig ) != RC_OK )
253+
&rbOrig ) != ADF_RC_OK )
254254
{
255255
log_error ( stderr, "invalid RootBlock on orig. volume, sector %u\n",
256256
volOrig->rootBlock );
@@ -259,7 +259,7 @@ unsigned compare_bitmaps ( struct AdfVolume * const volOrig,
259259
}
260260

261261
if ( adfReadRootBlock ( volUpdate, (uint32_t) volUpdate->rootBlock,
262-
&rbUpdate ) != RC_OK )
262+
&rbUpdate ) != ADF_RC_OK )
263263
{
264264
log_error ( stderr, "invalid RootBlock on orig. volume, sector %u\n",
265265
volOrig->rootBlock );
@@ -293,15 +293,15 @@ unsigned compare_bitmaps ( struct AdfVolume * const volOrig,
293293
}
294294

295295
ADF_RETCODE rc = adfReadBitmapBlock ( volOrig, bmPageOrig, &bmOrig );
296-
if ( rc != RC_OK ) {
296+
if ( rc != ADF_RC_OK ) {
297297
log_error ( stderr, "error reading bitmap block on vol. orig, block %u\n",
298298
bmPageOrig );
299299
nerrors++;
300300
continue;
301301
}
302302

303303
rc = adfReadBitmapBlock ( volUpdate, bmPageUpdate, &bmUpdate );
304-
if ( rc != RC_OK ) {
304+
if ( rc != ADF_RC_OK ) {
305305
log_error ( stderr, "error reading bitmap block on vol. update, block %u\n",
306306
bmPageOrig );
307307
nerrors++;

regtests/Test/bootdisk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
5252
adfDevInfo ( hd );
5353

5454
if ( adfCreateFlop ( hd, "empty", ADF_DOSFS_FFS |
55-
ADF_DOSFS_DIRCACHE ) != RC_OK )
55+
ADF_DOSFS_DIRCACHE ) != ADF_RC_OK )
5656
{
5757
fprintf(stderr, "can't create floppy\n");
5858
adfDevUnMount ( hd );

regtests/Test/cache_crash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
1515
adfEnvInitDefault();
1616
adfEnvSetProperty ( ADF_PR_IGNORE_CHECKSUM_ERRORS, true );
1717
if ((dev = adfDevOpen(argv[1], ADF_ACCESS_MODE_READONLY))) {
18-
if (adfDevMount(dev) == RC_OK) {
18+
if (adfDevMount(dev) == ADF_RC_OK) {
1919
if ((vol = adfVolMount(dev, 0, ADF_ACCESS_MODE_READONLY))) {
2020
/* use dir cache (enables the crash) */
2121
adfEnvSetProperty(ADF_PR_USEDIRC, true);

regtests/Test/comment.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
4141
adfDevInfo ( hd );
4242

4343
if ( adfCreateFlop ( hd, "empty", ADF_DOSFS_FFS |
44-
ADF_DOSFS_DIRCACHE ) != RC_OK )
44+
ADF_DOSFS_DIRCACHE ) != ADF_RC_OK )
4545
{
4646
fprintf(stderr, "can't create floppy\n");
4747
adfDevUnMount ( hd );

regtests/Test/del_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
4343
}
4444

4545
ADF_RETCODE rc = adfDevMount ( hd );
46-
if ( rc != RC_OK ) {
46+
if ( rc != ADF_RC_OK ) {
4747
fprintf(stderr, "can't mount device\n");
4848
adfDevClose ( hd );
4949
adfEnvCleanUp(); exit(1);

0 commit comments

Comments
 (0)