📄 head.h
字号:
int sd_pgrp; /* controlling process group id */ volatile long sd_flag; /* state/flags */ int sd_sigflags; /* logical OR of all siglist events */ int sd_events; /* logical OR of all eventlist events*/ int sd_rdopt; /* read options */ int sd_wropt; /* write options */ int sd_closetime; /* time to wait to drain q in close */ toid_t sd_close_timer; /* timer handle for close timer */ int sd_rerror; /* read error to set u.u_error */ int sd_werror; /* write error to set u.u_error */ int sd_maxpushcnt; /* currently there's no limit in * # of pushed mods, but let's set up * an artificial one to aid debugging*/ long sd_maxpsz; /* max pkt size --should be a cache*/ long sd_minpsz; /* min pkt size of below module's */ unsigned short sd_wroff; /* write offset for downstream data */ struct strevent *sd_siglist; /* processes to be sent SIGPOLL */#if defined(PORTABLE_POLL) struct pollhead sd_polllist; /* polling processes*/#elif defined(LINUX_POLL)# if defined(KERNEL_2_3) wait_queue_head_t sd_task_list;/* tasks waiting on poll */# else struct wait_queue *sd_task_list;/* tasks waiting on poll */# endif#else#error "Either PORTABLE_POLL or LINUX_POLL must be defined"#endif lis_semaphore_t sd_opening; /* stream is opening */ lis_semaphore_t sd_close_wt; /* Waiting for close to complete*/ lis_semaphore_t sd_wwrite; /* wait to room for write */ lis_semaphore_t sd_write_sem;/* single thread semaphore */ lis_semaphore_t sd_wread; /* wait for msg to arrive */ lis_semaphore_t sd_read_sem; /* single thread semaphore */ lis_semaphore_t sd_wioc; /* wait for ioctl */ lis_semaphore_t sd_wiocing; /* wait for iocl response */ lis_semaphore_t sd_closing; /* waiting to close */ lis_atomic_t sd_refcnt; /* reference count */ lis_atomic_t sd_opencnt; /* # of files open to this stream */ unsigned short sd_linkcnt; /* # of I_PLINKs done via stream */ unsigned short sd_pushcnt; /* number of pushes done on stream */ unsigned short sd_rfdcnt; /* number of M_PASSFP's queued */ struct stmux sd_mux; /* info for muxing streams */ int sd_l_index; /* muxid cntr for stream head */ dev_t sd_dev ; /* major/minor from inode */#ifdef PORTABLE_POLL lis_select_t sd_select ; /* abstract select structure */ /* see *-mdep.h */#endif lis_atomic_t sd_rdcnt ; /* # users sleeping on read */ lis_atomic_t sd_rdsemcnt ;/* # users sleeping on read_sem */ lis_atomic_t sd_wrcnt ; /* # users sleeping on write */ lis_spin_lock_t sd_lock ; /* get exclusive use of strm head */ struct queue *sd_rq ; /* RD(sd_wq) */ unsigned long sd_save_sigs[8] ; /* opaque mem area */ char sd_name[32] ; /* name of stream */ lis_kcreds_t sd_kcreds ; /* creds of stream opener */ cred_t sd_creds ; /* portable form of creds */ void *sd_mount ; /* mount point (only for sd_from) */ lis_atomic_t sd_fattachcnt; /* number of fattaches */} stdata_t;#define LIS_SD_REFCNT(hd) lis_atomic_read(&(hd)->sd_refcnt)#define LIS_SD_OPENCNT(hd) lis_atomic_read(&(hd)->sd_opencnt)#define SET_SD_FLAG(hd,msk) \ do { \ lis_flags_t psw; \ lis_spin_lock_irqsave(&(hd)->sd_lock,&psw) ; \ (hd)->sd_flag |= (msk) ; \ lis_spin_unlock_irqrestore(&(hd)->sd_lock,&psw) ; \ } \ while (0)#define CLR_SD_FLAG(hd,msk) \ do { \ lis_flags_t psw; \ lis_spin_lock_irqsave(&(hd)->sd_lock,&psw) ; \ (hd)->sd_flag &= ~(msk) ; \ lis_spin_unlock_irqrestore(&(hd)->sd_lock,&psw) ; \ } \ while (0)extern stdata_t *lis_stdata_head ; /* to list of stdatas */extern lis_atomic_t lis_stdata_cnt;extern lis_semaphore_t lis_stdata_sem; /* for stdata list locking */extern lis_atomic_t lis_open_cnt;extern lis_atomic_t lis_close_cnt;extern lis_atomic_t lis_inode_cnt;extern lis_atomic_t lis_mnt_cnt;extern void lis_task_to_creds(lis_kcreds_t *cp) ;extern void lis_creds_to_task(lis_kcreds_t *cp) ;#if defined(CONFIG_DEV)extern stdata_t *lis_head_get_fcn(stdata_t *hd, const char *file, int line);extern stdata_t *lis_head_put_fcn(stdata_t *hd, const char *file, int line);#define lis_head_get(hd) lis_head_get_fcn(hd, __LIS_FILE__, __LINE__)#define lis_head_put(hd) lis_head_put_fcn(hd, __LIS_FILE__, __LINE__)#elseextern stdata_t *lis_head_get_fcn(stdata_t *hd);extern stdata_t *lis_head_put_fcn(stdata_t *hd);#define lis_head_get(hd) lis_head_get_fcn(hd)#define lis_head_put(hd) lis_head_put_fcn(hd)#endif#endif /* __KERNEL__ *//* ------------------------------------------------------------------- *//* Glob. Vars. *//* Scheduling & scan list */#ifdef __KERNEL__extern volatile queue_t *lis_qhead; /* first scheduled queue */extern volatile queue_t *lis_qtail; /* last scheduled queue */extern volatile queue_t *lis_scanqhead; /* head of STREAMS scan q */extern volatile queue_t *lis_scanqtail; /* tail of STREAMS scan q */extern char lis_qrunflag; /*set if there is at least one enabled queue*/extern char lis_queueflag; /*the function queuerun is running *//* cfg. opts. */extern int lis_nstrpush; /* maximum # of pushed modules */extern int lis_strhold; /* if not zero str hold feature's activated*/extern unsigned long lis_strthresh; /* configurable STREAMS memory limit */extern unsigned int lis_iocseq; /* ioctl id */#endif /* __KERNEL__ *//* ------------------------------------------------------------------- *//* Exported functions & macros *//* The streams file ops * these are the entry points into the LiS subsystem. * in response to a system call the Linux kernel will dispatch to * one of these entries. * -- see "The design of the unix operating system" (Bach) */#ifdef __KERNEL__extern int lis_stropen( struct inode *, struct file *);extern int lis_strioctl(struct inode *, struct file *, unsigned int, unsigned long);extern int lis_strputpmsg(struct inode *, struct file *, void *, void *, int, int);extern int lis_strgetpmsg(struct inode *, struct file *, void *, void *, int *,int *,int);extern int lis_strpoll(struct inode *i, struct file *f, void *ptr) ;extern int lis_strclose(struct inode *i, struct file *f);extern ssize_t lis_strwrite(struct file *, const char *, size_t, loff_t *);extern ssize_t lis_strread(struct file *, char *, size_t, loff_t *);/* Initialize some glob vars... */extern voidlis_init_head(void);extern voidlis_terminate_head(void);/* * Run the STREAMS queues */extern void lis_run_queues(int cpu);/* * for stream head qinit structures */extern intlis_strrput(queue_t *, mblk_t *);extern intlis_strwsrv(queue_t *);extern intlis_strrsrv(queue_t *);/* * I_SENFD/I_RECVFD ioctl support */extern int lis_sendfd(stdata_t *, unsigned int, struct file *);extern int lis_recvfd(stdata_t *, strrecvfd_t *, struct file *);extern void lis_free_passfp(mblk_t *);/* * these are needed by or associated with fdetach() */extern stdata_t *lookup_stdata(dev_t *, struct inode *, stdata_t *);extern int lis_doclose(struct inode *, struct file *f, stdata_t *, cred_t *);extern void lis_fdetach_stream(stdata_t *);/* * streamtabs needed internally */extern struct streamtab fifo_info;extern struct streamtab clone_info;/* * Routines to save and restore signal masks. Actual routines are * located in the mdep.c files for the target platform. */extern void lis_clear_and_save_sigs(stdata_t *hd);extern void lis_restore_sigs(stdata_t *hd);/* * Return the major device number of the LiS clone device. Useful for * dynamically loading drivers to synthesis clone major/minors. */extern int lis_clone_major(void) ;#endif /* __KERNEL__ *//* * timing functions - these are available outside the kernel also */extern unsigned long lis_hitime(void); /* usec res; 64s cycle */extern unsigned long lis_usecs(void); /* usec res; ulong cycle */extern unsigned long lis_msecs(void); /* msec res; ulong cycle */extern unsigned long lis_dsecs(void); /* 1/10sec res; ulong cycle */extern unsigned long lis_secs(void); /* sec res; ulong cycle *//* ------------------------------------------------------------------- */#endif /*!_HEAD_H*//*----------------------------------------------------------------------# Local Variables: ***# change-log-default-name: "~/src/prj/streams/src/NOTES" ***# End: *** ----------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -