Creates a new file.
int vnop_create_attr (dvp, vpp, flags, name, vap, vcf, finfop, crp) struct vnode *dvp; struct vnode *vpp; int flags; char *name; struct vattr *vap; int vcf; caddr_t finfop; struct ucred *crp;
| Item | Description |
|---|---|
| dvp | Points to the directory vnode. |
| vpp | Points to the newly created vnode pointer. |
| flags | Specifies file creation flags. |
| name | Specifies the name of the file to create. |
| vattr | Points to the initial attributes. |
| vcf | Specifies create flags. |
| finfop | Specifies address of finfo field. |
| crp | Specifies user's credentials. |
The vnop_create_attr entry point is used to create a new file. This operation is similar to the vnop_create entry point except that the initial file attributes are passed in a vattr structure.
The va_mask field in the vattr structure identifies which attributes are to be applied. For example, if the AT_SIZE bit is set, then the file system should use va_size for the initial file size. For all vnop_create_attr calls, at least AT_TYPE and AT_MODE must be set.
The vcf parameter controls how the new vnode is to be activated. If vcf is set to VC_OPEN, then the new object should be opened. If vcf is VC_LOOKUP, then the new object should be created, but not opened. If vcf is VC_DEFAULT, then the new object should be created, but the vnode for the object is not activated.
File systems that do not define GFS_VERSION421 in their gfs flags do not need to supply a vnop_create_attr entry point. The logical file system will funnel all creation requests through the old vnop_create entry point.
The vnop_create_attr entry point can be called from the process environment only.
| Item | Description |
|---|---|
| Zero | Indicates a successful operation; *vpp contains a pointer to the new vnode. |
| Nonzero | Indicates that the operation failed; return values should be chosen from the /usr/include/sys/errno.h file. |