Changeset b568ccb in rtems
- Timestamp:
- 11/02/99 20:20:13 (23 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- dfbfa2b0
- Parents:
- 317a5b5
- Files:
-
- 4 deleted
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libfs/src/imfs/deviceio.c
r317a5b5 rb568ccb 18 18 #include <rtems.h> 19 19 #include <rtems/libio.h> 20 #include "libio_.h" 20 21 21 22 #include "imfs.h" … … 214 215 * This IMFS_stat() is used. 215 216 */ 217 218 /* 219 * device_rmnod 220 */ 221 222 int device_rmnod( 223 rtems_filesystem_location_info_t *pathloc /* IN */ 224 ) 225 { 226 IMFS_jnode_t *the_jnode; 227 228 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 229 230 /* 231 * Take the node out of the parent's chain that contains this node 232 */ 233 234 if ( the_jnode->Parent != NULL ) { 235 Chain_Extract( (Chain_Node *) the_jnode ); 236 the_jnode->Parent = NULL; 237 } 238 239 /* 240 * Decrement the link counter and see if we can free the space. 241 */ 242 243 the_jnode->st_nlink--; 244 IMFS_update_ctime( the_jnode ); 245 246 /* 247 * The file cannot be open and the link must be less than 1 to free. 248 */ 249 250 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 251 252 /* 253 * Is the rtems_filesystem_current is this node? 254 */ 255 256 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 257 rtems_filesystem_current.node_access = NULL; 258 259 /* 260 * Free memory associated with a memory file. 261 */ 262 263 free( the_jnode ); 264 } 265 266 return 0; 267 268 } 269 270 271 -
c/src/exec/libfs/src/imfs/imfs.h
r317a5b5 rb568ccb 309 309 ); 310 310 311 int IMFS_rmnod(312 rtems_filesystem_location_info_t *pathloc /* IN */313 );314 315 311 int IMFS_mknod( 316 312 const char *path, /* IN */ … … 354 350 off_t length /* IN */ 355 351 ); 352 356 353 int imfs_dir_open( 357 354 rtems_libio_t *iop, /* IN */ … … 360 357 unsigned32 mode /* IN */ 361 358 ); 359 362 360 int imfs_dir_close( 363 361 rtems_libio_t *iop /* IN */ 364 362 ); 363 365 364 int imfs_dir_read( 366 365 rtems_libio_t *iop, /* IN */ … … 368 367 unsigned32 count /* IN */ 369 368 ); 369 370 370 int imfs_dir_lseek( 371 371 rtems_libio_t *iop, /* IN */ … … 373 373 int whence /* IN */ 374 374 ); 375 375 376 int imfs_dir_fstat( 376 377 rtems_filesystem_location_info_t *loc, /* IN */ 377 378 struct stat *buf /* OUT */ 378 379 ); 380 381 int imfs_dir_rmnod( 382 rtems_filesystem_location_info_t *pathloc /* IN */ 383 ); 384 379 385 int memfile_open( 380 386 rtems_libio_t *iop, /* IN */ … … 383 389 unsigned32 mode /* IN */ 384 390 ); 391 385 392 int memfile_close( 386 393 rtems_libio_t *iop /* IN */ 387 394 ); 395 388 396 int memfile_read( 389 397 rtems_libio_t *iop, /* IN */ … … 391 399 unsigned32 count /* IN */ 392 400 ); 401 393 402 int memfile_write( 394 403 rtems_libio_t *iop, /* IN */ … … 396 405 unsigned32 count /* IN */ 397 406 ); 407 398 408 int memfile_ioctl( 399 409 rtems_libio_t *iop, /* IN */ … … 401 411 void *buffer /* IN */ 402 412 ); 413 403 414 int memfile_lseek( 404 415 rtems_libio_t *iop, /* IN */ … … 406 417 int whence /* IN */ 407 418 ); 419 420 int memfile_rmnod( 421 rtems_filesystem_location_info_t *pathloc /* IN */ 422 ); 423 408 424 int device_open( 409 425 rtems_libio_t *iop, /* IN */ … … 412 428 unsigned32 mode /* IN */ 413 429 ); 430 414 431 int device_close( 415 432 rtems_libio_t *iop /* IN */ 416 433 ); 434 417 435 int device_read( 418 436 rtems_libio_t *iop, /* IN */ … … 420 438 unsigned32 count /* IN */ 421 439 ); 440 422 441 int device_write( 423 442 rtems_libio_t *iop, /* IN */ … … 425 444 unsigned32 count /* IN */ 426 445 ); 446 427 447 int device_ioctl( 428 448 rtems_libio_t *iop, /* IN */ … … 430 450 void *buffer /* IN */ 431 451 ); 452 432 453 int device_lseek( 433 454 rtems_libio_t *iop, /* IN */ … … 435 456 int whence /* IN */ 436 457 ); 458 459 int device_rmnod( 460 rtems_filesystem_location_info_t *pathloc /* IN */ 461 ); 462 437 463 int IMFS_utime( 438 464 rtems_filesystem_location_info_t *pathloc, /* IN */ … … 440 466 time_t modtime /* IN */ 441 467 ); 468 442 469 int IMFS_fchmod( 443 470 rtems_filesystem_location_info_t *loc, -
c/src/exec/libfs/src/imfs/imfs_directory.c
r317a5b5 rb568ccb 270 270 } 271 271 272 272 /* 273 * IMFS_dir_rmnod 274 * 275 * This routine is available from the optable to remove a node 276 * from the IMFS file system. 277 */ 278 279 int imfs_dir_rmnod( 280 rtems_filesystem_location_info_t *pathloc /* IN */ 281 ) 282 { 283 IMFS_jnode_t *the_jnode; 284 285 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 286 287 /* 288 * You cannot remove a node that still has children 289 */ 290 291 if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) 292 set_errno_and_return_minus_one( ENOTEMPTY ); 293 294 /* 295 * You cannot remove the file system root node. 296 */ 297 298 if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access ) 299 set_errno_and_return_minus_one( EBUSY ); 300 301 /* 302 * You cannot remove a mountpoint. 303 */ 304 305 if ( the_jnode->info.directory.mt_fs != NULL ) 306 set_errno_and_return_minus_one( EBUSY ); 307 308 /* 309 * Take the node out of the parent's chain that contains this node 310 */ 311 312 if ( the_jnode->Parent != NULL ) { 313 Chain_Extract( (Chain_Node *) the_jnode ); 314 the_jnode->Parent = NULL; 315 } 316 317 /* 318 * Decrement the link counter and see if we can free the space. 319 */ 320 321 the_jnode->st_nlink--; 322 IMFS_update_ctime( the_jnode ); 323 324 /* 325 * The file cannot be open and the link must be less than 1 to free. 326 */ 327 328 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 329 330 /* 331 * Is the rtems_filesystem_current is this node? 332 */ 333 334 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 335 rtems_filesystem_current.node_access = NULL; 336 337 /* 338 * Free memory associated with a memory file. 339 */ 340 341 free( the_jnode ); 342 } 343 344 return 0; 345 346 } 347 348 -
c/src/exec/libfs/src/imfs/imfs_handlers_device.c
r317a5b5 rb568ccb 35 35 NULL, /* fdatasync */ 36 36 NULL, /* fcntl */ 37 IMFS_rmnod37 device_rmnod 38 38 }; -
c/src/exec/libfs/src/imfs/imfs_handlers_directory.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 imfs_dir_rmnod 38 38 }; 39 39 -
c/src/exec/libfs/src/imfs/imfs_handlers_memfile.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 memfile_rmnod 38 38 }; -
c/src/exec/libfs/src/imfs/imfs_unlink.c
r317a5b5 rb568ccb 56 56 IMFS_update_ctime( node->info.hard_link.link_node ); 57 57 if ( node->info.hard_link.link_node->st_nlink < 1) { 58 result = IMFS_rmnod( &the_link );58 result = (*loc->handlers->rmnod)( &the_link ); 59 59 if ( result != 0 ) 60 60 return -1; … … 62 62 } 63 63 64 result = IMFS_rmnod( loc);64 result = (*loc->handlers->rmnod)( &the_link ); 65 65 66 66 return result; -
c/src/exec/libfs/src/imfs/memfile.c
r317a5b5 rb568ccb 29 29 30 30 #define MEMFILE_STATIC 31 32 /*33 * Set of operations handlers for operations on memfile entities.34 */35 36 rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {37 memfile_open,38 memfile_close,39 memfile_read,40 memfile_write,41 memfile_ioctl,42 memfile_lseek,43 IMFS_stat,44 IMFS_fchmod,45 memfile_ftruncate,46 NULL, /* fpathconf */47 NULL, /* fsync */48 IMFS_fdatasync,49 IMFS_fcntl50 };51 31 52 32 /* … … 1057 1037 } 1058 1038 1039 1040 /* 1041 * memfile_rmnod 1042 * 1043 * This routine is available from the optable to remove a node 1044 * from the IMFS file system. 1045 */ 1046 1047 int memfile_rmnod( 1048 rtems_filesystem_location_info_t *pathloc /* IN */ 1049 ) 1050 { 1051 IMFS_jnode_t *the_jnode; 1052 1053 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 1054 1055 /* 1056 * Take the node out of the parent's chain that contains this node 1057 */ 1058 1059 if ( the_jnode->Parent != NULL ) { 1060 Chain_Extract( (Chain_Node *) the_jnode ); 1061 the_jnode->Parent = NULL; 1062 } 1063 1064 /* 1065 * Decrement the link counter and see if we can free the space. 1066 */ 1067 1068 the_jnode->st_nlink--; 1069 IMFS_update_ctime( the_jnode ); 1070 1071 /* 1072 * The file cannot be open and the link must be less than 1 to free. 1073 */ 1074 1075 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 1076 1077 /* 1078 * Is the rtems_filesystem_current is this node? 1079 */ 1080 1081 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 1082 rtems_filesystem_current.node_access = NULL; 1083 1084 /* 1085 * Free memory associated with a memory file. 1086 */ 1087 1088 IMFS_memfile_remove( the_jnode ); 1089 1090 free( the_jnode ); 1091 } 1092 1093 return 0; 1094 1095 } 1096 1097 -
c/src/exec/libfs/src/imfs/miniimfs_init.c
r317a5b5 rb568ccb 38 38 IMFS_node_type, 39 39 IMFS_mknod, 40 NULL, /* XXX IMFS_rmnod, */41 40 NULL, /* XXX IMFS_chown, */ 42 41 NULL, /* XXX IMFS_freenodinfo, */ -
c/src/lib/libc/Makefile.in
r317a5b5 rb568ccb 26 26 IMFS_C_PIECES = imfs_chown imfs_creat imfs_directory imfs_eval imfs_free \ 27 27 imfs_fsunmount imfs_gtkn imfs_init imfs_initsupp imfs_link imfs_mknod \ 28 imfs_mount imfs_fchmod imfs_ rmnod imfs_unlink imfs_unmount imfs_utime \28 imfs_mount imfs_fchmod imfs_unlink imfs_unmount imfs_utime \ 29 29 imfs_ntype imfs_stat imfs_getchild memfile deviceio imfs_handlers_device \ 30 30 imfs_handlers_directory imfs_handlers_memfile imfs_debug imfs_symlink \ -
c/src/lib/libc/deviceio.c
r317a5b5 rb568ccb 18 18 #include <rtems.h> 19 19 #include <rtems/libio.h> 20 #include "libio_.h" 20 21 21 22 #include "imfs.h" … … 214 215 * This IMFS_stat() is used. 215 216 */ 217 218 /* 219 * device_rmnod 220 */ 221 222 int device_rmnod( 223 rtems_filesystem_location_info_t *pathloc /* IN */ 224 ) 225 { 226 IMFS_jnode_t *the_jnode; 227 228 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 229 230 /* 231 * Take the node out of the parent's chain that contains this node 232 */ 233 234 if ( the_jnode->Parent != NULL ) { 235 Chain_Extract( (Chain_Node *) the_jnode ); 236 the_jnode->Parent = NULL; 237 } 238 239 /* 240 * Decrement the link counter and see if we can free the space. 241 */ 242 243 the_jnode->st_nlink--; 244 IMFS_update_ctime( the_jnode ); 245 246 /* 247 * The file cannot be open and the link must be less than 1 to free. 248 */ 249 250 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 251 252 /* 253 * Is the rtems_filesystem_current is this node? 254 */ 255 256 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 257 rtems_filesystem_current.node_access = NULL; 258 259 /* 260 * Free memory associated with a memory file. 261 */ 262 263 free( the_jnode ); 264 } 265 266 return 0; 267 268 } 269 270 271 -
c/src/lib/libc/imfs.h
r317a5b5 rb568ccb 309 309 ); 310 310 311 int IMFS_rmnod(312 rtems_filesystem_location_info_t *pathloc /* IN */313 );314 315 311 int IMFS_mknod( 316 312 const char *path, /* IN */ … … 354 350 off_t length /* IN */ 355 351 ); 352 356 353 int imfs_dir_open( 357 354 rtems_libio_t *iop, /* IN */ … … 360 357 unsigned32 mode /* IN */ 361 358 ); 359 362 360 int imfs_dir_close( 363 361 rtems_libio_t *iop /* IN */ 364 362 ); 363 365 364 int imfs_dir_read( 366 365 rtems_libio_t *iop, /* IN */ … … 368 367 unsigned32 count /* IN */ 369 368 ); 369 370 370 int imfs_dir_lseek( 371 371 rtems_libio_t *iop, /* IN */ … … 373 373 int whence /* IN */ 374 374 ); 375 375 376 int imfs_dir_fstat( 376 377 rtems_filesystem_location_info_t *loc, /* IN */ 377 378 struct stat *buf /* OUT */ 378 379 ); 380 381 int imfs_dir_rmnod( 382 rtems_filesystem_location_info_t *pathloc /* IN */ 383 ); 384 379 385 int memfile_open( 380 386 rtems_libio_t *iop, /* IN */ … … 383 389 unsigned32 mode /* IN */ 384 390 ); 391 385 392 int memfile_close( 386 393 rtems_libio_t *iop /* IN */ 387 394 ); 395 388 396 int memfile_read( 389 397 rtems_libio_t *iop, /* IN */ … … 391 399 unsigned32 count /* IN */ 392 400 ); 401 393 402 int memfile_write( 394 403 rtems_libio_t *iop, /* IN */ … … 396 405 unsigned32 count /* IN */ 397 406 ); 407 398 408 int memfile_ioctl( 399 409 rtems_libio_t *iop, /* IN */ … … 401 411 void *buffer /* IN */ 402 412 ); 413 403 414 int memfile_lseek( 404 415 rtems_libio_t *iop, /* IN */ … … 406 417 int whence /* IN */ 407 418 ); 419 420 int memfile_rmnod( 421 rtems_filesystem_location_info_t *pathloc /* IN */ 422 ); 423 408 424 int device_open( 409 425 rtems_libio_t *iop, /* IN */ … … 412 428 unsigned32 mode /* IN */ 413 429 ); 430 414 431 int device_close( 415 432 rtems_libio_t *iop /* IN */ 416 433 ); 434 417 435 int device_read( 418 436 rtems_libio_t *iop, /* IN */ … … 420 438 unsigned32 count /* IN */ 421 439 ); 440 422 441 int device_write( 423 442 rtems_libio_t *iop, /* IN */ … … 425 444 unsigned32 count /* IN */ 426 445 ); 446 427 447 int device_ioctl( 428 448 rtems_libio_t *iop, /* IN */ … … 430 450 void *buffer /* IN */ 431 451 ); 452 432 453 int device_lseek( 433 454 rtems_libio_t *iop, /* IN */ … … 435 456 int whence /* IN */ 436 457 ); 458 459 int device_rmnod( 460 rtems_filesystem_location_info_t *pathloc /* IN */ 461 ); 462 437 463 int IMFS_utime( 438 464 rtems_filesystem_location_info_t *pathloc, /* IN */ … … 440 466 time_t modtime /* IN */ 441 467 ); 468 442 469 int IMFS_fchmod( 443 470 rtems_filesystem_location_info_t *loc, -
c/src/lib/libc/imfs_directory.c
r317a5b5 rb568ccb 270 270 } 271 271 272 272 /* 273 * IMFS_dir_rmnod 274 * 275 * This routine is available from the optable to remove a node 276 * from the IMFS file system. 277 */ 278 279 int imfs_dir_rmnod( 280 rtems_filesystem_location_info_t *pathloc /* IN */ 281 ) 282 { 283 IMFS_jnode_t *the_jnode; 284 285 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 286 287 /* 288 * You cannot remove a node that still has children 289 */ 290 291 if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) 292 set_errno_and_return_minus_one( ENOTEMPTY ); 293 294 /* 295 * You cannot remove the file system root node. 296 */ 297 298 if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access ) 299 set_errno_and_return_minus_one( EBUSY ); 300 301 /* 302 * You cannot remove a mountpoint. 303 */ 304 305 if ( the_jnode->info.directory.mt_fs != NULL ) 306 set_errno_and_return_minus_one( EBUSY ); 307 308 /* 309 * Take the node out of the parent's chain that contains this node 310 */ 311 312 if ( the_jnode->Parent != NULL ) { 313 Chain_Extract( (Chain_Node *) the_jnode ); 314 the_jnode->Parent = NULL; 315 } 316 317 /* 318 * Decrement the link counter and see if we can free the space. 319 */ 320 321 the_jnode->st_nlink--; 322 IMFS_update_ctime( the_jnode ); 323 324 /* 325 * The file cannot be open and the link must be less than 1 to free. 326 */ 327 328 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 329 330 /* 331 * Is the rtems_filesystem_current is this node? 332 */ 333 334 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 335 rtems_filesystem_current.node_access = NULL; 336 337 /* 338 * Free memory associated with a memory file. 339 */ 340 341 free( the_jnode ); 342 } 343 344 return 0; 345 346 } 347 348 -
c/src/lib/libc/imfs_handlers_device.c
r317a5b5 rb568ccb 35 35 NULL, /* fdatasync */ 36 36 NULL, /* fcntl */ 37 IMFS_rmnod37 device_rmnod 38 38 }; -
c/src/lib/libc/imfs_handlers_directory.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 imfs_dir_rmnod 38 38 }; 39 39 -
c/src/lib/libc/imfs_handlers_memfile.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 memfile_rmnod 38 38 }; -
c/src/lib/libc/imfs_unlink.c
r317a5b5 rb568ccb 56 56 IMFS_update_ctime( node->info.hard_link.link_node ); 57 57 if ( node->info.hard_link.link_node->st_nlink < 1) { 58 result = IMFS_rmnod( &the_link );58 result = (*loc->handlers->rmnod)( &the_link ); 59 59 if ( result != 0 ) 60 60 return -1; … … 62 62 } 63 63 64 result = IMFS_rmnod( loc);64 result = (*loc->handlers->rmnod)( &the_link ); 65 65 66 66 return result; -
c/src/lib/libc/memfile.c
r317a5b5 rb568ccb 29 29 30 30 #define MEMFILE_STATIC 31 32 /*33 * Set of operations handlers for operations on memfile entities.34 */35 36 rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {37 memfile_open,38 memfile_close,39 memfile_read,40 memfile_write,41 memfile_ioctl,42 memfile_lseek,43 IMFS_stat,44 IMFS_fchmod,45 memfile_ftruncate,46 NULL, /* fpathconf */47 NULL, /* fsync */48 IMFS_fdatasync,49 IMFS_fcntl50 };51 31 52 32 /* … … 1057 1037 } 1058 1038 1039 1040 /* 1041 * memfile_rmnod 1042 * 1043 * This routine is available from the optable to remove a node 1044 * from the IMFS file system. 1045 */ 1046 1047 int memfile_rmnod( 1048 rtems_filesystem_location_info_t *pathloc /* IN */ 1049 ) 1050 { 1051 IMFS_jnode_t *the_jnode; 1052 1053 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 1054 1055 /* 1056 * Take the node out of the parent's chain that contains this node 1057 */ 1058 1059 if ( the_jnode->Parent != NULL ) { 1060 Chain_Extract( (Chain_Node *) the_jnode ); 1061 the_jnode->Parent = NULL; 1062 } 1063 1064 /* 1065 * Decrement the link counter and see if we can free the space. 1066 */ 1067 1068 the_jnode->st_nlink--; 1069 IMFS_update_ctime( the_jnode ); 1070 1071 /* 1072 * The file cannot be open and the link must be less than 1 to free. 1073 */ 1074 1075 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 1076 1077 /* 1078 * Is the rtems_filesystem_current is this node? 1079 */ 1080 1081 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 1082 rtems_filesystem_current.node_access = NULL; 1083 1084 /* 1085 * Free memory associated with a memory file. 1086 */ 1087 1088 IMFS_memfile_remove( the_jnode ); 1089 1090 free( the_jnode ); 1091 } 1092 1093 return 0; 1094 1095 } 1096 1097 -
c/src/lib/libc/miniimfs_init.c
r317a5b5 rb568ccb 38 38 IMFS_node_type, 39 39 IMFS_mknod, 40 NULL, /* XXX IMFS_rmnod, */41 40 NULL, /* XXX IMFS_chown, */ 42 41 NULL, /* XXX IMFS_freenodinfo, */ -
c/src/libfs/src/imfs/deviceio.c
r317a5b5 rb568ccb 18 18 #include <rtems.h> 19 19 #include <rtems/libio.h> 20 #include "libio_.h" 20 21 21 22 #include "imfs.h" … … 214 215 * This IMFS_stat() is used. 215 216 */ 217 218 /* 219 * device_rmnod 220 */ 221 222 int device_rmnod( 223 rtems_filesystem_location_info_t *pathloc /* IN */ 224 ) 225 { 226 IMFS_jnode_t *the_jnode; 227 228 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 229 230 /* 231 * Take the node out of the parent's chain that contains this node 232 */ 233 234 if ( the_jnode->Parent != NULL ) { 235 Chain_Extract( (Chain_Node *) the_jnode ); 236 the_jnode->Parent = NULL; 237 } 238 239 /* 240 * Decrement the link counter and see if we can free the space. 241 */ 242 243 the_jnode->st_nlink--; 244 IMFS_update_ctime( the_jnode ); 245 246 /* 247 * The file cannot be open and the link must be less than 1 to free. 248 */ 249 250 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 251 252 /* 253 * Is the rtems_filesystem_current is this node? 254 */ 255 256 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 257 rtems_filesystem_current.node_access = NULL; 258 259 /* 260 * Free memory associated with a memory file. 261 */ 262 263 free( the_jnode ); 264 } 265 266 return 0; 267 268 } 269 270 271 -
c/src/libfs/src/imfs/imfs.h
r317a5b5 rb568ccb 309 309 ); 310 310 311 int IMFS_rmnod(312 rtems_filesystem_location_info_t *pathloc /* IN */313 );314 315 311 int IMFS_mknod( 316 312 const char *path, /* IN */ … … 354 350 off_t length /* IN */ 355 351 ); 352 356 353 int imfs_dir_open( 357 354 rtems_libio_t *iop, /* IN */ … … 360 357 unsigned32 mode /* IN */ 361 358 ); 359 362 360 int imfs_dir_close( 363 361 rtems_libio_t *iop /* IN */ 364 362 ); 363 365 364 int imfs_dir_read( 366 365 rtems_libio_t *iop, /* IN */ … … 368 367 unsigned32 count /* IN */ 369 368 ); 369 370 370 int imfs_dir_lseek( 371 371 rtems_libio_t *iop, /* IN */ … … 373 373 int whence /* IN */ 374 374 ); 375 375 376 int imfs_dir_fstat( 376 377 rtems_filesystem_location_info_t *loc, /* IN */ 377 378 struct stat *buf /* OUT */ 378 379 ); 380 381 int imfs_dir_rmnod( 382 rtems_filesystem_location_info_t *pathloc /* IN */ 383 ); 384 379 385 int memfile_open( 380 386 rtems_libio_t *iop, /* IN */ … … 383 389 unsigned32 mode /* IN */ 384 390 ); 391 385 392 int memfile_close( 386 393 rtems_libio_t *iop /* IN */ 387 394 ); 395 388 396 int memfile_read( 389 397 rtems_libio_t *iop, /* IN */ … … 391 399 unsigned32 count /* IN */ 392 400 ); 401 393 402 int memfile_write( 394 403 rtems_libio_t *iop, /* IN */ … … 396 405 unsigned32 count /* IN */ 397 406 ); 407 398 408 int memfile_ioctl( 399 409 rtems_libio_t *iop, /* IN */ … … 401 411 void *buffer /* IN */ 402 412 ); 413 403 414 int memfile_lseek( 404 415 rtems_libio_t *iop, /* IN */ … … 406 417 int whence /* IN */ 407 418 ); 419 420 int memfile_rmnod( 421 rtems_filesystem_location_info_t *pathloc /* IN */ 422 ); 423 408 424 int device_open( 409 425 rtems_libio_t *iop, /* IN */ … … 412 428 unsigned32 mode /* IN */ 413 429 ); 430 414 431 int device_close( 415 432 rtems_libio_t *iop /* IN */ 416 433 ); 434 417 435 int device_read( 418 436 rtems_libio_t *iop, /* IN */ … … 420 438 unsigned32 count /* IN */ 421 439 ); 440 422 441 int device_write( 423 442 rtems_libio_t *iop, /* IN */ … … 425 444 unsigned32 count /* IN */ 426 445 ); 446 427 447 int device_ioctl( 428 448 rtems_libio_t *iop, /* IN */ … … 430 450 void *buffer /* IN */ 431 451 ); 452 432 453 int device_lseek( 433 454 rtems_libio_t *iop, /* IN */ … … 435 456 int whence /* IN */ 436 457 ); 458 459 int device_rmnod( 460 rtems_filesystem_location_info_t *pathloc /* IN */ 461 ); 462 437 463 int IMFS_utime( 438 464 rtems_filesystem_location_info_t *pathloc, /* IN */ … … 440 466 time_t modtime /* IN */ 441 467 ); 468 442 469 int IMFS_fchmod( 443 470 rtems_filesystem_location_info_t *loc, -
c/src/libfs/src/imfs/imfs_directory.c
r317a5b5 rb568ccb 270 270 } 271 271 272 272 /* 273 * IMFS_dir_rmnod 274 * 275 * This routine is available from the optable to remove a node 276 * from the IMFS file system. 277 */ 278 279 int imfs_dir_rmnod( 280 rtems_filesystem_location_info_t *pathloc /* IN */ 281 ) 282 { 283 IMFS_jnode_t *the_jnode; 284 285 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 286 287 /* 288 * You cannot remove a node that still has children 289 */ 290 291 if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) 292 set_errno_and_return_minus_one( ENOTEMPTY ); 293 294 /* 295 * You cannot remove the file system root node. 296 */ 297 298 if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access ) 299 set_errno_and_return_minus_one( EBUSY ); 300 301 /* 302 * You cannot remove a mountpoint. 303 */ 304 305 if ( the_jnode->info.directory.mt_fs != NULL ) 306 set_errno_and_return_minus_one( EBUSY ); 307 308 /* 309 * Take the node out of the parent's chain that contains this node 310 */ 311 312 if ( the_jnode->Parent != NULL ) { 313 Chain_Extract( (Chain_Node *) the_jnode ); 314 the_jnode->Parent = NULL; 315 } 316 317 /* 318 * Decrement the link counter and see if we can free the space. 319 */ 320 321 the_jnode->st_nlink--; 322 IMFS_update_ctime( the_jnode ); 323 324 /* 325 * The file cannot be open and the link must be less than 1 to free. 326 */ 327 328 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 329 330 /* 331 * Is the rtems_filesystem_current is this node? 332 */ 333 334 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 335 rtems_filesystem_current.node_access = NULL; 336 337 /* 338 * Free memory associated with a memory file. 339 */ 340 341 free( the_jnode ); 342 } 343 344 return 0; 345 346 } 347 348 -
c/src/libfs/src/imfs/imfs_handlers_device.c
r317a5b5 rb568ccb 35 35 NULL, /* fdatasync */ 36 36 NULL, /* fcntl */ 37 IMFS_rmnod37 device_rmnod 38 38 }; -
c/src/libfs/src/imfs/imfs_handlers_directory.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 imfs_dir_rmnod 38 38 }; 39 39 -
c/src/libfs/src/imfs/imfs_handlers_memfile.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 memfile_rmnod 38 38 }; -
c/src/libfs/src/imfs/imfs_unlink.c
r317a5b5 rb568ccb 56 56 IMFS_update_ctime( node->info.hard_link.link_node ); 57 57 if ( node->info.hard_link.link_node->st_nlink < 1) { 58 result = IMFS_rmnod( &the_link );58 result = (*loc->handlers->rmnod)( &the_link ); 59 59 if ( result != 0 ) 60 60 return -1; … … 62 62 } 63 63 64 result = IMFS_rmnod( loc);64 result = (*loc->handlers->rmnod)( &the_link ); 65 65 66 66 return result; -
c/src/libfs/src/imfs/memfile.c
r317a5b5 rb568ccb 29 29 30 30 #define MEMFILE_STATIC 31 32 /*33 * Set of operations handlers for operations on memfile entities.34 */35 36 rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {37 memfile_open,38 memfile_close,39 memfile_read,40 memfile_write,41 memfile_ioctl,42 memfile_lseek,43 IMFS_stat,44 IMFS_fchmod,45 memfile_ftruncate,46 NULL, /* fpathconf */47 NULL, /* fsync */48 IMFS_fdatasync,49 IMFS_fcntl50 };51 31 52 32 /* … … 1057 1037 } 1058 1038 1039 1040 /* 1041 * memfile_rmnod 1042 * 1043 * This routine is available from the optable to remove a node 1044 * from the IMFS file system. 1045 */ 1046 1047 int memfile_rmnod( 1048 rtems_filesystem_location_info_t *pathloc /* IN */ 1049 ) 1050 { 1051 IMFS_jnode_t *the_jnode; 1052 1053 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 1054 1055 /* 1056 * Take the node out of the parent's chain that contains this node 1057 */ 1058 1059 if ( the_jnode->Parent != NULL ) { 1060 Chain_Extract( (Chain_Node *) the_jnode ); 1061 the_jnode->Parent = NULL; 1062 } 1063 1064 /* 1065 * Decrement the link counter and see if we can free the space. 1066 */ 1067 1068 the_jnode->st_nlink--; 1069 IMFS_update_ctime( the_jnode ); 1070 1071 /* 1072 * The file cannot be open and the link must be less than 1 to free. 1073 */ 1074 1075 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 1076 1077 /* 1078 * Is the rtems_filesystem_current is this node? 1079 */ 1080 1081 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 1082 rtems_filesystem_current.node_access = NULL; 1083 1084 /* 1085 * Free memory associated with a memory file. 1086 */ 1087 1088 IMFS_memfile_remove( the_jnode ); 1089 1090 free( the_jnode ); 1091 } 1092 1093 return 0; 1094 1095 } 1096 1097 -
c/src/libfs/src/imfs/miniimfs_init.c
r317a5b5 rb568ccb 38 38 IMFS_node_type, 39 39 IMFS_mknod, 40 NULL, /* XXX IMFS_rmnod, */41 40 NULL, /* XXX IMFS_chown, */ 42 41 NULL, /* XXX IMFS_freenodinfo, */ -
cpukit/libfs/src/imfs/deviceio.c
r317a5b5 rb568ccb 18 18 #include <rtems.h> 19 19 #include <rtems/libio.h> 20 #include "libio_.h" 20 21 21 22 #include "imfs.h" … … 214 215 * This IMFS_stat() is used. 215 216 */ 217 218 /* 219 * device_rmnod 220 */ 221 222 int device_rmnod( 223 rtems_filesystem_location_info_t *pathloc /* IN */ 224 ) 225 { 226 IMFS_jnode_t *the_jnode; 227 228 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 229 230 /* 231 * Take the node out of the parent's chain that contains this node 232 */ 233 234 if ( the_jnode->Parent != NULL ) { 235 Chain_Extract( (Chain_Node *) the_jnode ); 236 the_jnode->Parent = NULL; 237 } 238 239 /* 240 * Decrement the link counter and see if we can free the space. 241 */ 242 243 the_jnode->st_nlink--; 244 IMFS_update_ctime( the_jnode ); 245 246 /* 247 * The file cannot be open and the link must be less than 1 to free. 248 */ 249 250 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 251 252 /* 253 * Is the rtems_filesystem_current is this node? 254 */ 255 256 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 257 rtems_filesystem_current.node_access = NULL; 258 259 /* 260 * Free memory associated with a memory file. 261 */ 262 263 free( the_jnode ); 264 } 265 266 return 0; 267 268 } 269 270 271 -
cpukit/libfs/src/imfs/imfs.h
r317a5b5 rb568ccb 309 309 ); 310 310 311 int IMFS_rmnod(312 rtems_filesystem_location_info_t *pathloc /* IN */313 );314 315 311 int IMFS_mknod( 316 312 const char *path, /* IN */ … … 354 350 off_t length /* IN */ 355 351 ); 352 356 353 int imfs_dir_open( 357 354 rtems_libio_t *iop, /* IN */ … … 360 357 unsigned32 mode /* IN */ 361 358 ); 359 362 360 int imfs_dir_close( 363 361 rtems_libio_t *iop /* IN */ 364 362 ); 363 365 364 int imfs_dir_read( 366 365 rtems_libio_t *iop, /* IN */ … … 368 367 unsigned32 count /* IN */ 369 368 ); 369 370 370 int imfs_dir_lseek( 371 371 rtems_libio_t *iop, /* IN */ … … 373 373 int whence /* IN */ 374 374 ); 375 375 376 int imfs_dir_fstat( 376 377 rtems_filesystem_location_info_t *loc, /* IN */ 377 378 struct stat *buf /* OUT */ 378 379 ); 380 381 int imfs_dir_rmnod( 382 rtems_filesystem_location_info_t *pathloc /* IN */ 383 ); 384 379 385 int memfile_open( 380 386 rtems_libio_t *iop, /* IN */ … … 383 389 unsigned32 mode /* IN */ 384 390 ); 391 385 392 int memfile_close( 386 393 rtems_libio_t *iop /* IN */ 387 394 ); 395 388 396 int memfile_read( 389 397 rtems_libio_t *iop, /* IN */ … … 391 399 unsigned32 count /* IN */ 392 400 ); 401 393 402 int memfile_write( 394 403 rtems_libio_t *iop, /* IN */ … … 396 405 unsigned32 count /* IN */ 397 406 ); 407 398 408 int memfile_ioctl( 399 409 rtems_libio_t *iop, /* IN */ … … 401 411 void *buffer /* IN */ 402 412 ); 413 403 414 int memfile_lseek( 404 415 rtems_libio_t *iop, /* IN */ … … 406 417 int whence /* IN */ 407 418 ); 419 420 int memfile_rmnod( 421 rtems_filesystem_location_info_t *pathloc /* IN */ 422 ); 423 408 424 int device_open( 409 425 rtems_libio_t *iop, /* IN */ … … 412 428 unsigned32 mode /* IN */ 413 429 ); 430 414 431 int device_close( 415 432 rtems_libio_t *iop /* IN */ 416 433 ); 434 417 435 int device_read( 418 436 rtems_libio_t *iop, /* IN */ … … 420 438 unsigned32 count /* IN */ 421 439 ); 440 422 441 int device_write( 423 442 rtems_libio_t *iop, /* IN */ … … 425 444 unsigned32 count /* IN */ 426 445 ); 446 427 447 int device_ioctl( 428 448 rtems_libio_t *iop, /* IN */ … … 430 450 void *buffer /* IN */ 431 451 ); 452 432 453 int device_lseek( 433 454 rtems_libio_t *iop, /* IN */ … … 435 456 int whence /* IN */ 436 457 ); 458 459 int device_rmnod( 460 rtems_filesystem_location_info_t *pathloc /* IN */ 461 ); 462 437 463 int IMFS_utime( 438 464 rtems_filesystem_location_info_t *pathloc, /* IN */ … … 440 466 time_t modtime /* IN */ 441 467 ); 468 442 469 int IMFS_fchmod( 443 470 rtems_filesystem_location_info_t *loc, -
cpukit/libfs/src/imfs/imfs_directory.c
r317a5b5 rb568ccb 270 270 } 271 271 272 272 /* 273 * IMFS_dir_rmnod 274 * 275 * This routine is available from the optable to remove a node 276 * from the IMFS file system. 277 */ 278 279 int imfs_dir_rmnod( 280 rtems_filesystem_location_info_t *pathloc /* IN */ 281 ) 282 { 283 IMFS_jnode_t *the_jnode; 284 285 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 286 287 /* 288 * You cannot remove a node that still has children 289 */ 290 291 if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) ) 292 set_errno_and_return_minus_one( ENOTEMPTY ); 293 294 /* 295 * You cannot remove the file system root node. 296 */ 297 298 if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access ) 299 set_errno_and_return_minus_one( EBUSY ); 300 301 /* 302 * You cannot remove a mountpoint. 303 */ 304 305 if ( the_jnode->info.directory.mt_fs != NULL ) 306 set_errno_and_return_minus_one( EBUSY ); 307 308 /* 309 * Take the node out of the parent's chain that contains this node 310 */ 311 312 if ( the_jnode->Parent != NULL ) { 313 Chain_Extract( (Chain_Node *) the_jnode ); 314 the_jnode->Parent = NULL; 315 } 316 317 /* 318 * Decrement the link counter and see if we can free the space. 319 */ 320 321 the_jnode->st_nlink--; 322 IMFS_update_ctime( the_jnode ); 323 324 /* 325 * The file cannot be open and the link must be less than 1 to free. 326 */ 327 328 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 329 330 /* 331 * Is the rtems_filesystem_current is this node? 332 */ 333 334 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 335 rtems_filesystem_current.node_access = NULL; 336 337 /* 338 * Free memory associated with a memory file. 339 */ 340 341 free( the_jnode ); 342 } 343 344 return 0; 345 346 } 347 348 -
cpukit/libfs/src/imfs/imfs_handlers_device.c
r317a5b5 rb568ccb 35 35 NULL, /* fdatasync */ 36 36 NULL, /* fcntl */ 37 IMFS_rmnod37 device_rmnod 38 38 }; -
cpukit/libfs/src/imfs/imfs_handlers_directory.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 imfs_dir_rmnod 38 38 }; 39 39 -
cpukit/libfs/src/imfs/imfs_handlers_memfile.c
r317a5b5 rb568ccb 35 35 IMFS_fdatasync, 36 36 IMFS_fcntl, 37 IMFS_rmnod37 memfile_rmnod 38 38 }; -
cpukit/libfs/src/imfs/imfs_unlink.c
r317a5b5 rb568ccb 56 56 IMFS_update_ctime( node->info.hard_link.link_node ); 57 57 if ( node->info.hard_link.link_node->st_nlink < 1) { 58 result = IMFS_rmnod( &the_link );58 result = (*loc->handlers->rmnod)( &the_link ); 59 59 if ( result != 0 ) 60 60 return -1; … … 62 62 } 63 63 64 result = IMFS_rmnod( loc);64 result = (*loc->handlers->rmnod)( &the_link ); 65 65 66 66 return result; -
cpukit/libfs/src/imfs/memfile.c
r317a5b5 rb568ccb 29 29 30 30 #define MEMFILE_STATIC 31 32 /*33 * Set of operations handlers for operations on memfile entities.34 */35 36 rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {37 memfile_open,38 memfile_close,39 memfile_read,40 memfile_write,41 memfile_ioctl,42 memfile_lseek,43 IMFS_stat,44 IMFS_fchmod,45 memfile_ftruncate,46 NULL, /* fpathconf */47 NULL, /* fsync */48 IMFS_fdatasync,49 IMFS_fcntl50 };51 31 52 32 /* … … 1057 1037 } 1058 1038 1039 1040 /* 1041 * memfile_rmnod 1042 * 1043 * This routine is available from the optable to remove a node 1044 * from the IMFS file system. 1045 */ 1046 1047 int memfile_rmnod( 1048 rtems_filesystem_location_info_t *pathloc /* IN */ 1049 ) 1050 { 1051 IMFS_jnode_t *the_jnode; 1052 1053 the_jnode = (IMFS_jnode_t *) pathloc->node_access; 1054 1055 /* 1056 * Take the node out of the parent's chain that contains this node 1057 */ 1058 1059 if ( the_jnode->Parent != NULL ) { 1060 Chain_Extract( (Chain_Node *) the_jnode ); 1061 the_jnode->Parent = NULL; 1062 } 1063 1064 /* 1065 * Decrement the link counter and see if we can free the space. 1066 */ 1067 1068 the_jnode->st_nlink--; 1069 IMFS_update_ctime( the_jnode ); 1070 1071 /* 1072 * The file cannot be open and the link must be less than 1 to free. 1073 */ 1074 1075 if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) { 1076 1077 /* 1078 * Is the rtems_filesystem_current is this node? 1079 */ 1080 1081 if ( rtems_filesystem_current.node_access == pathloc->node_access ) 1082 rtems_filesystem_current.node_access = NULL; 1083 1084 /* 1085 * Free memory associated with a memory file. 1086 */ 1087 1088 IMFS_memfile_remove( the_jnode ); 1089 1090 free( the_jnode ); 1091 } 1092 1093 return 0; 1094 1095 } 1096 1097 -
cpukit/libfs/src/imfs/miniimfs_init.c
r317a5b5 rb568ccb 38 38 IMFS_node_type, 39 39 IMFS_mknod, 40 NULL, /* XXX IMFS_rmnod, */41 40 NULL, /* XXX IMFS_chown, */ 42 41 NULL, /* XXX IMFS_freenodinfo, */
Note: See TracChangeset
for help on using the changeset viewer.