#include <stddef.h>#include <sys/types.h>#include "netcdf.h"Include dependency graph for ncio.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | ncio |
Defines | |
| #define | OFF_NONE ((off_t)(-1)) |
| #define | RGN_NOLOCK 0x1 |
| #define | RGN_NOWAIT 0x2 |
| #define | RGN_WRITE 0x4 |
| #define | RGN_MODIFIED 0x8 |
| #define | NCIO_CONST const |
Typedefs | |
| typedef ncio | ncio |
| typedef int | ncio_relfunc (ncio *const nciop, off_t offset, int rflags) |
| typedef int | ncio_getfunc (ncio *const nciop, off_t offset, size_t extent, int rflags, void **const vpp) |
| typedef int | ncio_movefunc (ncio *const nciop, off_t to, off_t from, size_t nbytes, int rflags) |
| typedef int | ncio_syncfunc (ncio *const nciop) |
| typedef void | ncio_freefunc (void *const pvt) |
Functions | |
| int | ncio_create (const char *path, int ioflags, size_t initialsz, off_t igeto, size_t igetsz, size_t *sizehintp, ncio **nciopp, void **const igetvpp) |
| int | ncio_open (const char *path, int ioflags, off_t igeto, size_t igetsz, size_t *sizehintp, ncio **nciopp, void **const igetvpp) |
| int | ncio_close (ncio *nciop, int doUnlink) |
| int | ncio_filesize (ncio *nciop, off_t *filesizep) |
| int | ncio_pad_length (ncio *nciop, off_t length) |
|
|
|
|
|
Definition at line 19 of file ncio.h. Referenced by ncio_px_free(), ncio_px_get(), ncio_px_init(), ncio_px_sync(), ncio_spx_free(), ncio_spx_init(), ncio_spx_rel(), px_get(), px_pgin(), px_pgout(), and rel_v1hs(). |
|
|
|
Definition at line 25 of file ncio.h. Referenced by ncio_px_move(), and ncio_spx_move(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 1681 of file posixio.c. References ENOERR, ncio::fd, ncio_free(), ncio::path, and ncio::sync. Referenced by nc__create_mp(), nc__open_mp(), nc_abort(), nc_close(), and nc_delete_mp(). 01682 { 01683 int status = ENOERR; 01684 01685 if(nciop == NULL) 01686 return EINVAL; 01687 01688 status = nciop->sync(nciop); 01689 01690 (void) close(nciop->fd); 01691 01692 if(doUnlink) 01693 (void) unlink(nciop->path); 01694 01695 ncio_free(nciop); 01696 01697 return status; 01698 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 1417 of file posixio.c. References blksize(), ENOERR, ncio::fd, fgrow(), fIsSet, fSet, ncio::get, ncio::ioflags, M_RNDUP, NC_DEFAULT_CREAT_MODE, NC_NOCLOBBER, NC_SHARE, NC_WRITE, ncio_free(), NCIO_MAXBLOCKSIZE, ncio_new(), ncio_px_init2(), ncio_spx_init2(), and RGN_WRITE. Referenced by nc__create_mp(). 01421 { 01422 ncio *nciop; 01423 int oflags = (O_RDWR|O_CREAT); 01424 int fd; 01425 int status; 01426 01427 if(initialsz < (size_t)igeto + igetsz) 01428 initialsz = (size_t)igeto + igetsz; 01429 01430 fSet(ioflags, NC_WRITE); 01431 01432 if(path == NULL || *path == 0) 01433 return EINVAL; 01434 01435 nciop = ncio_new(path, ioflags); 01436 if(nciop == NULL) 01437 return ENOMEM; 01438 01439 if(fIsSet(ioflags, NC_NOCLOBBER)) 01440 fSet(oflags, O_EXCL); 01441 else 01442 fSet(oflags, O_TRUNC); 01443 #ifdef O_BINARY 01444 fSet(oflags, O_BINARY); 01445 #endif 01446 #ifdef vms 01447 fd = open(path, oflags, NC_DEFAULT_CREAT_MODE, "ctx=stm"); 01448 #else 01449 /* Should we mess with the mode based on NC_SHARE ?? */ 01450 fd = open(path, oflags, NC_DEFAULT_CREAT_MODE); 01451 #endif 01452 #if 0 01453 (void) fprintf(stderr, "ncio_create(): path=\"%s\"\n", path); 01454 (void) fprintf(stderr, "ncio_create(): oflags=0x%x\n", oflags); 01455 #endif 01456 if(fd < 0) 01457 { 01458 status = errno; 01459 goto unwind_new; 01460 } 01461 *((int *)&nciop->fd) = fd; /* cast away const */ 01462 01463 if(*sizehintp < NCIO_MINBLOCKSIZE || *sizehintp > NCIO_MAXBLOCKSIZE) 01464 { 01465 /* Use default */ 01466 *sizehintp = blksize(fd); 01467 } 01468 else 01469 { 01470 *sizehintp = M_RNDUP(*sizehintp); 01471 } 01472 01473 if(fIsSet(nciop->ioflags, NC_SHARE)) 01474 status = ncio_spx_init2(nciop, sizehintp); 01475 else 01476 status = ncio_px_init2(nciop, sizehintp, 1); 01477 01478 if(status != ENOERR) 01479 goto unwind_open; 01480 01481 if(initialsz != 0) 01482 { 01483 status = fgrow(fd, (off_t)initialsz); 01484 if(status != ENOERR) 01485 goto unwind_open; 01486 } 01487 01488 if(igetsz != 0) 01489 { 01490 status = nciop->get(nciop, 01491 igeto, igetsz, 01492 RGN_WRITE, 01493 igetvpp); 01494 if(status != ENOERR) 01495 goto unwind_open; 01496 } 01497 01498 *nciopp = nciop; 01499 return ENOERR; 01500 01501 unwind_open: 01502 (void) close(fd); 01503 /* ?? unlink */ 01504 /*FALLTHRU*/ 01505 unwind_new: 01506 ncio_free(nciop); 01507 return status; 01508 }
|
|
||||||||||||
|
Definition at line 1630 of file posixio.c. References ENOERR, and ncio::fd. Referenced by nc_close(), and nc_get_NC(). 01631 { 01632 struct stat sb; 01633 01634 assert(nciop != NULL); 01635 if (fstat(nciop->fd, &sb) < 0) 01636 return errno; 01637 *filesizep = sb.st_size; 01638 return ENOERR; 01639 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 1555 of file posixio.c. References blksize(), ENOERR, ncio::fd, fIsSet, fSet, ncio::get, ncio::ioflags, M_RNDUP, NC_SHARE, NC_WRITE, ncio_free(), NCIO_MAXBLOCKSIZE, ncio_new(), ncio_px_init2(), and ncio_spx_init2(). Referenced by nc__open_mp(), and nc_delete_mp(). 01559 { 01560 ncio *nciop; 01561 int oflags = fIsSet(ioflags, NC_WRITE) ? O_RDWR : O_RDONLY; 01562 int fd; 01563 int status; 01564 01565 if(path == NULL || *path == 0) 01566 return EINVAL; 01567 01568 nciop = ncio_new(path, ioflags); 01569 if(nciop == NULL) 01570 return ENOMEM; 01571 01572 #ifdef O_BINARY 01573 fSet(oflags, O_BINARY); 01574 #endif 01575 #ifdef vms 01576 fd = open(path, oflags, 0, "ctx=stm"); 01577 #else 01578 fd = open(path, oflags, 0); 01579 #endif 01580 if(fd < 0) 01581 { 01582 status = errno; 01583 goto unwind_new; 01584 } 01585 *((int *)&nciop->fd) = fd; /* cast away const */ 01586 01587 if(*sizehintp < NCIO_MINBLOCKSIZE || *sizehintp > NCIO_MAXBLOCKSIZE) 01588 { 01589 /* Use default */ 01590 *sizehintp = blksize(fd); 01591 } 01592 else 01593 { 01594 *sizehintp = M_RNDUP(*sizehintp); 01595 } 01596 01597 if(fIsSet(nciop->ioflags, NC_SHARE)) 01598 status = ncio_spx_init2(nciop, sizehintp); 01599 else 01600 status = ncio_px_init2(nciop, sizehintp, 0); 01601 01602 if(status != ENOERR) 01603 goto unwind_open; 01604 01605 if(igetsz != 0) 01606 { 01607 status = nciop->get(nciop, 01608 igeto, igetsz, 01609 0, 01610 igetvpp); 01611 if(status != ENOERR) 01612 goto unwind_open; 01613 } 01614 01615 *nciopp = nciop; 01616 return ENOERR; 01617 01618 unwind_open: 01619 (void) close(fd); 01620 /*FALLTHRU*/ 01621 unwind_new: 01622 ncio_free(nciop); 01623 return status; 01624 }
|
|
||||||||||||
|
Definition at line 1649 of file posixio.c. References ENOERR, ncio::fd, fgrow2(), fIsSet, ncio::ioflags, NC_NOERR, NC_WRITE, and ncio::sync. Referenced by nc_close(). 01650 { 01651 int status = ENOERR; 01652 01653 if(nciop == NULL) 01654 return EINVAL; 01655 01656 if(!fIsSet(nciop->ioflags, NC_WRITE)) 01657 return EPERM; /* attempt to write readonly file */ 01658 01659 status = nciop->sync(nciop); 01660 if(status != ENOERR) 01661 return status; 01662 01663 status = fgrow2(nciop->fd, length); 01664 if(status != NC_NOERR) 01665 return status; 01666 return ENOERR; 01667 }
|
1.4.4