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

📄 grio.h

📁 linux得一些常用命令,以及linux环境下的c编程
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved. *  * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. *  * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *  * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like.  Any license provided herein, whether implied or * otherwise, applies only to this software file.  Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. *  * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston MA 02111-1307, USA. *  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, * Mountain View, CA  94043, or: *  * http://www.sgi.com  *  * For further information regarding this notice, see:  *  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ *//* * This include file contains the definitions and structures  * used by the guaranteed rate IO subsystem */#ifndef _LINUX_GRIO_H_#define _LINUX_GRIO_H_#include <linux/limits.h>/* ioctl interface to GRIO on /dev/grio (10,160) */#define XFS_GRIO_MAJOR 10          /* MAJOR number - misc device */#define XFS_GRIO_MINOR 160         /* MINOR number               */#define XFS_GRIO_CMD 113           /* IOCTL command              */typedef struct xfs_grio_ioctl {    /* structure to pass to ioctl */        __u64 cmd;        __u64 arg1, arg2, arg3, arg4, arg5, arg6, arg7;} xfs_grio_ioctl_t;/* cast between 64 bit number and pointer */#define I64_TO_PTR(A) ((void*)(int)(A))#define PTR_TO_I64(A) ((__u64)(int)(void*)(A))/* cast between sysarg_t and pointers */#define SYSARG_TO_PTR(A) (I64_TO_PTR(A))#define PTR_TO_SYSARG(A) (PTR_TO_I64(A))/*  * redefine type definitions */ typedef	__uint64_t	gr_ino_t;typedef	uuid_t		stream_id_t;#ifndef _ASM_SN_TYPES_Htypedef dev_t           vertex_hdl_t;typedef signed short    cnodeid_t;#endiftypedef int             toid_t;/* * Global defines that determine the amount of resources used  * by the GRIO subsystem. *//* * maximum number of disks used by the GRIO subsystem */#define	MAX_NUM_DISKS		512	/* * maximum number of disks in a single stripped volume used by GRIO */#define	MAX_ROTOR_SLOTS		256/* * maximum number of reservations allowed in GRIO subsystem */#define MAX_NUM_RESERVATIONS	3000/* * maximum depth of ggd/grio command queue */#define MAX_GRIO_QUEUE_COUNT    200/*  * maximum number of streams returned by a single STAT call */#define	MAX_STREAM_STAT_COUNT	MAX_NUM_RESERVATIONS/*  * maximum size of a GRIO device name (as recorded in the /etc/grio_config file) */#define DEV_NMLEN		PATH_MAX/*  * grio_resv structure is filled in by the user process and is sent to the * library routine grio_request() along with the file descriptor of the  * resouce for which the I/O rate guarantee is being requested. *  * The grio_request() call will return 0 if there are no errors. If there * is an error the routine will return -1 and the gr_error field will  * contain the error number. In addition, if the guarantee request is * denied due to lack of device bandwidth, then gr_optime, and gr_opsize * will contain values describing the maximum remaining bandwidth. * * * Return errors are: * 	The first two errors indicate an error in the library. *		EINVAL		- could not communicate to daemon *		ESRCH		- invalid procid  * *	These errors indicate an error in the calling process. *		EBADF		- could not stat file or file already *				  has a guarantee *		EIO		- error in guarantee request structure  *				   * start or duration time is incorrect *				   * invalid flags in gr_flags field *		EPERM		- invalid I/O size for file system *		ENOSPC		- bandwidth could not be allocated *		ENOENT		- file does not contain any extents. *		EACCES		- cannot provide desired level of  *				  guarantee (i.e HARD vs SOFT) */typedef struct grio_resv {	char		gr_action;		/* RESV_UNRESV action    */	time_t          gr_start;               /* when to start in secs */	time_t          gr_duration;            /* len of guarantee in secs*/	time_t          gr_optime;              /* time of one op in usecs */	int             gr_opsize;              /* size of each op in bytes*/	stream_id_t     gr_stream_id;           /* stream id             */	int             gr_flags;               /* flags field           */	union {		dev_t	gr_fsdev;		/* FS being reserved     */		int	gr_fd;			/* fd being reserved     */	} gr_object_u;	__uint64_t	gr_memloc;		/* Opaque memory handle  */	int             gr_error;               /* returned: error code  */	char            gr_errordev[DEV_NMLEN]; /* device that caused error*/} grio_resv_t;#define gr_fsid		gr_object_u.gr_fsdev#define gr_fid		gr_object_u.gr_fd/* * Action values for the gr_action field */#define GRIO_RESV_ACTION	0x1#define GRIO_UNRESV_ACTION	0x2/* Define for gr_duration field. This is assumed to be the default if * no duration is specified. (2 yrs in seconds) */#define GRIO_RESV_DURATION_INFINITE	(2*365*24*60*60)/*  * This structure is used to return statistics info to the caller. * It is used with GRIO_GET_INFO resv_type. *	subcommands are: *		GRIO_DEV_RESVS: *			return number of reservations on the device  *			identified by ( device_name) in grio_blk_t *			structure. *		GRIO_FILE_RESVS:	 *			return number of reservations on the file  *			identified by ( fs_dev, ino) pair in grio_blk_t *			structure. *		GRIO_PROC_RESVS: *			return number of reservations for the process  *			identified by ( procid ) in grio_blk_t structure. */typedef struct grio_stats {	/*	 * value dependent on the subcommand and grio_blk_t parameters.	 */	u_long	gs_count;		/* current number of reservations					 * active on the device/file/proc					 */	u_long	gs_maxresv;		/* maximum number of reservations					 * allowed on the device.					 * for file/proc this is the number					 * of licensed streams.					 */	u_long	gs_optiosize;		/* size of the optimal i/o size					 * in bytes for this device.					 * not defined for file/proc.					 */	char 	devname[DEV_NMLEN];} grio_stats_t;/* info returned to user by libgrio when MLD stuff is done */typedef	struct grio_mem_locality_s {	cnodeid_t       grio_cnode;} grio_mem_locality_t;/*  * Defines for the gr_flags field. * Set the user process or by the grio_lib */#define	PER_FILE_GUAR		0x00000008#define	PER_FILE_SYS_GUAR	0x00000010#define PROC_PRIVATE_GUAR	0x00000020	#define PROC_SHARE_GUAR		0x00000040#define FIXED_ROTOR_GUAR	0x00000100#define SLIP_ROTOR_GUAR		0x00000200#define NON_ROTOR_GUAR		0x00000400#define REALTIME_SCHED_GUAR	0x00002000#define NON_SCHED_GUAR		0x00004000#define SYSTEM_GUAR		0x00008000#define READ_GUAR		0x00010000#define WRITE_GUAR		0x00020000#define GUARANTEE_MASK		0x0003FFFF/* * Defines for the types of reservations * Set by the ggd daemon */#define RESERVATION_STARTED	0x10000000#define RESERVATION_TYPE_VOD	0x20000000/* * Defines for stream states.  * Set by the grio driver. */#define	STREAM_REMOVE_IN_PROGRESS	0x01000000#define	STREAM_INITIATE_IN_PROGRESS	0x02000000#define STREAM_SLIPPED_ONCE		0x04000000#define STREAM_ASSOCIATED		0x08000000#define STREAM_STATE_MASK		0xFF000000/* * backwards compatability */#define VOD_LAYOUT		SLIP_ROTOR_GUAR#define IS_VOD_GUAR( griorp ) \	( (griorp->gr_flags & FIXED_ROTOR_GUAR)  || \	  (griorp->gr_flags & SLIP_ROTOR_GUAR)  )#define IS_FILESYS_GUAR( griorp ) \	( griorp->gr_flags & PER_FILE_SYS_GUAR )#define IS_FILE_GUAR( griorp ) \	( griorp->gr_flags & PER_FILE_GUAR )/* This structure has information about the end object to which we are * allocating bandwidth. */struct end_info {	char		gr_end_type;        char            gr_dummy1[3];        dev_t           gr_dev;			/* dev_t/file system dev_t */        gr_ino_t       	gr_ino;			/* inode number            */};/* * Values for the gr_end_type field */#define END_TYPE_NONE		0x0		/* nothing at this end  */#define END_TYPE_REG		0x1		/* regular XFS file/fs  */#define END_TYPE_SPECIAL	0x2		/* device special file */typedef struct grio_command {        int             gr_cmd;			/* grio command            */	int		gr_subcmd;		/* grio subcommand	   */        pid_t           gr_procid;		/* process id of requestor */	__uint64_t	gr_fp;			/* file pointer		   */	struct end_info	one_end;		/* one end info		   */	struct end_info other_end;		/* other end info. This is						 * normally END_TYPE_NONE						 * except for peer-to-peer						 * cases.						 */	__uint64_t	memloc;			/* memory location	   */	union {        	grio_resv_t     gr_resv;      	/* grio request info       */		grio_stats_t	gr_stats;	/* grio stats info	   */	} cmd_info;	int		gr_bytes_bw;		/* returned bandwidth	   */	int		gr_usecs_bw;		/* returned bandwidth	   */	int		gr_time_to_wait;	/* kernel wait time	   */} grio_cmd_t;/* * Structure definitions with fields defined as known sizes. * This is done to have a layer of abstraction between the kernel and the * ggd daemon. The kernel can have 32 bit inumber, file sizes, and file * system sizes, but the ggd will always view them as 64 bit quantities. */typedef struct grio_file_id {	gr_ino_t	ino;	dev_t		fs_dev;	pid_t		procid;	__uint64_t	fp;} grio_file_id_t;typedef struct grio_disk_id {	int		num_iops;	int		opt_io_size;	time_t		iops_time;} grio_disk_id_t;typedef struct grio_bmbt_irec {	__uint64_t	br_startoff;	__uint64_t	br_startblock;	__uint64_t	br_blockcount;} grio_bmbt_irec_t;/* * defines for the gr_cmd field. */#define GRIO_UNKNOWN		0#define GRIO_RESV		1#define	GRIO_UNRESV		2#define GRIO_UNRESV_ASYNC	3#define GRIO_PURGE_VDEV_ASYNC	4#define	GRIO_GET_STATS		5#define	GRIO_GET_BW		6#define	GRIO_GET_FILE_RESVD_BW	7#define GRIO_ACTIVE_COMMANDS	GRIO_GET_FILE_RESVD_BW + 1#define GRIO_MAX_COMMANDS	20#define GRIO_ASYNC_CMD(griocp)	\	(( (griocp)->gr_cmd == GRIO_UNRESV_ASYNC ) || \	 ( (griocp)->gr_cmd == GRIO_PURGE_VDEV_ASYNC) )#define GRIO_STATS_REQ(grioreq)	\	( (grioreq)->gr_cmd == GRIO_GET_STATS )#define	GRIO_GET_RESV_DATA( griocp )		(&(griocp->cmd_info.gr_resv))#define	GRIO_GET_STATS_DATA( griocp )		(&(griocp->cmd_info.gr_stats))/* * syssgi SGI_GRIO commands

⌨️ 快捷键说明

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