X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=StdLibPrivateInternalFiles%2FInclude%2Fkfile.h;h=67bff56cc67483b6e7eaa1b2ba50b728942bf3d3;hp=845b7d908e845d994ce2d458210c859863ef6bbd;hb=79e748cf29f6d9a92f28d44d20eef8d6c24c4092;hpb=b00771f50a1f9d72852de544cff5cbfd951e71ac diff --git a/StdLibPrivateInternalFiles/Include/kfile.h b/StdLibPrivateInternalFiles/Include/kfile.h index 845b7d908e..67bff56cc6 100644 --- a/StdLibPrivateInternalFiles/Include/kfile.h +++ b/StdLibPrivateInternalFiles/Include/kfile.h @@ -1,7 +1,7 @@ /** @file The EFI kernel's interpretation of a "file". - Copyright (c) 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -79,21 +80,35 @@ struct _Device_Node; This structure must be a multiple of 8 bytes in length. */ struct __filedes { + off_t f_offset; /* current position in file */ const struct fileops *f_ops; + + /* The devdata member has different meanings depending upon whether + a block oriented or character oriented device is being accessed. + For block devices, devdata holds an EFI handle to the open file or directory. + For character devices, devdata points to the device's IIO structure, + if it has one. It may be NULL indicating a non-interactive character + device. + */ void *devdata; /* Device-specific data */ - off_t f_offset; /* current position in file */ - UINT32 f_flag; /* see fcntl.h */ - UINT32 f_iflags; // In use if non-zero - int Oflags; // From the open call + int Oflags; // From the open call, see fcntl.h int Omode; // From the open call int RefCount; // Reference count of opens + UINT32 f_flag; /* see fcntl.h */ + UINT32 f_iflags; // In use if non-zero UINT16 MyFD; // Which FD this is. UINT16 Reserved_1; // Force this structure to be a multiple of 8-bytes in length }; struct fileops { /* These functions must always be implemented. */ + + /** Perform device specific operations for closing the device. + It is the responsibility of this function to flush or discard + buffer contents. + **/ int (EFIAPI *fo_close) (struct __filedes *filp); + ssize_t (EFIAPI *fo_read) (struct __filedes *filp, off_t *Offset, size_t Len, void *Buf); ssize_t (EFIAPI *fo_write) (struct __filedes *filp, off_t *Offset, size_t Len, const void *Buf); @@ -104,7 +119,7 @@ struct fileops { /* Call the fbadop_* version of these functions if not implemented by the device. */ int (EFIAPI *fo_stat) (struct __filedes *filp, struct stat *StatBuf, void *Buf); - int (EFIAPI *fo_ioctl) (struct __filedes *filp, ULONGN Cmd, void *argp); + int (EFIAPI *fo_ioctl) (struct __filedes *filp, ULONGN Cmd, va_list argp); int (EFIAPI *fo_delete) (struct __filedes *filp); int (EFIAPI *fo_rmdir) (struct __filedes *filp); int (EFIAPI *fo_mkdir) (const char *path, __mode_t perms); @@ -114,7 +129,7 @@ struct fileops { off_t (EFIAPI *fo_lseek) (struct __filedes *filp, off_t, int); }; -/* A generic instance structure which is valid for +/* A generic instance structure which is valid for all device instance structures. All device instance structures MUST be a multiple of 8-bytes in length. @@ -130,7 +145,8 @@ typedef struct { /* Type of all Device-specific handler's open routines. */ typedef - int (EFIAPI *FO_OPEN) (struct __filedes *FD, void *IP, wchar_t *Path, wchar_t *Flags); + int (EFIAPI *FO_OPEN) (struct _Device_Node *This, struct __filedes *FD, + int Instance, wchar_t *Path, wchar_t *MPath); #define FILE_IS_USABLE(fp) (((fp)->f_iflags & \ (FIF_WANTCLOSE|FIF_LARVAL)) == 0) @@ -153,16 +169,16 @@ int fdcreate (CHAR16 *, UINT32, UINT32, BOOLEAN, VOID *, const struct fileo fnullop_* Does nothing and returns success. fbadop_* Does nothing and returns EPERM */ -int fnullop_fcntl (struct __filedes *filp, UINT32 Cmd, void *p3, void *p4); -short fnullop_poll (struct __filedes *filp, short Events); -int fnullop_flush (struct __filedes *filp); - -int fbadop_stat (struct __filedes *filp, struct stat *StatBuf, void *Buf); -int fbadop_ioctl (struct __filedes *filp, ULONGN Cmd, void *argp); -int fbadop_delete (struct __filedes *filp); -int fbadop_rmdir (struct __filedes *filp); -int fbadop_mkdir (const char *path, __mode_t perms); -int fbadop_rename (const char *from, const char *to); +int EFIAPI fnullop_fcntl (struct __filedes *filp, UINT32 Cmd, void *p3, void *p4); +short EFIAPI fnullop_poll (struct __filedes *filp, short Events); +int EFIAPI fnullop_flush (struct __filedes *filp); + +int EFIAPI fbadop_stat (struct __filedes *filp, struct stat *StatBuf, void *Buf); +int EFIAPI fbadop_ioctl (struct __filedes *filp, ULONGN Cmd, va_list argp); +int EFIAPI fbadop_delete (struct __filedes *filp); +int EFIAPI fbadop_rmdir (struct __filedes *filp); +int EFIAPI fbadop_mkdir (const char *path, __mode_t perms); +int EFIAPI fbadop_rename (const char *from, const char *to); __END_DECLS