Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/stand.h
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
#ifndef STAND_H | #ifndef STAND_H | ||||
#define STAND_H | #define STAND_H | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/dirent.h> | #include <sys/dirent.h> | ||||
#include <sys/queue.h> | |||||
/* this header intentionally exports NULL from <string.h> */ | /* this header intentionally exports NULL from <string.h> */ | ||||
#include <string.h> | #include <string.h> | ||||
#define strcoll(a, b) strcmp((a), (b)) | #define strcoll(a, b) strcmp((a), (b)) | ||||
#define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) | #define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) | ||||
#define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} | #define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | struct open_file { | ||||
struct devsw *f_dev; /* pointer to device operations */ | struct devsw *f_dev; /* pointer to device operations */ | ||||
void *f_devdata; /* device specific data */ | void *f_devdata; /* device specific data */ | ||||
struct fs_ops *f_ops; /* pointer to file system operations */ | struct fs_ops *f_ops; /* pointer to file system operations */ | ||||
void *f_fsdata; /* file system specific data */ | void *f_fsdata; /* file system specific data */ | ||||
off_t f_offset; /* current file offset */ | off_t f_offset; /* current file offset */ | ||||
char *f_rabuf; /* readahead buffer pointer */ | char *f_rabuf; /* readahead buffer pointer */ | ||||
size_t f_ralen; /* valid data in readahead buffer */ | size_t f_ralen; /* valid data in readahead buffer */ | ||||
off_t f_raoffset; /* consumer offset in readahead buffer */ | off_t f_raoffset; /* consumer offset in readahead buffer */ | ||||
int f_id; /* file number */ | |||||
TAILQ_ENTRY(open_file) f_link; /* next entry */ | |||||
#define SOPEN_RASIZE 512 | #define SOPEN_RASIZE 512 | ||||
}; | }; | ||||
#define SOPEN_MAX 64 | typedef TAILQ_HEAD(file_list, open_file) file_list_t; | ||||
extern struct open_file files[]; | extern file_list_t files; | ||||
extern struct open_file *fd2open_file(int); | |||||
/* f_flags values */ | /* f_flags values */ | ||||
#define F_READ 0x0001 /* file opened for reading */ | #define F_READ 0x0001 /* file opened for reading */ | ||||
#define F_WRITE 0x0002 /* file opened for writing */ | #define F_WRITE 0x0002 /* file opened for writing */ | ||||
#define F_RAW 0x0004 /* raw device open - no file system */ | #define F_RAW 0x0004 /* raw device open - no file system */ | ||||
#define F_NODEV 0x0008 /* network open - no device */ | #define F_NODEV 0x0008 /* network open - no device */ | ||||
#define F_MASK 0xFFFF | #define F_MASK 0xFFFF | ||||
/* Mode modifier for strategy() */ | /* Mode modifier for strategy() */ | ||||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |