]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLibPrivateInternalFiles/Include/kfile.h
SecurityPkg: Add TPM PTP support in TPM2 device lib.
[mirror_edk2.git] / StdLibPrivateInternalFiles / Include / kfile.h
index c83b07b1a86b10f94f6890000fdc615500ffbbd4..67bff56cc67483b6e7eaa1b2ba50b728942bf3d3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The EFI kernel's interpretation of a "file".\r
 \r
-  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
   distribution.  The full text of the license may be found at\r
@@ -48,6 +48,7 @@
 #include  <Protocol/SimpleFileSystem.h>\r
 \r
 #include  <wchar.h>\r
+#include  <stdarg.h>\r
 #include  <sys/fcntl.h>\r
 #include  <sys/unistd.h>\r
 \r
@@ -81,8 +82,16 @@ struct _Device_Node;
 struct __filedes {\r
   off_t                   f_offset;     /* current position in file */\r
   const struct fileops   *f_ops;\r
+\r
+  /*  The devdata member has different meanings depending upon whether\r
+      a block oriented or character oriented device is being accessed.\r
+      For block devices, devdata holds an EFI handle to the open file or directory.\r
+      For character devices, devdata points to the device's IIO structure,\r
+      if it has one.  It may be NULL indicating a non-interactive character\r
+      device.\r
+  */\r
   void                   *devdata;      /* Device-specific data */\r
-  int                     Oflags;       // From the open call\r
+  int                     Oflags;       // From the open call, see fcntl.h\r
   int                     Omode;        // From the open call\r
   int                     RefCount;     // Reference count of opens\r
   UINT32                  f_flag;       /* see fcntl.h */\r
@@ -93,7 +102,13 @@ struct __filedes {
 \r
 struct fileops {\r
   /* These functions must always be implemented. */\r
+\r
+  /** Perform device specific operations for closing the device.\r
+      It is the responsibility of this function to flush or discard\r
+      buffer contents.\r
+  **/\r
   int     (EFIAPI *fo_close)    (struct __filedes *filp);\r
+\r
   ssize_t (EFIAPI *fo_read)     (struct __filedes *filp, off_t *Offset, size_t Len, void *Buf);\r
   ssize_t (EFIAPI *fo_write)    (struct __filedes *filp, off_t *Offset, size_t Len, const void *Buf);\r
 \r
@@ -104,7 +119,7 @@ struct fileops {
 \r
   /* Call the fbadop_* version of these functions if not implemented by the device. */\r
   int     (EFIAPI *fo_stat)     (struct __filedes *filp, struct stat *StatBuf, void *Buf);\r
-  int     (EFIAPI *fo_ioctl)    (struct __filedes *filp, ULONGN Cmd, void *argp);\r
+  int     (EFIAPI *fo_ioctl)    (struct __filedes *filp, ULONGN Cmd, va_list argp);\r
   int     (EFIAPI *fo_delete)   (struct __filedes *filp);\r
   int     (EFIAPI *fo_rmdir)    (struct __filedes *filp);\r
   int     (EFIAPI *fo_mkdir)    (const char *path, __mode_t perms);\r
@@ -114,7 +129,7 @@ struct fileops {
   off_t   (EFIAPI *fo_lseek)    (struct __filedes *filp, off_t, int);\r
 };\r
 \r
-/*  A generic instance structure which is valid for\r
+/*  A generic instance structure which is valid\r
     for all device instance structures.\r
 \r
     All device instance structures MUST be a multiple of 8-bytes in length.\r
@@ -159,7 +174,7 @@ short   EFIAPI fnullop_poll  (struct __filedes *filp, short Events);
 int     EFIAPI fnullop_flush (struct __filedes *filp);\r
 \r
 int     EFIAPI fbadop_stat   (struct __filedes *filp, struct stat *StatBuf, void *Buf);\r
-int     EFIAPI fbadop_ioctl  (struct __filedes *filp, ULONGN Cmd, void *argp);\r
+int     EFIAPI fbadop_ioctl  (struct __filedes *filp, ULONGN Cmd, va_list argp);\r
 int     EFIAPI fbadop_delete (struct __filedes *filp);\r
 int     EFIAPI fbadop_rmdir  (struct __filedes *filp);\r
 int     EFIAPI fbadop_mkdir  (const char *path, __mode_t perms);\r