Make vop_symlink take a const target path.
This will enable callers to take const paths as part of syscall decleration improvements. Where doing so is easy and non-distruptive carry the const through implementations. In UFS the value is passed to an interface that must take non-const values. In ZFS, const poisoning would touch code shared with upstream and it's not worth adding diffs. Bump __FreeBSD_version for external API consumers. Reviewed by: kib (prior version) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17805
This commit is contained in:
parent
be81239ddc
commit
1493c2ee62
@ -28,7 +28,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd July 24, 1996
|
.Dd November 2, 2018
|
||||||
.Dt VOP_CREATE 9
|
.Dt VOP_CREATE 9
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -48,7 +48,7 @@
|
|||||||
.Ft int
|
.Ft int
|
||||||
.Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
|
.Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target"
|
.Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "const char *target"
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
These entry points create a new file, socket, fifo, device, directory or symlink
|
These entry points create a new file, socket, fifo, device, directory or symlink
|
||||||
in a given directory.
|
in a given directory.
|
||||||
|
@ -5314,7 +5314,7 @@ zfs_freebsd_symlink(ap)
|
|||||||
vattr_init_mask(vap);
|
vattr_init_mask(vap);
|
||||||
|
|
||||||
return (zfs_symlink(ap->a_dvp, ap->a_vpp, cnp->cn_nameptr, vap,
|
return (zfs_symlink(ap->a_dvp, ap->a_vpp, cnp->cn_nameptr, vap,
|
||||||
ap->a_target, cnp->cn_cred, cnp->cn_thread));
|
__DECONST(char *, ap->a_target), cnp->cn_cred, cnp->cn_thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1521,8 +1521,8 @@ ext2_symlink(struct vop_symlink_args *ap)
|
|||||||
ip->i_size = len;
|
ip->i_size = len;
|
||||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||||
} else
|
} else
|
||||||
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
|
error = vn_rdwr(UIO_WRITE, vp, __DECONST(void *, ap->a_target),
|
||||||
UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
len, (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
||||||
ap->a_cnp->cn_cred, NOCRED, NULL, NULL);
|
ap->a_cnp->cn_cred, NOCRED, NULL, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
vput(vp);
|
vput(vp);
|
||||||
|
@ -1708,7 +1708,7 @@ fuse_vnop_symlink(struct vop_symlink_args *ap)
|
|||||||
struct vnode *dvp = ap->a_dvp;
|
struct vnode *dvp = ap->a_dvp;
|
||||||
struct vnode **vpp = ap->a_vpp;
|
struct vnode **vpp = ap->a_vpp;
|
||||||
struct componentname *cnp = ap->a_cnp;
|
struct componentname *cnp = ap->a_cnp;
|
||||||
char *target = ap->a_target;
|
const char *target = ap->a_target;
|
||||||
|
|
||||||
struct fuse_dispatcher fdi;
|
struct fuse_dispatcher fdi;
|
||||||
|
|
||||||
|
@ -1939,8 +1939,8 @@ nandfs_symlink(struct vop_symlink_args *ap)
|
|||||||
|
|
||||||
|
|
||||||
len = strlen(ap->a_target);
|
len = strlen(ap->a_target);
|
||||||
error = vn_rdwr(UIO_WRITE, *vpp, ap->a_target, len, (off_t)0,
|
error = vn_rdwr(UIO_WRITE, *vpp, __DECONST(void *, ap->a_target),
|
||||||
UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
len, (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
||||||
cnp->cn_cred, NOCRED, NULL, NULL);
|
cnp->cn_cred, NOCRED, NULL, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
vput(*vpp);
|
vput(*vpp);
|
||||||
|
@ -474,7 +474,7 @@ int nfsrpc_rename(vnode_t, vnode_t, char *, int, vnode_t, vnode_t, char *, int,
|
|||||||
int nfsrpc_link(vnode_t, vnode_t, char *, int,
|
int nfsrpc_link(vnode_t, vnode_t, char *, int,
|
||||||
struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
|
struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
|
||||||
int *, int *, void *);
|
int *, int *, void *);
|
||||||
int nfsrpc_symlink(vnode_t, char *, int, char *, struct vattr *,
|
int nfsrpc_symlink(vnode_t, char *, int, const char *, struct vattr *,
|
||||||
struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
|
struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
|
||||||
struct nfsfh **, int *, int *, void *);
|
struct nfsfh **, int *, int *, void *);
|
||||||
int nfsrpc_mkdir(vnode_t, char *, int, struct vattr *,
|
int nfsrpc_mkdir(vnode_t, char *, int, struct vattr *,
|
||||||
|
@ -2627,7 +2627,7 @@ nfsmout:
|
|||||||
* nfs symbolic link create rpc
|
* nfs symbolic link create rpc
|
||||||
*/
|
*/
|
||||||
APPLESTATIC int
|
APPLESTATIC int
|
||||||
nfsrpc_symlink(vnode_t dvp, char *name, int namelen, char *target,
|
nfsrpc_symlink(vnode_t dvp, char *name, int namelen, const char *target,
|
||||||
struct vattr *vap, struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap,
|
struct vattr *vap, struct ucred *cred, NFSPROC_T *p, struct nfsvattr *dnap,
|
||||||
struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp,
|
struct nfsvattr *nnap, struct nfsfh **nfhpp, int *attrflagp,
|
||||||
int *dattrflagp, void *dstuff)
|
int *dattrflagp, void *dstuff)
|
||||||
|
@ -411,7 +411,7 @@ void tmpfs_ref_node(struct tmpfs_node *node);
|
|||||||
void tmpfs_ref_node_locked(struct tmpfs_node *node);
|
void tmpfs_ref_node_locked(struct tmpfs_node *node);
|
||||||
int tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *, enum vtype,
|
int tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *, enum vtype,
|
||||||
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *,
|
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *,
|
||||||
char *, dev_t, struct tmpfs_node **);
|
const char *, dev_t, struct tmpfs_node **);
|
||||||
void tmpfs_free_node(struct tmpfs_mount *, struct tmpfs_node *);
|
void tmpfs_free_node(struct tmpfs_mount *, struct tmpfs_node *);
|
||||||
bool tmpfs_free_node_locked(struct tmpfs_mount *, struct tmpfs_node *, bool);
|
bool tmpfs_free_node_locked(struct tmpfs_mount *, struct tmpfs_node *, bool);
|
||||||
void tmpfs_free_tmp(struct tmpfs_mount *);
|
void tmpfs_free_tmp(struct tmpfs_mount *);
|
||||||
@ -424,7 +424,7 @@ int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, int,
|
|||||||
struct vnode **);
|
struct vnode **);
|
||||||
void tmpfs_free_vp(struct vnode *);
|
void tmpfs_free_vp(struct vnode *);
|
||||||
int tmpfs_alloc_file(struct vnode *, struct vnode **, struct vattr *,
|
int tmpfs_alloc_file(struct vnode *, struct vnode **, struct vattr *,
|
||||||
struct componentname *, char *);
|
struct componentname *, const char *);
|
||||||
void tmpfs_check_mtime(struct vnode *);
|
void tmpfs_check_mtime(struct vnode *);
|
||||||
void tmpfs_dir_attach(struct vnode *, struct tmpfs_dirent *);
|
void tmpfs_dir_attach(struct vnode *, struct tmpfs_dirent *);
|
||||||
void tmpfs_dir_detach(struct vnode *, struct tmpfs_dirent *);
|
void tmpfs_dir_detach(struct vnode *, struct tmpfs_dirent *);
|
||||||
|
@ -182,7 +182,7 @@ tmpfs_ref_node_locked(struct tmpfs_node *node)
|
|||||||
int
|
int
|
||||||
tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
|
tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type,
|
||||||
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *parent,
|
uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *parent,
|
||||||
char *target, dev_t rdev, struct tmpfs_node **node)
|
const char *target, dev_t rdev, struct tmpfs_node **node)
|
||||||
{
|
{
|
||||||
struct tmpfs_node *nnode;
|
struct tmpfs_node *nnode;
|
||||||
vm_object_t obj;
|
vm_object_t obj;
|
||||||
@ -717,7 +717,7 @@ tmpfs_free_vp(struct vnode *vp)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap,
|
tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap,
|
||||||
struct componentname *cnp, char *target)
|
struct componentname *cnp, const char *target)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
struct tmpfs_dirent *de;
|
struct tmpfs_dirent *de;
|
||||||
|
@ -1176,7 +1176,7 @@ tmpfs_symlink(struct vop_symlink_args *v)
|
|||||||
struct vnode **vpp = v->a_vpp;
|
struct vnode **vpp = v->a_vpp;
|
||||||
struct componentname *cnp = v->a_cnp;
|
struct componentname *cnp = v->a_cnp;
|
||||||
struct vattr *vap = v->a_vap;
|
struct vattr *vap = v->a_vap;
|
||||||
char *target = v->a_target;
|
const char *target = v->a_target;
|
||||||
|
|
||||||
#ifdef notyet /* XXX FreeBSD BUG: kern_symlink is not setting VLNK */
|
#ifdef notyet /* XXX FreeBSD BUG: kern_symlink is not setting VLNK */
|
||||||
MPASS(vap->va_type == VLNK);
|
MPASS(vap->va_type == VLNK);
|
||||||
|
@ -325,7 +325,7 @@ vop_symlink {
|
|||||||
OUT struct vnode **vpp;
|
OUT struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
IN struct vattr *vap;
|
IN struct vattr *vap;
|
||||||
IN char *target;
|
IN const char *target;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
* in the range 5 to 9.
|
* in the range 5 to 9.
|
||||||
*/
|
*/
|
||||||
#undef __FreeBSD_version
|
#undef __FreeBSD_version
|
||||||
#define __FreeBSD_version 1300002 /* Master, propagated to newvers */
|
#define __FreeBSD_version 1300003 /* Master, propagated to newvers */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||||
|
@ -2095,7 +2095,7 @@ ufs_symlink(ap)
|
|||||||
struct vnode **a_vpp;
|
struct vnode **a_vpp;
|
||||||
struct componentname *a_cnp;
|
struct componentname *a_cnp;
|
||||||
struct vattr *a_vap;
|
struct vattr *a_vap;
|
||||||
char *a_target;
|
const char *a_target;
|
||||||
} */ *ap;
|
} */ *ap;
|
||||||
{
|
{
|
||||||
struct vnode *vp, **vpp = ap->a_vpp;
|
struct vnode *vp, **vpp = ap->a_vpp;
|
||||||
@ -2116,8 +2116,8 @@ ufs_symlink(ap)
|
|||||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||||
error = UFS_UPDATE(vp, 0);
|
error = UFS_UPDATE(vp, 0);
|
||||||
} else
|
} else
|
||||||
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
|
error = vn_rdwr(UIO_WRITE, vp, __DECONST(void *, ap->a_target),
|
||||||
UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
len, (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
||||||
ap->a_cnp->cn_cred, NOCRED, NULL, NULL);
|
ap->a_cnp->cn_cred, NOCRED, NULL, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
vput(vp);
|
vput(vp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user