PERFORCE change 41863 for review
Robert Watson
rwatson at FreeBSD.org
Mon Nov 10 04:09:44 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=41863
Change 41863 by rwatson at rwatson_paprika on 2003/11/09 20:09:09
Compress mac_get_fd() logic a bit: only need one switch
statement.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#426 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#426 (text+ko) ====
@@ -752,53 +752,34 @@
vp = fp->f_vnode;
intlabel = mac_vnode_label_alloc();
-
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
mac_copy_vnode_label(vp->v_label, intlabel);
VOP_UNLOCK(vp, 0, td);
-
+ error = mac_externalize_vnode_label(intlabel, elements,
+ buffer, mac.m_buflen);
+ mac_vnode_label_free(intlabel);
break;
case DTYPE_PIPE:
pipe = fp->f_data;
intlabel = mac_pipe_label_alloc();
-
PIPE_LOCK(pipe);
mac_copy_pipe_label(pipe->pipe_label, intlabel);
PIPE_UNLOCK(pipe);
- break;
- default:
- error = EINVAL;
- fdrop(fp, td);
- goto out;
- }
- fdrop(fp, td);
-
- switch (label_type) {
- case DTYPE_FIFO:
- case DTYPE_VNODE:
- if (error == 0)
- error = mac_externalize_vnode_label(intlabel,
- elements, buffer, mac.m_buflen);
- mac_vnode_label_free(intlabel);
- break;
- case DTYPE_PIPE:
error = mac_externalize_pipe_label(intlabel, elements,
buffer, mac.m_buflen);
mac_pipe_label_free(intlabel);
break;
default:
- panic("__mac_get_fd: corrupted label_type");
+ error = EINVAL;
}
-
+ fdrop(fp, td);
if (error == 0)
error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
out:
mtx_unlock(&Giant); /* VFS */
free(buffer, M_MACTEMP);
free(elements, M_MACTEMP);
-
return (error);
}
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list