OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 /* Copyright (C) 1994 Cazamar Systems, Inc. */ 00011 00012 #ifndef OPENAFS_WINNT_CLIENT_OSI_OSIFD_H 00013 #define OPENAFS_WINNT_CLIENT_OSI_OSIFD_H 1 00014 00015 #include "dbrpc.h" 00016 #include "osiqueue.h" 00017 00018 struct osi_fd; 00019 struct osi_fdType; 00020 00021 /* operations on a file descriptor */ 00022 typedef struct osi_fdOps { 00023 /* create an object, passed in the type info and returns 00024 * the newly created fd. This is the only function not passed 00025 * in the object, since it creates it. 00026 */ 00027 long (*Create)(struct osi_fdType *, struct osi_fd **); 00028 00029 /* gets info about the object; fields are type specific, and eventually 00030 * self-labelling 00031 */ 00032 long (*GetInfo)(struct osi_fd *, osi_remGetInfoParms_t *); 00033 00034 /* close an object; frees the storage associated with it */ 00035 long (*Close)(struct osi_fd *); 00036 } osi_fdOps_t; 00037 00038 /* header structure that must be at the start of all FDs so that we can find 00039 * them generically from the network layer by fd number. 00040 */ 00041 typedef struct osi_fd { 00042 osi_queue_t q; 00043 osi_fdOps_t *opsp; 00044 long fd; 00045 } osi_fd_t; 00046 00047 /* represents a specific file descriptor for iterating over all file 00048 * descriptor types. 00049 */ 00050 typedef struct osi_typeFD { 00051 osi_fd_t fd; /* header */ 00052 struct osi_fdType *curp; /* type scan is about to return next */ 00053 } osi_typeFD_t; 00054 00055 typedef struct osi_fdTypeFormat { 00056 struct osi_fdTypeFormat *nextp; 00057 char *labelp; 00058 long region; 00059 long index; 00060 long format; 00061 } osi_fdTypeFormat_t; 00062 00063 /* describes type of file descriptor; anyone can register a new one */ 00064 typedef struct osi_fdType { 00065 osi_queue_t q; /* for threading together so we can find by name */ 00066 char *namep; /* name */ 00067 void *rockp; /* opaque for type owner */ 00068 osi_fdOps_t *opsp; /* operations */ 00069 osi_fdTypeFormat_t *formatListp; /* list of formatting info */ 00070 } osi_fdType_t; 00071 00072 extern osi_fdType_t *osi_FindFDType(char *); 00073 00074 extern osi_fdType_t *osi_RegisterFDType(char *, osi_fdOps_t *, void *); 00075 00076 extern long osi_UnregisterFDType(char *); 00077 00078 extern int osi_AddFDFormatInfo(osi_fdType_t *typep, long region, long index, 00079 char *labelp, long format); 00080 00081 extern int osi_InitFD(void); 00082 00083 extern osi_fd_t *osi_AllocFD(char *); 00084 00085 extern osi_fd_t *osi_FindFD(long); 00086 00087 extern int osi_CloseFD(osi_fd_t *); 00088 00089 extern long osi_FDTypeCreate(osi_fdType_t *, osi_fd_t **); 00090 00091 extern long osi_FDTypeGetInfo(osi_fd_t *, osi_remGetInfoParms_t *); 00092 00093 extern long osi_FDTypeClose(osi_fd_t *); 00094 00095 #endif /* OPENAFS_WINNT_CLIENT_OSI_OSIFD_H */ 00096