]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/miscfs/linprocfs/linprocfs.h
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / sys / miscfs / linprocfs / linprocfs.h
1 /*
2  * Copyright (c) 1993 Jan-Simon Pendry
3  * Copyright (c) 1993
4  *      The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * Jan-Simon Pendry.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by the University of
20  *      California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *      @(#)procfs.h    8.9 (Berkeley) 5/14/95
38  *
39  * $FreeBSD$
40  */
41
42 /*
43  * The different types of node in a procfs filesystem
44  */
45 typedef enum {
46         Proot,          /* the filesystem root */
47         Pself,          /* symbolic link for curproc */
48         Pproc,          /* a process-specific sub-directory */
49         Pexe,           /* the executable file */
50         Pmem,           /* the process's memory image */
51         Pmeminfo,
52         Pcpuinfo
53 } pfstype;
54
55 /*
56  * control data for the proc file system.
57  */
58 struct pfsnode {
59         struct pfsnode  *pfs_next;      /* next on list */
60         struct vnode    *pfs_vnode;     /* vnode associated with this pfsnode */
61         pfstype         pfs_type;       /* type of procfs node */
62         pid_t           pfs_pid;        /* associated process */
63         u_short         pfs_mode;       /* mode bits for stat() */
64         u_long          pfs_flags;      /* open flags */
65         u_long          pfs_fileno;     /* unique file id */
66         pid_t           pfs_lockowner;  /* pfs lock owner */
67 };
68
69 #define PROCFS_NAMELEN  8       /* max length of a filename component */
70
71 /*
72  * Kernel stuff follows
73  */
74 #ifdef _KERNEL
75 #define CNEQ(cnp, s, len) \
76          ((cnp)->cn_namelen == (len) && \
77           (bcmp((s), (cnp)->cn_nameptr, (len)) == 0))
78
79 #define KMEM_GROUP 2
80
81 #define PROCFS_FILENO(pid, type) \
82         (((type) < Pproc) ? \
83                         ((type) + 2) : \
84                         ((((pid)+1) << 4) + ((int) (type))))
85
86 /*
87  * Convert between pfsnode vnode
88  */
89 #define VTOPFS(vp)      ((struct pfsnode *)(vp)->v_data)
90 #define PFSTOV(pfs)     ((pfs)->pfs_vnode)
91
92 typedef struct vfs_namemap vfs_namemap_t;
93 struct vfs_namemap {
94         const char *nm_name;
95         int nm_val;
96 };
97
98 int vfs_getuserstr __P((struct uio *, char *, int *));
99 vfs_namemap_t *vfs_findname __P((vfs_namemap_t *, char *, int));
100
101 /* <machine/reg.h> */
102 struct reg;
103 struct fpreg;
104 struct dbreg;
105
106 #define PFIND(pid) ((pid) ? pfind(pid) : &proc0)
107
108 void linprocfs_exit __P((struct proc *));
109 int linprocfs_freevp __P((struct vnode *));
110 int linprocfs_allocvp __P((struct mount *, struct vnode **, long, pfstype));
111 struct vnode *linprocfs_findtextvp __P((struct proc *));
112 int linprocfs_sstep __P((struct proc *));
113 void linprocfs_fix_sstep __P((struct proc *));
114 #if 0
115 int linprocfs_read_regs __P((struct proc *, struct reg *));
116 int linprocfs_write_regs __P((struct proc *, struct reg *));
117 int linprocfs_read_fpregs __P((struct proc *, struct fpreg *));
118 int linprocfs_write_fpregs __P((struct proc *, struct fpreg *));
119 int linprocfs_read_dbregs __P((struct proc *, struct dbreg *));
120 int linprocfs_write_dbregs __P((struct proc *, struct dbreg *));
121 #endif
122 int linprocfs_domeminfo __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
123 int linprocfs_docpuinfo __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio));
124
125 /* functions to check whether or not files should be displayed */
126 int linprocfs_validfile __P((struct proc *));
127
128 #define PROCFS_LOCKED   0x01
129 #define PROCFS_WANT     0x02
130
131 extern vop_t **linprocfs_vnodeop_p;
132
133 int     linprocfs_root __P((struct mount *, struct vnode **));
134 int     linprocfs_rw __P((struct vop_read_args *));
135 #endif /* _KERNEL */