⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stream.h

📁 VRTX 商用嵌入式实时操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
 *
 * Only present for non-EFT systems (SPG A-5)
 */
struct equeue {
	struct queue *eq_link;	/* to next queue for scheduling */
	struct qband *eq_bandp;	/* separate flow information */
	unsigned char	eq_nband;	/* number of priority bands > 0 */
};

#define q_link		q_eq->eq_link
#define q_bandp		q_eq->eq_bandp
#define q_nband		q_eq->eq_nband

#endif	/*_STYPES */


/*******************************************************************************
 * (SPG A-2)
 */
struct queue {
	struct qinit	*q_qinfo;	/* procedures and limits for queue */
	struct msgb	*q_first;	/* head of message queue for this queue */
	struct msgb	*q_last;	/* tail of message queue for this queue */
	struct queue	*q_next;	/* next queue in Stream */

#ifdef _STYPES

	struct equeue *q_eq;	/* pointer to an extended queue structure */
	void *q_ptr;		/* to private data structure */
	ushort		q_count;	/* number of bytes in queue */
	ushort		q_flag;		/* queue state */
	short		q_minpsz;	/* min packet size accepted by this module */
	short		q_maxpsz;	/* max packet size accepted by this module */
	ushort		q_hiwat;	/* queue high water mark for flow control */
	ushort		q_lowat;	/* queue low water mark for flow control */

#else	/* large definition */

	struct queue *q_link;	/* to next queue for scheduling */
	void *q_ptr;		/* to private data structure */
	ulong		q_count;	/* number of bytes in queue */
	ulong		q_flag;		/* queue state */
	long		q_minpsz;	/* min packet size accepted by this module */
	long		q_maxpsz;	/* max packet size accepted by this module */
	ulong		q_hiwat;	/* queue high water mark for flow control */
	ulong		q_lowat;	/* queue low water mark for flow control */
	struct qband *q_bandp;	/* separate flow information */
	unsigned char	q_nband;	/* number of priority bands */
	unsigned char	q_pad1[3];	/* reserved */
#ifdef FAKE_WSIZE
	long		q_pad2[1];	/* reserved */
#else
	long		q_pad2[2];	/* reserved */
#endif  /* FAKE_WSIZE */

#endif	/* _STYPES */

	unsigned int	q_wcount;	/* weighted byte cnt (SWK-specific) */
};

typedef struct queue queue_t;

/*******************************************************************************
 * (SPG A-3)
 */
struct qinit {
					/* put procedure */
	int (*qi_putp)(struct queue *, struct msgb *);
					/* service procedure */
	int (*qi_srvp)(struct queue *);
					/* called on each open or a push */
	int (*qi_qopen)();
					/* called on last close or a pop */
	int (*qi_qclose)();
					/* reserved */
	int (*qi_qadmin)();
	struct module_info *qi_minfo;	/* information structure */
	struct module_stat *qi_mstat;	/* statistics structure - optional */
};

/*
 * values for queue state (q_flag)
 */
#define QENAB	0x0001	/* enabled to run the service procedure */
#define QWANTR	0x0002	/* someone wants to read from the queue */
#define QWANTW	0x0004	/* someone wants to write to the queue */
#define QFULL	0x0008	/* queue is full */
#define QREADR	0x0010	/* set for read queues */
#define QUSE	0x0020	/* queue has been allocated */
#define QNOENB	0x0040	/* do not enable queue when data are placed on it */
#define QBACK	0x0080	/* queue has been back-enabled */
#define QOLD	0x0100	/* old open/close driver/module interface */
#define QHLIST	0x0200	/* the Stream head write queue is scanned */


/*******************************************************************************
 * (SPG A-9)
 */
struct iocblk {
	int		ioc_cmd;	/* ioctl command type */

#ifdef _STYPES

	o_uid_t		ioc_uid;	/* effective uid of user */
	o_gid_t		ioc_gid;	/* effective gid of user */
	uint		ioc_id;		/* ioctl id */
	uint		ioc_count;	/* count of bytes in data field */
	int		ioc_error;	/* error code */
	int		ioc_rval;	/* return value */
#else	/* large definition */

#define ioc_uid	ioc_cr->cr_uid
#define ioc_gid ioc_cr->cr_gid

	cred_t *ioc_cr;	/* full credentials */
	uint		ioc_id;		/* ioctl id */
	uint		ioc_count;	/* count of bytes in data field */
	int		ioc_error;	/* error code */
	int		ioc_rval;	/* return value */
	long		ioc_filler[4];	/* reserved for future use */

#endif	/* _STYPES */

};

/*******************************************************************************
 * (SPG A-10)
 */
struct copyreq {
	int		cq_cmd;		/* ioctl command (from ioc_cmd) */

#ifdef _STYPES

