Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs Merge (effectively) -r1.78 of ufs_extern.h: shif...
details: https://anonhg.NetBSD.org/src/rev/136a58703258
branches: trunk
changeset: 346019:136a58703258
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Jun 20 02:31:47 2016 +0000
description:
Merge (effectively) -r1.78 of ufs_extern.h: shift ulfs_makeinode to
lfs_vnops.c and make it file-static there, as that's the only place
it's used.
diffstat:
sys/ufs/lfs/lfs_vnops.c | 78 +++++++++++++++++++++++++++++++++++++++++++++-
sys/ufs/lfs/ulfs_extern.h | 7 +---
sys/ufs/lfs/ulfs_vnops.c | 73 +------------------------------------------
3 files changed, 80 insertions(+), 78 deletions(-)
diffs (225 lines):
diff -r 57838dbeb498 -r 136a58703258 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c Mon Jun 20 02:25:03 2016 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c Mon Jun 20 02:31:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.298 2016/06/20 02:25:03 dholland Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.299 2016/06/20 02:31:47 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.298 2016/06/20 02:25:03 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.299 2016/06/20 02:31:47 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -178,6 +178,10 @@
static int lfs_listextattr(void *v);
static int lfs_deleteextattr(void *v);
+static int ulfs_makeinode(struct vattr *vap, struct vnode *,
+ const struct ulfs_lookup_results *,
+ struct vnode **, struct componentname *);
+
/* Global vfs data structures for lfs. */
int (**lfs_vnodeop_p)(void *);
const struct vnodeopv_entry_desc lfs_vnodeop_entries[] = {
@@ -352,6 +356,75 @@
#undef LFS_READWRITE
/*
+ * Allocate a new inode.
+ */
+static int
+ulfs_makeinode(struct vattr *vap, struct vnode *dvp,
+ const struct ulfs_lookup_results *ulr,
+ struct vnode **vpp, struct componentname *cnp)
+{
+ struct inode *ip;
+ struct vnode *tvp;
+ int error;
+
+ error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, &tvp);
+ if (error)
+ return error;
+ error = vn_lock(tvp, LK_EXCLUSIVE);
+ if (error) {
+ vrele(tvp);
+ return error;
+ }
+ lfs_mark_vnode(tvp);
+ *vpp = tvp;
+ ip = VTOI(tvp);
+ ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
+ ip->i_nlink = 1;
+ DIP_ASSIGN(ip, nlink, 1);
+
+ /* Authorize setting SGID if needed. */
+ if (ip->i_mode & ISGID) {
+ error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_WRITE_SECURITY,
+ tvp, NULL, genfs_can_chmod(tvp->v_type, cnp->cn_cred, ip->i_uid,
+ ip->i_gid, MAKEIMODE(vap->va_type, vap->va_mode)));
+ if (error) {
+ ip->i_mode &= ~ISGID;
+ DIP_ASSIGN(ip, mode, ip->i_mode);
+ }
+ }
+
+ if (cnp->cn_flags & ISWHITEOUT) {
+ ip->i_flags |= UF_OPAQUE;
+ DIP_ASSIGN(ip, flags, ip->i_flags);
+ }
+
+ /*
+ * Make sure inode goes to disk before directory entry.
+ */
+ if ((error = lfs_update(tvp, NULL, NULL, UPDATE_DIROP)) != 0)
+ goto bad;
+ error = ulfs_direnter(dvp, ulr, tvp,
+ cnp, ip->i_number, LFS_IFTODT(ip->i_mode), NULL);
+ if (error)
+ goto bad;
+ *vpp = tvp;
+ return (0);
+
+ bad:
+ /*
+ * Write error occurred trying to update the inode
+ * or the directory so must deallocate the inode.
+ */
+ ip->i_nlink = 0;
+ DIP_ASSIGN(ip, nlink, 0);
+ ip->i_flag |= IN_CHANGE;
+ /* If IN_ADIROP, account for it */
+ lfs_unmark_vnode(tvp);
+ vput(tvp);
+ return (error);
+}
+
+/*
* Synch an open file.
*/
/* ARGSUSED */
@@ -2297,3 +2370,4 @@
/* XXX Not implemented for ULFS2 file systems. */
return (EOPNOTSUPP);
}
+
diff -r 57838dbeb498 -r 136a58703258 sys/ufs/lfs/ulfs_extern.h
--- a/sys/ufs/lfs/ulfs_extern.h Mon Jun 20 02:25:03 2016 +0000
+++ b/sys/ufs/lfs/ulfs_extern.h Mon Jun 20 02:31:47 2016 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: ulfs_extern.h,v 1.22 2016/06/20 02:25:03 dholland Exp $ */
-/* from NetBSD: ufs_extern.h,v 1.77 2014/10/29 01:13:28 christos Exp */
+/* $NetBSD: ulfs_extern.h,v 1.23 2016/06/20 02:31:47 dholland Exp $ */
+/* from NetBSD: ufs_extern.h,v 1.78 2015/03/17 09:39:29 hannken Exp */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -154,9 +154,6 @@
/* ulfs_vnops.c */
void ulfs_vinit(struct mount *, int (**)(void *),
int (**)(void *), struct vnode **);
-int ulfs_makeinode(struct vattr *vap, struct vnode *,
- const struct ulfs_lookup_results *,
- struct vnode **, struct componentname *);
int ulfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
void ulfs_gop_markupdate(struct vnode *, int);
int ulfs_bufio(enum uio_rw, struct vnode *, void *, size_t, off_t, int,
diff -r 57838dbeb498 -r 136a58703258 sys/ufs/lfs/ulfs_vnops.c
--- a/sys/ufs/lfs/ulfs_vnops.c Mon Jun 20 02:25:03 2016 +0000
+++ b/sys/ufs/lfs/ulfs_vnops.c Mon Jun 20 02:31:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulfs_vnops.c,v 1.41 2016/06/20 02:25:03 dholland Exp $ */
+/* $NetBSD: ulfs_vnops.c,v 1.42 2016/06/20 02:31:47 dholland Exp $ */
/* from NetBSD: ufs_vnops.c,v 1.224 2014/10/29 01:13:28 christos Exp */
/*-
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.41 2016/06/20 02:25:03 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.42 2016/06/20 02:31:47 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@@ -1159,75 +1159,6 @@
}
/*
- * Allocate a new inode.
- */
-int
-ulfs_makeinode(struct vattr *vap, struct vnode *dvp,
- const struct ulfs_lookup_results *ulr,
- struct vnode **vpp, struct componentname *cnp)
-{
- struct inode *ip;
- struct vnode *tvp;
- int error;
-
- error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, &tvp);
- if (error)
- return error;
- error = vn_lock(tvp, LK_EXCLUSIVE);
- if (error) {
- vrele(tvp);
- return error;
- }
- lfs_mark_vnode(tvp);
- *vpp = tvp;
- ip = VTOI(tvp);
- ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
- ip->i_nlink = 1;
- DIP_ASSIGN(ip, nlink, 1);
-
- /* Authorize setting SGID if needed. */
- if (ip->i_mode & ISGID) {
- error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_WRITE_SECURITY,
- tvp, NULL, genfs_can_chmod(tvp->v_type, cnp->cn_cred, ip->i_uid,
- ip->i_gid, MAKEIMODE(vap->va_type, vap->va_mode)));
- if (error) {
- ip->i_mode &= ~ISGID;
- DIP_ASSIGN(ip, mode, ip->i_mode);
- }
- }
-
- if (cnp->cn_flags & ISWHITEOUT) {
- ip->i_flags |= UF_OPAQUE;
- DIP_ASSIGN(ip, flags, ip->i_flags);
- }
-
- /*
- * Make sure inode goes to disk before directory entry.
- */
- if ((error = lfs_update(tvp, NULL, NULL, UPDATE_DIROP)) != 0)
- goto bad;
- error = ulfs_direnter(dvp, ulr, tvp,
- cnp, ip->i_number, LFS_IFTODT(ip->i_mode), NULL);
- if (error)
- goto bad;
- *vpp = tvp;
- return (0);
-
- bad:
- /*
- * Write error occurred trying to update the inode
- * or the directory so must deallocate the inode.
- */
- ip->i_nlink = 0;
- DIP_ASSIGN(ip, nlink, 0);
- ip->i_flag |= IN_CHANGE;
- /* If IN_ADIROP, account for it */
- lfs_unmark_vnode(tvp);
- vput(tvp);
- return (error);
-}
-
-/*
* Allocate len bytes at offset off.
*/
int
Home |
Main Index |
Thread Index |
Old Index