md.c (8198a1a472b2490191328afb4edd8476387ff102) md.c (7c89f162bcb645d2fdb234883fb689ed896077a2)
1/*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 826 unchanged lines hidden (view full) ---

835{
836 struct md_s *sc;
837 struct vattr vattr;
838 struct nameidata nd;
839 int error, flags;
840
841 flags = FREAD|FWRITE;
842 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td);
1/*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 826 unchanged lines hidden (view full) ---

835{
836 struct md_s *sc;
837 struct vattr vattr;
838 struct nameidata nd;
839 int error, flags;
840
841 flags = FREAD|FWRITE;
842 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td);
843 error = vn_open(&nd, &flags, 0);
843 error = vn_open(&nd, &flags, 0, -1);
844 if (error) {
845 if (error != EACCES && error != EPERM && error != EROFS)
846 return (error);
847 flags &= ~FWRITE;
848 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td);
844 if (error) {
845 if (error != EACCES && error != EPERM && error != EROFS)
846 return (error);
847 flags &= ~FWRITE;
848 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td);
849 error = vn_open(&nd, &flags, 0);
849 error = vn_open(&nd, &flags, 0, -1);
850 if (error)
851 return (error);
852 }
853 NDFREE(&nd, NDF_ONLY_PNBUF);
854 if (nd.ni_vp->v_type != VREG ||
855 (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) {
856 VOP_UNLOCK(nd.ni_vp, 0, td);
857 (void) vn_close(nd.ni_vp, flags, td->td_ucred, td);

--- 350 unchanged lines hidden ---
850 if (error)
851 return (error);
852 }
853 NDFREE(&nd, NDF_ONLY_PNBUF);
854 if (nd.ni_vp->v_type != VREG ||
855 (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) {
856 VOP_UNLOCK(nd.ni_vp, 0, td);
857 (void) vn_close(nd.ni_vp, flags, td->td_ucred, td);

--- 350 unchanged lines hidden ---