	o_uid_t		cq_uid;		/* effective uid of user */
	o_gid_t		cq_gid;		/* effective gid of user */
	uint		cq_id;		/* ioctl id (from ioc_id) */
	caddr_t		cq_addr;	/* address to copy data to/from */
	uint		cq_size;	/* number of bytes to copy */
	int		cq_flag;	/* see below */
	mblk_t *cq_private;	/* private state information */

#else	/* large definition */

#define cq_uid	cq_cr->cr_uid
#define cq_qid	cq_cr->cr_qid

	cred_t *cq_cr;		/* full credentials */
	uint		cq_id;		/* ioctl id (from ioc_id) */
	caddr_t		cq_addr;	/* address to copy data to/from */
	uint		cq_size;	/* number of bytes to copy */
	int		cq_flag;	/* see below */
	mblk_t *cq_private;	/* private state information */
	long		cq_filler[4];	/* reserved */

#endif	/* _STYPES */

};

/*
 * cq_flag values
 */
#define STRCANON	0x01	/* b_cont data block contains canonical */
				/*  format specifier */
#define RECOPY		0x02	/* perform I_STR copyin again this time using */
				/*  canonical format specifier */

/*******************************************************************************
 * (SPG A-11)
 */
struct copyresp {
	int		cp_cmd;		/* ioctl command (from ioc_cmd) */

#ifdef _STYPES

	o_uid_t		cp_uid;		/* effective uid of user */
	o_gid_t		cp_gid;		/* effective gid of user */
	uint		cp_id;		/* ioctl id (from ioc_id) */
	caddr_t		cp_rval;	/* status of request: 0 for success */
					/*  non-zero for failure */
	uint		cp_pad1;	/* reserved */
	int		cp_pad2;	/* reserved */
	mblk_t *cp_private;	/* private state information */

#else	/* large definition */

#define cp_uid	cp_cr->cr_uid
#define cp_gid	cp_cr->cr_gid

	cred_t *cp_cr;		/* full credentials */
	uint		cp_id;		/* ioctl id (from ioc_id) */
	caddr_t		cp_rval;	/* status of request: 0 for success */
					/*  non-zero for failure */
	uint		cp_pad1;	/* reserved */
	int		cp_pad2;	/* reserved */
	mblk_t *cp_private;	/* private state information */
	long		cp_filler[4];	/* reserved */

#endif	/* _STYPES */

};


/*******************************************************************************
 * This is used in lower multiplexor drivers to indicate al link (SPG A-12)
 */
struct linkblk {
	queue_t	*l_qtop;	/* lowest level write queue of upper Stream. */
					/*  Set to Null for persistent links */
	queue_t	*l_qbot;	/* highest level write queue of lower Stream */
	int		l_index;	/* system-unique index for lower Stream */

#ifndef _STYPES
	long		l_pad[5];	/* reserved */
#endif	/* _STYPES */

};

/*******************************************************************************
 * (SPG A-13)
 */
struct stroptions {

#ifdef _STYPES

	short		so_flags;	/* options to set */
	short		so_readopt;	/* read option */
	ushort		so_wroff;	/* write offset */
	short		so_minpsz;	/* minimum read packet size */
	short		so_maxpsz;	/* maximum read packet size */
	ushort		so_hiwat;	/* read queue high water mark */
	ushort		so_lowat;	/* read queue low water mark */

#else	/* large definition */

	ulong		so_flags;	/* options to set */
	short		so_readopt;	/* read option */
	ushort		so_wroff;	/* write offset */
	long		so_minpsz;	/* minimum read packet size */
	long		so_maxpsz;	/* maximum read packet size */
	ulong		so_hiwat;	/* read queue high water mark */
	ulong		so_lowat;	/* read queue low water mark */

#endif	/* _STYPES */

	unsigned char	so_band;	/* band for water marks */
};

/*
 * flags for Stream options set message (M_SETOPTS)
 */

#define SO_ALL		0x003f		/* set all options */
#define SO_READOPT	0x0001		/* set read option */
#define SO_WROFF	0x0002		/* set write offset */
#define SO_MINPSZ	0x0004		/* set minimum packet size */
#define SO_MAXPSZ	0x0008		/* set maximum packet size */
#define SO_HIWAT	0x0010		/* set high water mark */
#define SO_LOWAT	0x0020		/* set low water mark */
#define SO_MREADON	0x0040		/* set read notification on */
#define SO_MREADOFF	0x0080		/* set read notification off */
#define SO_NDELON	0x0100		/* old TTY semantics for NDELAY reads/writes */
#define SO_NDELOFF	0x0200		/* STREAMS semantics for NDELAY reads/writes */
#define SO_ISTTY	0x0400		/* Stream is acting as a terminal */
#define SO_ISNTTY	0x0800		/* Stream is not acting as a terminal */
#define SO_TOSTOP	0x1000		/* stop on background writes to Stream */
#define SO_TONSTOP	0x2000		/* don't stop on background writes to Stream */
#define SO_BAND		0x4000		/* water marks that affect band */


