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

📄 gnbd_kern.h

📁 openGFS , a kind of file system.
💻 H
字号:
/* * *    Copyright 1999 Regents of the University of Minnesota *    Portions Copyright 1999-2001 Sistina Software, Inc. *    Portions Copyright 2001 The OpenGFS Project * *    This is free software released under the GNU General Public License. *    There is no warranty for this software.  See the file COPYING for *    details. * *    See the file AUTHORS for a list of contributors. * */#ifndef _GNBD_GNBD_KERN_H#define _GNBD_GNBD_KERN_Hstruct request_queue;/* * The piece of the pending message queue that is used to match received * replies with the request that generated them. */typedef struct sdQ {	theader_t hdr;		/* we this for any possible resends */	struct request *req;	/* request this cam from */	struct sdQ *next;} transferQ_t;/* * This structure defines the, umm, shape of this device.  We'll have one * of these for each device that can exist. * * ok, here I'll try to describe the possible states that each device in * the gnbd can be in. * OPEN or CLOSED  *    Open is usage != 0, otherwise Closed. * PENDING or CLEAR *    If Rhead == NULL then Clear, otherwise Pending. * CONNECTED or DISCONNECTED *    Connected if the socket is connected. Otherwise disconnected. *    Also, in the disconnected state, the transiod thread should be *    distroyed. That way it can be recreated on connect again. *    If recvd_run is false, this is Disconnected. *  * If ISgnbdDisConnected, all new reads and writes will immeaditily * block. (unless opened nonblocking then returns EAGAIN). This stops the * generation of new io requests. Since when that thread is dead, we cannot * process IO. And we'd flood the request queues if we didn't block things * off at the read&write commands. Hence the wait queue, gassed. */#define ISgnbdOpened(x)		((x)->usage != 0)#define ISgnbdConnected(x)	((x)->recvd_run != 0)#define ISgnbdDisConnected(x)	(!ISgnbdConnected(x))#define ISgnbdPending(x)	((x)->Rhead != NULL)typedef struct gnbd_s {	u64 size;	int usage;	int readonly:1;	int recvd_run:1;	int good_connect:1;	u32 servip;	u16 servport;	wait_queue_head_t gassed;	struct socket *sock;	struct semaphore sender;	struct semaphore tiodmux;	struct semaphore tqmux;	transferQ_t *Rhead;} gnbd_t;extern int gnbd_major;extern void my_end_request(struct request *req);extern void gnbd_request(struct request_queue *q);extern int trans_start_up(gnbd_t * tio);extern void trans_shutdown(gnbd_t * tio, int complete);extern void cmd_RW(gnbd_t * tio, struct request *req, u32 len, u64 offset);#endif /* _GNBD_GNBD_KERN_H */

⌨️ 快捷键说明

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