summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-21 12:24:38 +0000
committerphk <phk@FreeBSD.org>2004-10-21 12:24:38 +0000
commitbf9ec64a278a98452ef62a270da61ccbf05ba7b6 (patch)
tree01dd0c773570be1a39c8ce3d7c930a19ae65997e /sys
parent2f6f05bb4c4c6f270388a0b2286f9b636422adfc (diff)
downloadFreeBSD-src-bf9ec64a278a98452ef62a270da61ccbf05ba7b6.zip
FreeBSD-src-bf9ec64a278a98452ef62a270da61ccbf05ba7b6.tar.gz
Add new function ttyinitmode() which sets our systemwide default
modes on a tty structure. Both the ".init" and the current settings are initialized allowing the function to be used both at attach and open time. The function takes an argument to decide if echoing should be enabled by default. Echoing should not be enabled for regular physical serial ports unless they are consoles, in which case they should be configured by ttyconsolemode() instead. Use the new function throughout.
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/bufobj.h74
-rw-r--r--sys/sys/vnode.h22
2 files changed, 89 insertions, 7 deletions
diff --git a/sys/sys/bufobj.h b/sys/sys/bufobj.h
new file mode 100644
index 0000000..b930176
--- /dev/null
+++ b/sys/sys/bufobj.h
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2004 Poul-Henning Kamp
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Architectural notes:
+ *
+ * bufobj is a new object which is what buffers hang from in the buffer
+ * cache.
+ *
+ * This used to be vnodes, but we need non-vnode code to be able
+ * to use the buffer cache as well, specifically geom classes like gbde,
+ * raid3 and raid5.
+ *
+ * All vnodes will contain a bufobj initially, but down the road we may
+ * want to only allocate bufobjs when they are needed. There could be a
+ * large number of vnodes in the system which wouldn't need a bufobj during
+ * their lifetime.
+ *
+ * The exact relationship to the vmobject is not determined at this point,
+ * it may in fact bee that we find them to be two sides of the same object
+ * once things starts to crystalize.
+ */
+
+#ifndef _SYS_BUFOBJ_H_
+#define _SYS_BUFOBJ_H_
+
+#if defined(_KERNEL) || defined(_KVM_VNODE)
+
+#include <sys/queue.h>
+
+TAILQ_HEAD(buflists, buf);
+
+/* A Buffer splay list */
+struct bufv {
+ struct buflists bv_hd; /* Sorted blocklist */
+ struct buf *bv_root; /* Buf splay tree */
+ int bv_cnt; /* Number of buffers */
+};
+
+struct bufobj {
+ struct mtx *bo_mtx; /* Mutex which protects "i" things */
+ struct bufv bo_clean; /* i Clean buffers */
+ struct bufv bo_dirty; /* i Dirty buffers */
+};
+
+#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */
+#endif /* _SYS_BUFOBJ_H_ */
+
+
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 51f0581..f909d0d 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -39,6 +39,7 @@
*/
#include <sys/lockmgr.h>
+#include <sys/bufobj.h>
#include <sys/queue.h>
#include <sys/_lock.h>
#include <sys/lock.h>
@@ -64,7 +65,6 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
* Each underlying filesystem allocates its own private area and hangs
* it from v_data. If non-null, this area is freed in getnewvnode().
*/
-TAILQ_HEAD(buflists, buf);
typedef int vop_t(void *);
struct namecache;
@@ -104,6 +104,8 @@ struct vpollinfo {
* locked consistently. This is a work in progress. Requires Giant!
*/
+#if defined(_KERNEL) || defined(_KVM_VNODE)
+
struct vnode {
struct mtx v_interlock; /* lock for "i" things */
u_long v_iflag; /* i vnode flags (see below) */
@@ -111,12 +113,7 @@ struct vnode {
long v_numoutput; /* i writes in progress */
struct thread *v_vxthread; /* i thread owning VXLOCK */
int v_holdcnt; /* i page & buffer references */
- struct buflists v_cleanblkhd; /* i SORTED clean blocklist */
- struct buf *v_cleanblkroot; /* i clean buf splay tree */
- int v_cleanbufcnt; /* i number of clean buffers */
- struct buflists v_dirtyblkhd; /* i SORTED dirty blocklist */
- struct buf *v_dirtyblkroot; /* i dirty buf splay tree */
- int v_dirtybufcnt; /* i number of dirty buffers */
+ struct bufobj v_bufobj; /* * Buffer cache object */
u_long v_vflag; /* v vnode flags */
int v_writecount; /* v ref count of writers */
struct vm_object *v_object; /* v Place to store VM object */
@@ -158,12 +155,23 @@ struct vnode {
ino_t v_cachedid; /* cached file id */
int v_bsize; /* block size for I/O */
};
+
+#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */
+
#define v_mountedhere v_un.vu_mountedhere
#define v_socket v_un.vu_socket
#define v_rdev v_un.vu_spec.vu_cdev
#define v_specnext v_un.vu_spec.vu_specnext
#define v_fifoinfo v_un.vu_fifoinfo
+/* XXX: These are temporary to avoid a source sweep at this time */
+#define v_cleanblkhd v_bufobj.bo_clean.bv_hd
+#define v_cleanblkroot v_bufobj.bo_clean.bv_root
+#define v_cleanbufcnt v_bufobj.bo_clean.bv_cnt
+#define v_dirtyblkhd v_bufobj.bo_dirty.bv_hd
+#define v_dirtyblkroot v_bufobj.bo_dirty.bv_root
+#define v_dirtybufcnt v_bufobj.bo_dirty.bv_cnt
+
/*
* Userland version of struct vnode, for sysctl.
*/
OpenPOWER on IntegriCloud