/*******************************************************************************
 * values for "what" argument of strqget()/strqset() utilities (SPG C-19)
 * (SPG 5-17)
 */
typedef enum qfields {
	QHIWAT		= 0,	/* q_hiwat or qb_hiwat */
	QLOWAT		= 1,	/* q_lowat or qb_lowat */
	QMAXPSZ		= 2,	/* q_maxpsz */
	QMINPSZ		= 3,	/* q_minpsz */
	QCOUNT		= 4,	/* q_count or qb_count (READ ONLY) */
	QFIRST		= 5,	/* q_first or qb_first (READ ONLY) */
	QLAST		= 6,	/* q_last or qb_last (READ ONLY) */
	QFLAG		= 7,	/* q_flag or qb_flag (READ ONLY) */
	QBAD		= 8
} qfields_t;


/*******************************************************************************
 * misc. defines
 */
#define MODOPEN		1		/* module open */
#define CLONEOPEN	2		/* clone open */

#define FLUSHDATA	1		/* flag to flushq() */
#define FLUSHALL	2		/* flag to flushq() */

#define INFPSZ		(-1)		/* infinite packet size */

#define TRANSPARENT	(-1)		/* transparent ioctl command */

#ifdef KERNEL

#include "sys/poll.h"

/*******************************************************************************
 * Stream header
 */
struct stdata {
	dev_t		sd_dev;		/* major/minor dev number for stream */
	int		sd_rdopts;	/* Stream read mode (see I_SRDOPT) */
	int		sd_wropts;	/* Stream write mode (see I_SWROPT) */
	ushort		sd_wroff;	/* write offset */
	int		sd_oflag;	/* open flags */
	int		sd_state;	/* Stream head state (see below) */
	int		sd_rderrno;	/* read error number (M_ERROR) */
	int		sd_wrerrno;	/* write error number (M_ERROR) */
	long		sd_cltime;	/* close delay (milliseconds) */
	int		sd_refcount;	/* reference count */
	int		sd_pushcnt;	/* number of modules pushed */
	int		sd_events;	/* registered SIGPOLL events */
	pollevent_t	*sd_poll;	/* poll event to check for */
	struct streamtab *sd_strtab;	/* driver streamtab */
	queue_t		*sd_wrq;	/* Stream head write queue */
	queue_t		*sd_rdq;	/* Stream head read queue */
	struct stdata	*sd_stnext; /* list of active stream headers */
	struct stdata	*sd_mxctrl; /* link to controlled lower streams */
	struct stdata	*sd_mxlow;	/* list of lower streams */
	int		sd_mxindex;	/* mux id */
	mblk_t		*sd_reply;	/* M_IOCTL reply message */
};

typedef struct stdata stdata_t;

/*
 * values for Stream header state (sd_state)
 */
#define SD_IOCBUSY	0x0001		/* outstanding M_IOCTL message */
#define SD_IOCWANT	0x0002		/* second M_IOCTL message waiting */
#define SD_IOCTIMOUT	0x0004		/* M_IOCTL message timed out */
#define SD_LOWERSTREAM	0x0008		/* Linked below a multiplexer */
#define SD_PERSTLINK	0x0010		/* persistant link contolling stream */
#define SD_LOCKED	0x0020		/* stream header locked for open, close,
						push, pop, link, and unlink */
#define SD_WANTLOCK	0x0040		/* waiting for the lock */

#define SD_M_READ	0x0100		/* generate M_READ msgs for read(2) */
#define SD_ISTTY	0x0200		/* controlling terminal */
#define SD_TOSTOP	0x0400		/* stop on background writes */
#define SD_NDELON	0x0800		/* non-STREAMS tty semantics */
#define SD_HANGUP	0x1000		/* a M_HANGUP msg was received */
#define SD_RDERROR	0x2000		/* a M_ERROR msg was received (read) */
#define SD_WRERROR	0x4000		/* a M_ERROR msg was received (write) */
#define SD_ISPIPE	0x8000		/* pipe */


struct strevent {
	int		se_event;
};

typedef struct strevent strevent_t;

/*
 * The contents of the M_PASSFP message
 */
struct strpassfp {
	dev_t   dev;
	cred_t  cr;
};

/*
 * utility function prototypes
 */
#include "sys/utils.p"

#endif	/* KERNEL */

#ifdef __cplusplus
}
#endif

#endif	/* __STREAM_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -