blob: bcde1e656ebb19af334bd33ea5a9f37a7853a3ed [file] [log] [blame] [raw]
/*
* (c) 2002 Pawel Jakub Dawidek <nick@garage.freebsd.pl>
*
* $Id: sysctlfs.h,v 1.6 2002/12/24 07:20:16 jules Exp $
*
*/
#define MAXSYSCTLBUF 1024
/*
* The different types of node in a sysctlfs file system
*/
typedef enum {
Sroot, /* the filesystem root */
Snode, /* sysctl node */
Sctl /* sysctl (the last component) */
} scfstype;
/*
* control data for the sysctl file system.
*/
struct scfsnode {
struct scfsnode *scfs_next; /* next on list */
struct vnode *scfs_vnode; /* vnode associated with this scfsnode */
scfstype scfs_type; /* type of sysctlfs node */
struct sysctl_oid *scfs_oidp;
u_short scfs_mode; /* mode bits for stat() */
u_long scfs_flags; /* open flags */
u_long scfs_fileno; /* unique file id */
pid_t scfs_lockowner; /* scfs lock owner */
};
/*
* Kernel stuff follows
*/
#ifdef _KERNEL
/*
* Convert between scfsnode vnode
*/
#define VTOSCFS(vp) ((struct scfsnode *)(vp)->v_data)
#define SCFSTOV(scfs) ((scfs)->scfs_vnode)
int sysctlfs_freevp __P((struct vnode *));
int sysctlfs_allocvp __P((struct mount *, struct vnode **, struct sysctl_oid *, scfstype));
int sysctlfs_findparent __P((struct mount *, struct sysctl_oid *, struct sysctl_oid **));
#define SYSCTLFS_LOCKED 0x01
#define SYSCTLFS_WANT 0x02
#if __FreeBSD_version < 600007
extern vop_t **sysctlfs_vnodeop_p;
#else
extern struct vop_vector sysctlfs_vnodeops;
#endif
#if __FreeBSD_version < 502123
int sysctlfs_root __P((struct mount *, struct vnode **));
#elif __FreeBSD_version < 600023
int sysctlfs_root __P((struct mount *, struct vnode **, struct thread *));
#elif __FreeBSD_version < 800087
int sysctlfs_root __P((struct mount *, int, struct vnode **, struct thread *));
#else
int sysctlfs_root __P((struct mount *, int, struct vnode **));
#endif
int sysctlfs_read __P((struct vop_read_args *));
int sysctlfs_write __P((struct vop_write_args *));
#if __FreeBSD_version < 500028
int sysctlfs_sysctl(struct proc *, struct sysctl_oid *, void *, size_t *,
void *, size_t, size_t *);
int sysctlfs_getval(struct proc *, struct sysctl_oid *, char **, size_t *);
int sysctlfs_putval(struct proc *, struct sysctl_oid *, char *, size_t);
#else
int sysctlfs_sysctl(struct thread *, struct sysctl_oid *, void *, size_t *,
void *, size_t, size_t *);
int sysctlfs_getval(struct thread *, struct sysctl_oid *, char **, size_t *);
int sysctlfs_putval(struct thread *, struct sysctl_oid *, char *, size_t);
#endif
#endif /* _KERNEL */