vnode.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _VNODE_H_
00014 #define _VNODE_H_
00015 
00016 #include <posix/sys/types.h>
00017 #include <posix/sys/uio.h>
00018 #include <posix/sys/queue.h>
00019 
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif 
00024  
00025 typedef uint32_t inode_t; // inode number
00026 typedef int32_t  lbno_t;  // logical block number in a file, may be negative for indirect blocks 
00027 typedef int32_t  bno_t;   // physical block number on disk/media 
00028 typedef uint16_t segno_t; // segment number
00029 
00030 /*
00031  * Structure used to pass around logical block paths generated by
00032  * ufs_getlbns and used by truncate and bmap code.
00033  */
00034 struct indir {
00035     bno_t in_lbn;       /* Logical block number. */
00036     int in_off;         /* Offset in buffer. */
00037     int in_exists;      /* Flag if the block exists. */
00038 };
00039 
00040 struct componentname;
00041 typedef int32_t doff_t;
00042 
00043 /*
00044  * This is defined here rather than in BufferCache.h so that the
00045  * forward references will resolve without forcing code that references vnodes
00046  * but not the buffer cache to have to include BufferCache.h
00047  */
00048 typedef struct BufferCacheEntryType {
00049     TAILQ_ENTRY(BufferCacheEntryType) b_freelist;  // link entry onto some list
00050                                                     // may or may not be free list
00051     int         b_freelistindex;  // Free list index. which queue buffer is on, if any
00052     struct VnodeType *b_vnode;  // associated vnode
00053     lbno_t     b_lbn;  // logical block number within the file
00054     bno_t      b_bno;  // physical block number being buffered
00055     void      *b_data;
00056     volatile uint32_t   b_flags;
00057     status_t   b_lastOpStatus;
00058     LIST_ENTRY(BufferCacheEntryType) b_vnodeLink; // entry is on a vnode's clean or dirty list
00059 } BufferCacheEntryType;
00060 
00061 // Free bufCache queues.  Newest entries added to the end so that head has
00062 // the oldest entries and is first to be replaced.
00063 // We use three queues like BSD:
00064 // BQ_LOCKED - buffers that are locked and cannot be replaced
00065 // BQ_LRU - LRU for regular buffers
00066 // BQ_AGE - LRU for unproven buffers, buffers which haven't proved to be useful
00067 //          or are known to be invalid.
00068 //          this queue is emptied before the LRU queue is used.
00069 // BQ_SHARED - valid buffers that are shared with the client.
00070 //             these buffers cannot be replaced
00071 #define NUM_BQUEUES 4
00072 #define BQ_LOCKED   0
00073 #define BQ_LRU      1
00074 #define BQ_AGE      2
00075 #define BQ_SHARED   3
00076 
00077 #define B_DATASIZE  4096        // regular data size is 4KB
00078 #define B_DATASIZE_512  512     // fs meta-data size uses 512 bytes
00079 /*
00080  * These flags are kept in b_flags.
00081  */
00082 #define B_AGE       0x00000001  /* Move to age queue when I/O done. */
00083 #define B_ASYNC     0x00000004  /* Start I/O, do not wait. */
00084 #define B_BAD       0x00000008  /* Bad block revectoring in progress. */
00085 #define B_BUSY      0x00000010  /* I/O in progress. */
00086 #define B_SCANNED   0x00000020  /* Block already pushed during sync */
00087 #define B_CALL      0x00000040  /* Call b_iodone from biodone. */
00088 #define B_DELWRI    0x00000080  /* Delay I/O until buffer reused. */
00089 #define B_DIRTY     0x00000100  /* Dirty page to be pushed out async. */
00090 #define B_DONE      0x00000200  /* I/O completed. */
00091 #define B_EINTR     0x00000400  /* I/O was interrupted */
00092 #define B_ERROR     0x00000800  /* I/O error occurred. */
00093 #define B_GATHERED  0x00001000  /* LFS: already in a segment. */
00094 #define B_INVAL     0x00002000  /* Does not contain valid info. */
00095 #define B_LOCKED    0x00004000  /* Locked in core (not reusable). */
00096 #define B_NOCACHE   0x00008000  /* Do not cache block after use. */
00097 #define B_CACHE     0x00020000  /* Bread found us in the cache. */
00098 #define B_PHYS      0x00040000  /* I/O to user memory. */
00099 #define B_RAW       0x00080000  /* Set by physio for raw transfers. */
00100 #define B_READ      0x00100000  /* Read buffer. */
00101 #define B_TAPE      0x00200000  /* Magnetic tape I/O. */
00102 #define B_WANTED    0x00800000  /* Process wants this buffer. */
00103 #define B_WRITE     0x01000000  /* Write buffer (pseudo flag). */
00104 #define B_DATA_512  0x02000000  /* data size is 512 bytes instead of regular 4KB */
00105 #define B_VFLUSH    0x04000000  /* Buffer is being synced. */
00106 
00107 #define B_PAGE_SHARED   0x08000000
00108 #define B_PAGE_WRITE    0x10000000  /* */
00109 #define B_DEFER_READ    0x20000000
00110 #define B_BNO_VALID     0x40000000
00111 #define B_PAGE_LOCKED   0x80000000
00112 
00113 
00114 
00115 typedef status_t op_read_vnode(void *mount, inode_t vnid, char r, struct VnodeType **node);
00116 typedef status_t op_write_vnode(struct VnodeType *vnodeP, char flags);
00117 typedef status_t op_remove_vnode(struct VnodeType *vnodeP, char r);
00118 typedef status_t op_secure_vnode(struct VnodeType *vnodeP);
00119 
00120 typedef status_t op_allocate_vnode(struct VnodeType *parentVnodeP, struct VnodeType **resultVnodePP);
00121 typedef status_t op_lookup(struct VnodeType *dirVnodeP, struct VnodeType **resultVnodePP, struct componentname *cnp);
00122 
00123 typedef status_t op_check_access(struct VnodeType *vnodeP, int mode, uint32_t callerUID);
00124 
00125 typedef status_t op_create(struct VnodeType *parentVnodeP, struct VnodeType **resultVnodePP, struct componentname *cnp);
00126 typedef status_t op_mkdir(struct VnodeType *parentDirVnodeP, struct VnodeType **newDirVnodePP, struct componentname *cnp);
00127 typedef status_t op_symlink(void *dir, const char *name, const char *path);
00128 typedef status_t op_link(void *dir, const char *name, struct VnodeType *vnodeP);
00129 
00130 typedef status_t op_rename(struct VnodeType *oldDirVnodeP, struct VnodeType *oldVnodeP, struct componentname *oldcnp,
00131                            struct VnodeType *newDirVnodeP, struct VnodeType *newVnodeP, struct componentname *newcnp);
00132 typedef status_t op_unlink(struct VnodeType *parentDirVnodeP, struct VnodeType *vnodeP, struct componentname *cnp);
00133 
00134 typedef status_t op_rmdir(struct VnodeType *parentDirVnodeP, struct VnodeType *vnodeP, struct componentname *cnp);
00135 
00136 typedef status_t op_readlink(struct VnodeType *vnodeP, char *buf, size_t *bufsize);
00137 
00138 typedef status_t op_opendir(struct VnodeType *vnodeP, void **cookie);
00139 typedef status_t op_closedir(struct VnodeType *vnodeP, void *cookie);
00140 typedef status_t op_rewinddir(struct VnodeType *vnodeP, void *cookie);
00141 struct DirEntry;
00142 typedef status_t op_readdir(struct VnodeType *vnodeP, void *cookie, long *num, struct DirEntry *buf, size_t bufsize);
00143 typedef status_t op_getbufferforoffset(struct VnodeType *vnodeP, off_t offset, BufferCacheEntryType **bufCachePP);
00144 typedef status_t op_bufferallocate(struct VnodeType *vnodeP, off_t offset, int32_t size, uint32_t flags, BufferCacheEntryType **bufCachePP);
00145 typedef status_t op_getphysicalblockaddr(struct VnodeType *vnodeP, lbno_t logicalBlockNum, bno_t *physicalBlockNumP, int *numP);
00146 
00147 typedef status_t op_open(struct VnodeType *vnodeP, int omode);
00148 typedef status_t op_close(struct VnodeType *vnodeP, void *cookie);
00149 typedef status_t op_free_cookie(struct VnodeType *vnodeP, void *cookie);
00150 typedef status_t op_read(struct VnodeType *vnodeP, off_t pos, uint8_t *buf, size_t *len);
00151 typedef status_t op_write(struct VnodeType *vnodeP, off_t pos, const uint8_t *buf, size_t *len);
00152 typedef status_t op_readv(struct VnodeType *vnodeP, void *cookie, off_t pos, const struct iovec *vec,
00153                           size_t count, size_t *len);
00154 typedef status_t op_writev(struct VnodeType *vnodeP, void *cookie, off_t pos, const struct iovec *vec,
00155                            size_t count, size_t *len);
00156 typedef status_t op_readbuffers(struct VnodeType *vnode, size_t count, BufferCacheEntryType **bufCacheP);
00157 typedef status_t op_writebuffers(struct VnodeType *vnode, size_t count, BufferCacheEntryType **bufCacheP);
00158 
00159 typedef status_t op_ioctl(struct VnodeType *vnodeP, void *cookie, int cmd, void *buf, size_t len);
00160 
00161 typedef status_t op_truncate(struct VnodeType *vnodeP, off_t endOffset, uint32_t flags);
00162 typedef status_t op_setflags(struct VnodeType *vnodeP, void *cookie, int flags);
00163 
00164 // used primarily to update time stamp and flags, with an option to
00165 // flush the changes to disk and to wait for the flush to complete
00166 typedef status_t op_update(struct VnodeType *vnodeP, time_t accessTime, time_t modifyTime, int flags);
00167 
00168 typedef status_t op_rstat(struct VnodeType *vnodeP, struct stat *);
00169 typedef status_t op_wstat(struct VnodeType *vnodeP, struct stat *, long mask);
00170 typedef status_t op_fsync(struct VnodeType *vnodeP);
00171 
00172 typedef status_t op_initialize(const char *devname, void *parms, size_t len);
00173 typedef status_t op_reclaim(struct VnodeType *vnodeP);
00174 typedef status_t op_mount(int /*nspace_id*/ nsid, const char *devname, ulong flags,
00175                           void *parms, size_t len, void **data, inode_t *vnid);
00176 typedef status_t op_unmount(struct VnodeType *vnodeP);
00177 typedef status_t op_sync(struct VnodeType *vnodeP);
00178 struct fs_info;
00179 typedef status_t op_rfsstat(struct VnodeType *vnodeP, struct fs_info *);
00180 typedef status_t op_wfsstat(struct VnodeType *vnodeP, struct fs_info *, long mask);
00181 
00182 typedef status_t op_write_attr(struct VnodeType *vnodeP, const char *name, int type,
00183                                const void *buf, size_t *len, off_t pos);
00184 typedef status_t op_read_attr(struct VnodeType *vnodeP, const char *name, int type,
00185                               void *buf, size_t *len, off_t pos);
00186 
00187 typedef void op_wake_vnode(struct VnodeType *vnodeP, void *cookie, uint pmcookietype);
00188 typedef void op_suspend_vnode(struct VnodeType *vnodeP, void *cookie, uint pmcookietype);
00189 
00190 typedef struct vnode_ops {
00191     op_read_vnode           (*read_vnode);
00192     op_write_vnode          (*write_vnode);
00193     op_remove_vnode         (*remove_vnode);
00194     op_secure_vnode         (*secure_vnode);
00195     op_allocate_vnode       (*allocate_vnode);
00196     op_lookup               (*lookup);
00197     op_check_access         (*check_access);
00198     op_create               (*create);
00199     op_mkdir                (*mkdir);
00200     op_symlink              (*symlink);
00201     op_link                 (*link);
00202     op_rename               (*rename);
00203     op_unlink               (*unlink);
00204     op_rmdir                (*rmdir);
00205     op_readlink             (*readlink);
00206     op_opendir              (*opendir);
00207     op_closedir             (*closedir);
00208     op_rewinddir            (*rewinddir);
00209     op_readdir              (*readdir);
00210     op_getbufferforoffset   (*getbufferforoffset);
00211     op_bufferallocate       (*bufferallocate);
00212     op_getphysicalblockaddr (*getphysicalblockaddr);
00213     op_open                 (*open);
00214     op_close                (*close);
00215     op_read                 (*read);
00216     op_write                (*write);
00217     op_readv                (*readv);
00218     op_writev               (*writev);
00219     op_readbuffers          (*readbuffers);
00220     op_writebuffers         (*writebuffers);
00221     op_ioctl                (*ioctl);
00222     op_truncate             (*truncate);
00223     op_setflags             (*setflags);
00224     op_update               (*update);
00225     op_rstat                (*rstat);
00226     op_wstat                (*wstat);
00227     op_fsync                (*fsync);
00228     op_initialize           (*initialize);
00229     op_reclaim              (*reclaim);
00230     op_mount                (*mount);
00231     op_unmount              (*unmount);
00232     op_sync                 (*sync);
00233     op_rfsstat              (*rfsstat);
00234     op_wfsstat              (*wfsstat);
00235     op_write_attr           (*write_attr);
00236     op_read_attr            (*read_attr);
00237     op_wake_vnode           (*wake_vnode);
00238     op_suspend_vnode        (*suspend_vnode);
00239 } vnode_ops;
00240 
00241 
00242 /*
00243  * Vnode types.  VNON means no type.
00244  */
00245 enum vtype  { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
00246 
00247 /*
00248  * Vnode tag types.
00249  * These are for the benefit of external programs only (e.g., pstat)
00250  * and should NEVER be inspected by the kernel.
00251  */
00252 enum vtagtype   {
00253     VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS, VT_FDESC,
00254     VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
00255     VT_UNION, VT_ADOSFS, VT_EXT2FS, VT_CODA, VT_FILECORE, VT_NTFS, VT_VFS,
00256     VT_OVERLAY, VT_SMBFS, VT_PTYFS
00257 };
00258 
00259 /*
00260  * Vnode flags.
00261  */
00262 #define VROOT       0x0001  /* root of its file system */
00263 #define VTEXT       0x0002  /* vnode is a pure text prototype */
00264     /* VSYSTEM only used to skip vflush()ing quota files */
00265 #define VSYSTEM     0x0004  /* vnode being used by kernel */
00266     /* VISTTY used when reading dead vnodes */
00267 #define VISTTY      0x0008  /* vnode represents a tty */
00268 #define VEXECMAP    0x0010  /* vnode has PROT_EXEC mappings */
00269 #define VLOCKSWORK  0x0080  /* FS supports locking discipline */
00270 #define VXLOCK      0x0100  /* vnode is locked to change underlying type */
00271 #define VXWANT      0x0200  /* process is waiting for vnode */
00272 #define VBWAIT      0x0400  /* waiting for output to complete */
00273 #define VALIASED    0x0800  /* vnode has an alias */
00274 #define VDIROP      0x1000  /* LFS: vnode is involved in a directory op */
00275 #define VLAYER      0x2000  /* vnode is on a layer filesystem */
00276 #define VONWORKLST  0x4000  /* On syncer work-list */
00277 #define VDIRTY      0x8000  /* vnode possibly has dirty pages */
00278 
00279 /*
00280  *  Modes.  Passed in VnodeOpCheckAccess
00281  */
00282 #define VREAD   00004       /* read, write, execute permissions */
00283 #define VWRITE  00002
00284 #define VEXEC   00001
00285 
00286 /*
00287  * Flags to various vnode operations.
00288  */
00289 #define REVOKEALL       0x0001      /* revoke: revoke all aliases */
00290 
00291 #define FSYNC_WAIT      0x0001      /* fsync: wait for completion */
00292 #define FSYNC_DATAONLY  0x0002      /* fsync: hint: sync file data only */
00293 #define FSYNC_RECLAIM   0x0004      /* fsync: hint: vnode is being reclaimed */
00294 #define FSYNC_LAZY      0x0008      /* fsync: lazy sync (trickle) */
00295 
00296 #define UPDATE_WAIT     0x0001      /* update: wait for completion */
00297 #define UPDATE_DIROP    0x0002      /* update: hint to fs to wait or not */
00298 #define UPDATE_CLOSE    0x0004      /* update: clean up on close */
00299 
00300 #define IO_UNIT         0x01        /* do I/O as atomic unit */
00301 #define IO_APPEND       0x02        /* append write to end */
00302 #define IO_SYNC         (0x04|IO_DSYNC) /* sync I/O file integrity completion */
00303 #define IO_NODELOCKED   0x08        /* underlying node already locked */
00304 #define IO_NDELAY       0x10        /* FNDELAY flag set in file table */
00305 #define IO_DSYNC        0x20        /* sync I/O data integrity completion */
00306 #define IO_ALTSEMANTICS 0x40        /* use alternate i/o semantics */
00307 
00308 // declares a struct type buflists
00309 LIST_HEAD(BufferCacheList, BufferCacheEntryType);
00310 
00311 typedef struct VnodeType {
00312     uint32_t   v_numBuffers; // number of buffers in the cleanList + dirtyList
00313     uint32_t   v_refCount;  // number of references to this vnode
00314     void      *v_mount;  // ptr to file system vnode belongs to
00315     struct BufferCacheList v_cleanListHead; // head of list of clean buffers that belong to this vnode
00316     struct BufferCacheList v_dirtyListHead; // head of list of dirty buffers that belong to this vnode
00317     LIST_ENTRY(VnodeType) v_dirtyList; // this field allows linking vnodes w/ dirty buffers
00318     LIST_ENTRY(VnodeType) v_mountList; // this field allows linking vnodes in a mount
00319     uint8_t    v_type; // vnode type, used internally by VFS filesystems
00320     uint8_t    v_tag;  // vnode tag type, used to report type externally
00321     uint16_t   v_flag; // flags
00322     union {                  /* made this a union to make it easier to debug,
00323                                 filesystems will use the InodeType field */
00324         void *data;
00325         struct InodeType *inodeP;
00326     } v_union;                // private data specific to filesystem
00327 
00328 #define v_data v_union.data
00329 #define v_inodeP v_union.inodeP
00330     const vnode_ops *v_op;   // pointer to filesystem specific operations vector
00331 } VnodeType;
00332 
00333 
00334 #include <support/errors.h>
00335 
00336 __inline status_t VnodeInvokeOpReadBuffers(VnodeType *vnode, size_t count, BufferCacheEntryType **bufCacheP)
00337 {
00338     // equivalent to BSD VOP_STRATEGY
00339     if (vnode->v_op->readbuffers) {
00340         return vnode->v_op->readbuffers(vnode, count, bufCacheP);
00341     }
00342     return B_UNSUPPORTED;
00343 }
00344 
00345 __inline status_t VnodeInvokeOpWriteBuffers(VnodeType *vnode, size_t count, BufferCacheEntryType **bufCacheP)
00346 {
00347     if (vnode->v_op->writebuffers) {
00348         return vnode->v_op->writebuffers(vnode, count, bufCacheP);
00349     }
00350     return B_UNSUPPORTED;
00351 }
00352 
00353 __inline status_t VnodeInvokeOpReclaim(VnodeType *vnode)
00354 {
00355     if (vnode->v_op->reclaim) {
00356         return vnode->v_op->reclaim(vnode);
00357     }
00358     return B_UNSUPPORTED;
00359 }
00360 
00361 __inline status_t VnodeInvokeOpLookup(VnodeType *dirVnodeP, VnodeType **resultVnodePP, struct componentname *cnp)
00362 {
00363     if (dirVnodeP->v_op->lookup) {
00364         return dirVnodeP->v_op->lookup(dirVnodeP, resultVnodePP, cnp);
00365     }
00366     return B_UNSUPPORTED;
00367 }
00368 
00369 __inline status_t VnodeInvokeOpGetBufferForOffset(VnodeType *dirVnodeP, off_t offset, BufferCacheEntryType **bufCachePP)
00370 {
00371     if (dirVnodeP->v_op->getbufferforoffset) {
00372         return dirVnodeP->v_op->getbufferforoffset(dirVnodeP, offset, bufCachePP);
00373     }
00374     return B_UNSUPPORTED;
00375 }
00376 
00377 __inline status_t VnodeInvokeOpBufferAllocate(VnodeType *vnodeP, off_t offset, int32_t size, uint32_t flags, BufferCacheEntryType **bufCachePP)
00378 {
00379     if (vnodeP->v_op->bufferallocate) {
00380         return vnodeP->v_op->bufferallocate(vnodeP, offset, size, flags, bufCachePP);
00381     }
00382     return B_UNSUPPORTED;
00383 }
00384 
00385 __inline status_t VnodeInvokeOpCreate(VnodeType *dirVnodeP, VnodeType **resultVnodePP, struct componentname *cnp)
00386 {
00387     if (dirVnodeP->v_op->create) {
00388         return dirVnodeP->v_op->create(dirVnodeP, resultVnodePP, cnp);
00389     }
00390     return B_UNSUPPORTED;
00391 }
00392 
00393 __inline status_t VnodeInvokeOpAllocateVnode(VnodeType *parentVnodeP, VnodeType **resultVnodePP)
00394 {
00395     if (parentVnodeP->v_op->allocate_vnode) {
00396         return parentVnodeP->v_op->allocate_vnode(parentVnodeP, resultVnodePP);
00397     }
00398     return B_UNSUPPORTED;
00399 }
00400 
00401 __inline status_t VnodeInvokeOpWriteVnode(VnodeType *vnodeP, char flags)
00402 {
00403     if (vnodeP->v_op->write_vnode) {
00404         return vnodeP->v_op->write_vnode(vnodeP, flags);
00405     }
00406     return B_UNSUPPORTED;
00407 }
00408 
00409 __inline status_t VnodeInvokeOpTruncate(VnodeType *vnodeP, off_t endOffset, uint32_t flags)
00410 {
00411     if (vnodeP->v_op->truncate) {
00412         return vnodeP->v_op->truncate(vnodeP, endOffset, flags);
00413     }
00414     return B_UNSUPPORTED;
00415 }
00416 
00417 __inline status_t VnodeInvokeOpOpenVnode(VnodeType *vnodeP, int omode)
00418 {
00419     if (vnodeP->v_op->open) {
00420         return vnodeP->v_op->open(vnodeP, omode);
00421     }
00422     return B_UNSUPPORTED;
00423 }
00424 
00425 __inline status_t VnodeInvokeOpMakeDirectory(VnodeType *parentDirVnodeP, VnodeType **newDirVnodePP, struct componentname *cnp)
00426 {
00427     if (parentDirVnodeP->v_op->mkdir) {
00428         return parentDirVnodeP->v_op->mkdir(parentDirVnodeP, newDirVnodePP, cnp);
00429     }
00430     return B_UNSUPPORTED;
00431 }
00432 
00433 __inline status_t VnodeInvokeOpGetPhysicalBlockAddress(VnodeType *vnodeP, lbno_t logicalBlockNum, bno_t *physicalBlockNumP, int *numP)
00434 {
00435     if (vnodeP->v_op->getphysicalblockaddr) {
00436         return vnodeP->v_op->getphysicalblockaddr(vnodeP, logicalBlockNum, physicalBlockNumP, numP);
00437     }
00438     return B_UNSUPPORTED;
00439 }
00440 
00441 __inline status_t VnodeInvokeOpWrite(VnodeType *vnodeP, off_t offset, const uint8_t *dataP, size_t *numBytesP)
00442 {
00443     if (vnodeP->v_op->write) {
00444         return vnodeP->v_op->write(vnodeP, offset, dataP, numBytesP);
00445     }
00446     return B_UNSUPPORTED;
00447 }
00448 
00449 __inline status_t VnodeInvokeOpRead(VnodeType *vnodeP, off_t offset, uint8_t *dataP, size_t *numBytesP)
00450 {
00451     if (vnodeP->v_op->read) {
00452         return vnodeP->v_op->read(vnodeP, offset, dataP, numBytesP);
00453     }
00454     return B_UNSUPPORTED;
00455 }
00456 
00457 __inline status_t VnodeInvokeOpUnlink(struct VnodeType *parentDirVnodeP, VnodeType *vnodeP, struct componentname *cnp)
00458 {
00459     if (vnodeP->v_op->unlink) {
00460         return vnodeP->v_op->unlink(parentDirVnodeP, vnodeP, cnp);
00461     }
00462     return B_UNSUPPORTED;
00463 }
00464 
00465 __inline status_t VnodeInvokeOpRmdir(struct VnodeType *parentDirVnodeP, VnodeType *vnodeP, struct componentname *cnp)
00466 {
00467     if (vnodeP->v_op->rmdir) {
00468         return vnodeP->v_op->rmdir(parentDirVnodeP, vnodeP, cnp);
00469     }
00470     return B_UNSUPPORTED;
00471 }
00472 
00473 __inline status_t VnodeInvokeOpRename(struct VnodeType *oldDirVnodeP, struct VnodeType *oldVnodeP, struct componentname *oldcnp, 
00474                                       struct VnodeType *newDirVnodeP, struct VnodeType *newVnodeP, struct componentname *newcnp)
00475 {
00476     if (oldDirVnodeP->v_op->rename) {
00477         return oldDirVnodeP->v_op->rename(oldDirVnodeP, oldVnodeP, oldcnp, newDirVnodeP, newVnodeP, newcnp);
00478     }
00479     return B_UNSUPPORTED;
00480 }
00481 
00482 __inline status_t VnodeInvokeOpCheckAccess(struct VnodeType *vnodeP, int mode, uint32_t callerID)
00483 {
00484     if (vnodeP->v_op->check_access) {
00485         return vnodeP->v_op->check_access(vnodeP, mode, callerID);
00486     }
00487     return B_UNSUPPORTED;
00488 }
00489 
00490 __inline status_t VnodeInvokeOpUpdate(struct VnodeType *vnodeP, time_t accessTime, time_t modifyTime, int flags)
00491 {
00492     if (vnodeP->v_op->update) {
00493         return vnodeP->v_op->update(vnodeP, accessTime, modifyTime, flags);
00494     }
00495     return B_UNSUPPORTED;
00496 }
00497 
00498 __inline void VnodeIncrementReference(VnodeType *vnode)
00499 {
00500     vnode->v_refCount++;
00501 }
00502 
00503 #if 0
00504 __inline status_t VnodeWriteBuffers(VnodeType *vnode, ssize_t count, BufferCacheEntryType **bufCacheP)
00505 {
00506     if (vnode->v_op->writebuffers) {
00507         return vnode->v_op->writebuffers(vnode, count, bufCacheP);
00508     }
00509     return B_UNSUPPORTED;
00510 }
00511 #endif
00512 
00513 
00514 #ifdef __cplusplus
00515 }
00516 #endif
00517   
00518 
00519 #endif /* #ifndef _VNODE_H_ */