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

📄 internal.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* internal AFS stuff * * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */#include <linux/compiler.h>#include <linux/kernel.h>#include <linux/fs.h>#include <linux/pagemap.h>#include <linux/skbuff.h>#include <linux/rxrpc.h>#include <linux/key.h>#include <linux/workqueue.h>#include <linux/sched.h>#include "afs.h"#include "afs_vl.h"#define AFS_CELL_MAX_ADDRS 15struct pagevec;struct afs_call;typedef enum {	AFS_VL_NEW,			/* new, uninitialised record */	AFS_VL_CREATING,		/* creating record */	AFS_VL_VALID,			/* record is pending */	AFS_VL_NO_VOLUME,		/* no such volume available */	AFS_VL_UPDATING,		/* update in progress */	AFS_VL_VOLUME_DELETED,		/* volume was deleted */	AFS_VL_UNCERTAIN,		/* uncertain state (update failed) */} __attribute__((packed)) afs_vlocation_state_t;struct afs_mount_params {	bool			rwpath;		/* T if the parent should be considered R/W */	bool			force;		/* T to force cell type */	afs_voltype_t		type;		/* type of volume requested */	int			volnamesz;	/* size of volume name */	const char		*volname;	/* name of volume to mount */	struct afs_cell		*cell;		/* cell in which to find volume */	struct afs_volume	*volume;	/* volume record */	struct key		*key;		/* key to use for secure mounting */};/* * definition of how to wait for the completion of an operation */struct afs_wait_mode {	/* RxRPC received message notification */	void (*rx_wakeup)(struct afs_call *call);	/* synchronous call waiter and call dispatched notification */	int (*wait)(struct afs_call *call);	/* asynchronous call completion */	void (*async_complete)(void *reply, int error);};extern const struct afs_wait_mode afs_sync_call;extern const struct afs_wait_mode afs_async_call;/* * a record of an in-progress RxRPC call */struct afs_call {	const struct afs_call_type *type;	/* type of call */	const struct afs_wait_mode *wait_mode;	/* completion wait mode */	wait_queue_head_t	waitq;		/* processes awaiting completion */	struct work_struct	async_work;	/* asynchronous work processor */	struct work_struct	work;		/* actual work processor */	struct sk_buff_head	rx_queue;	/* received packets */	struct rxrpc_call	*rxcall;	/* RxRPC call handle */	struct key		*key;		/* security for this call */	struct afs_server	*server;	/* server affected by incoming CM call */	void			*request;	/* request data (first part) */	struct address_space	*mapping;	/* page set */	struct afs_writeback	*wb;		/* writeback being performed */	void			*buffer;	/* reply receive buffer */	void			*reply;		/* reply buffer (first part) */	void			*reply2;	/* reply buffer (second part) */	void			*reply3;	/* reply buffer (third part) */	void			*reply4;	/* reply buffer (fourth part) */	pgoff_t			first;		/* first page in mapping to deal with */	pgoff_t			last;		/* last page in mapping to deal with */	enum {					/* call state */		AFS_CALL_REQUESTING,	/* request is being sent for outgoing call */		AFS_CALL_AWAIT_REPLY,	/* awaiting reply to outgoing call */		AFS_CALL_AWAIT_OP_ID,	/* awaiting op ID on incoming call */		AFS_CALL_AWAIT_REQUEST,	/* awaiting request data on incoming call */		AFS_CALL_REPLYING,	/* replying to incoming call */		AFS_CALL_AWAIT_ACK,	/* awaiting final ACK of incoming call */		AFS_CALL_COMPLETE,	/* successfully completed */		AFS_CALL_BUSY,		/* server was busy */		AFS_CALL_ABORTED,	/* call was aborted */		AFS_CALL_ERROR,		/* call failed due to error */	}			state;	int			error;		/* error code */	unsigned		request_size;	/* size of request data */	unsigned		reply_max;	/* maximum size of reply */	unsigned		reply_size;	/* current size of reply */	unsigned		first_offset;	/* offset into mapping[first] */	unsigned		last_to;	/* amount of mapping[last] */	unsigned short		offset;		/* offset into received data store */	unsigned char		unmarshall;	/* unmarshalling phase */	bool			incoming;	/* T if incoming call */	bool			send_pages;	/* T if data from mapping should be sent */	u16			service_id;	/* RxRPC service ID to call */	__be16			port;		/* target UDP port */	__be32			operation_ID;	/* operation ID for an incoming call */	u32			count;		/* count for use in unmarshalling */	__be32			tmp;		/* place to extract temporary data */	afs_dataversion_t	store_version;	/* updated version expected from store */};struct afs_call_type {	const char *name;	/* deliver request or reply data to an call	 * - returning an error will cause the call to be aborted	 */	int (*deliver)(struct afs_call *call, struct sk_buff *skb,		       bool last);	/* map an abort code to an error number */	int (*abort_to_error)(u32 abort_code);	/* clean up a call */	void (*destructor)(struct afs_call *call);};/* * record of an outstanding writeback on a vnode */struct afs_writeback {	struct list_head	link;		/* link in vnode->writebacks */	struct work_struct	writer;		/* work item to perform the writeback */	struct afs_vnode	*vnode;		/* vnode to which this write applies */	struct key		*key;		/* owner of this write */	wait_queue_head_t	waitq;		/* completion and ready wait queue */	pgoff_t			first;		/* first page in batch */	pgoff_t			point;		/* last page in current store op */	pgoff_t			last;		/* last page in batch (inclusive) */	unsigned		offset_first;	/* offset into first page of start of write */	unsigned		to_last;	/* offset into last page of end of write */	int			num_conflicts;	/* count of conflicting writes in list */	int			usage;	bool			conflicts;	/* T if has dependent conflicts */	enum {		AFS_WBACK_SYNCING,		/* synchronisation being performed */		AFS_WBACK_PENDING,		/* write pending */		AFS_WBACK_CONFLICTING,		/* conflicting writes posted */		AFS_WBACK_WRITING,		/* writing back */		AFS_WBACK_COMPLETE		/* the writeback record has been unlinked */	} state __attribute__((packed));};/* * AFS superblock private data * - there's one superblock per volume */struct afs_super_info {	struct afs_volume	*volume;	/* volume record */	char			rwparent;	/* T if parent is R/W AFS volume */};static inline struct afs_super_info *AFS_FS_S(struct super_block *sb){	return sb->s_fs_info;}extern struct file_system_type afs_fs_type;/* * entry in the cached cell catalogue */struct afs_cache_cell {	char		name[AFS_MAXCELLNAME];	/* cell name (padded with NULs) */	struct in_addr	vl_servers[15];		/* cached cell VL servers */};/* * AFS cell record */struct afs_cell {	atomic_t		usage;	struct list_head	link;		/* main cell list link */	struct key		*anonymous_key;	/* anonymous user key for this cell */	struct list_head	proc_link;	/* /proc cell list link */	struct proc_dir_entry	*proc_dir;	/* /proc dir for this cell */#ifdef AFS_CACHING_SUPPORT	struct cachefs_cookie	*cache;		/* caching cookie */#endif	/* server record management */	rwlock_t		servers_lock;	/* active server list lock */	struct list_head	servers;	/* active server list */	/* volume location record management */	struct rw_semaphore	vl_sem;		/* volume management serialisation semaphore */	struct list_head	vl_list;	/* cell's active VL record list */	spinlock_t		vl_lock;	/* vl_list lock */	unsigned short		vl_naddrs;	/* number of VL servers in addr list */	unsigned short		vl_curr_svix;	/* current server index */	struct in_addr		vl_addrs[AFS_CELL_MAX_ADDRS];	/* cell VL server addresses */	char			name[0];	/* cell name - must go last */};/* * entry in the cached volume location catalogue */struct afs_cache_vlocation {	/* volume name (lowercase, padded with NULs) */	uint8_t			name[AFS_MAXVOLNAME + 1];	uint8_t			nservers;	/* number of entries used in servers[] */	uint8_t			vidmask;	/* voltype mask for vid[] */	uint8_t			srvtmask[8];	/* voltype masks for servers[] */#define AFS_VOL_VTM_RW	0x01 /* R/W version of the volume is available (on this server) */#define AFS_VOL_VTM_RO	0x02 /* R/O version of the volume is available (on this server) */#define AFS_VOL_VTM_BAK	0x04 /* backup version of the volume is available (on this server) */	afs_volid_t		vid[3];		/* volume IDs for R/W, R/O and Bak volumes */	struct in_addr		servers[8];	/* fileserver addresses */	time_t			rtime;		/* last retrieval time */};/* * volume -> vnode hash table entry */struct afs_cache_vhash {	afs_voltype_t		vtype;		/* which volume variation */	uint8_t			hash_bucket;	/* which hash bucket this represents */} __attribute__((packed));/* * AFS volume location record */struct afs_vlocation {	atomic_t		usage;	time_t			time_of_death;	/* time at which put reduced usage to 0 */	struct list_head	link;		/* link in cell volume location list */	struct list_head	grave;		/* link in master graveyard list */	struct list_head	update;		/* link in master update list */	struct afs_cell		*cell;		/* cell to which volume belongs */#ifdef AFS_CACHING_SUPPORT	struct cachefs_cookie	*cache;		/* caching cookie */#endif	struct afs_cache_vlocation vldb;	/* volume information DB record */	struct afs_volume	*vols[3];	/* volume access record pointer (index by type) */	wait_queue_head_t	waitq;		/* status change waitqueue */	time_t			update_at;	/* time at which record should be updated */	spinlock_t		lock;		/* access lock */	afs_vlocation_state_t	state;		/* volume location state */	unsigned short		upd_rej_cnt;	/* ENOMEDIUM count during update */	unsigned short		upd_busy_cnt;	/* EBUSY count during update */	bool			valid;		/* T if valid */};/* * AFS fileserver record */struct afs_server {	atomic_t		usage;	time_t			time_of_death;	/* time at which put reduced usage to 0 */	struct in_addr		addr;		/* server address */	struct afs_cell		*cell;		/* cell in which server resides */	struct list_head	link;		/* link in cell's server list */	struct list_head	grave;		/* link in master graveyard list */	struct rb_node		master_rb;	/* link in master by-addr tree */	struct rw_semaphore	sem;		/* access lock */	/* file service access */	struct rb_root		fs_vnodes;	/* vnodes backed by this server (ordered by FID) */	unsigned long		fs_act_jif;	/* time at which last activity occurred */	unsigned long		fs_dead_jif;	/* time at which no longer to be considered dead */	spinlock_t		fs_lock;	/* access lock */	int			fs_state;      	/* 0 or reason FS currently marked dead (-errno) */	/* callback promise management */	struct rb_root		cb_promises;	/* vnode expiration list (ordered earliest first) */	struct delayed_work	cb_updater;	/* callback updater */	struct delayed_work	cb_break_work;	/* collected break dispatcher */	wait_queue_head_t	cb_break_waitq;	/* space available in cb_break waitqueue */	spinlock_t		cb_lock;	/* access lock */	struct afs_callback	cb_break[64];	/* ring of callbacks awaiting breaking */	atomic_t		cb_break_n;	/* number of pending breaks */	u8			cb_break_head;	/* head of callback breaking ring */	u8			cb_break_tail;	/* tail of callback breaking ring */};

⌨️ 快捷键说明

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