MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vn_extattr_set

Function vn_extattr_set

freebsd/kern/vfs_vnops.c:2162–2199  ·  view source on GitHub ↗

* XXX failure mode if partially written? */

Source from the content-addressed store, hash-verified

2160 * XXX failure mode if partially written?
2161 */
2162int
2163vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace,
2164 const char *attrname, int buflen, char *buf, struct thread *td)
2165{
2166 struct uio auio;
2167 struct iovec iov;
2168 struct mount *mp;
2169 int error;
2170
2171 iov.iov_len = buflen;
2172 iov.iov_base = buf;
2173
2174 auio.uio_iov = &iov;
2175 auio.uio_iovcnt = 1;
2176 auio.uio_rw = UIO_WRITE;
2177 auio.uio_segflg = UIO_SYSSPACE;
2178 auio.uio_td = td;
2179 auio.uio_offset = 0;
2180 auio.uio_resid = buflen;
2181
2182 if ((ioflg & IO_NODELOCKED) == 0) {
2183 if ((error = vn_start_write(vp, &mp, V_WAIT)) != 0)
2184 return (error);
2185 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
2186 }
2187
2188 ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held");
2189
2190 /* authorize attribute setting as kernel */
2191 error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio, NULL, td);
2192
2193 if ((ioflg & IO_NODELOCKED) == 0) {
2194 vn_finished_write(mp);
2195 VOP_UNLOCK(vp);
2196 }
2197
2198 return (error);
2199}
2200
2201int
2202vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,

Calls 3

vn_start_writeFunction · 0.85
vn_lockFunction · 0.85
vn_finished_writeFunction · 0.85

Tested by

no test coverage detected