You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/04/06 18:31:05 UTC

[trafficserver] 03/25: Cleanup: VIO

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 992914b11adfd206c29804e210d5b7a84966a2f6
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Sep 10 08:53:54 2019 +0900

    Cleanup: VIO
    
    - No logical changes
    - Remove unnecessary include headers
    - Fix format
    - Make const functions
    
    (cherry picked from commit dc0fb99bab960026ba842210ec16fab4f4701e65)
    
    Conflicts:
    	iocore/eventsystem/I_VIO.h
---
 iocore/eventsystem/I_IOBuffer.h |  4 ++--
 iocore/eventsystem/I_VIO.h      | 26 +++++++++-----------------
 iocore/eventsystem/P_VIO.h      | 34 ++++++++++------------------------
 3 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index ac652e3..852ccee 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -1184,13 +1184,13 @@ public:
 */
 struct MIOBufferAccessor {
   IOBufferReader *
-  reader()
+  reader() const
   {
     return entry;
   }
 
   MIOBuffer *
-  writer()
+  writer() const
   {
     return mbuf;
   }
diff --git a/iocore/eventsystem/I_VIO.h b/iocore/eventsystem/I_VIO.h
index eacbc35..69f4890 100644
--- a/iocore/eventsystem/I_VIO.h
+++ b/iocore/eventsystem/I_VIO.h
@@ -25,17 +25,12 @@
 #pragma once
 #define I_VIO_h
 
-#include "tscore/ink_platform.h"
-#include "I_EventSystem.h"
 #if !defined(I_IOBuffer_h)
 #error "include I_IOBuffer.h"
----include I_IOBuffer.h
 #endif
-#include "tscore/ink_apidefs.h"
-   class Continuation;
+
+class Continuation;
 class VConnection;
-class IOVConnection;
-class MIOBuffer;
 class ProxyMutex;
 
 /**
@@ -73,9 +68,12 @@ class ProxyMutex;
 class VIO
 {
 public:
+  explicit VIO(int aop);
+  VIO();
   ~VIO() {}
+
   /** Interface for the VConnection that owns this handle. */
-  Continuation *get_continuation();
+  Continuation *get_continuation() const;
   void set_continuation(Continuation *cont);
 
   /**
@@ -102,8 +100,8 @@ public:
   /////////////////////
   void set_writer(MIOBuffer *writer);
   void set_reader(IOBufferReader *reader);
-  MIOBuffer *get_writer();
-  IOBufferReader *get_reader();
+  MIOBuffer *get_writer() const;
+  IOBufferReader *get_reader() const;
 
   /**
     Reenable the IO operation.
@@ -140,10 +138,7 @@ public:
   inkcoreapi void reenable_re();
 
   void disable();
-  bool is_disabled();
-
-  VIO(int aop);
-  VIO();
+  bool is_disabled() const;
 
   enum {
     NONE = 0,
@@ -160,7 +155,6 @@ public:
     STAT,
   };
 
-public:
   /**
     Continuation to callback.
 
@@ -225,5 +219,3 @@ public:
 private:
   bool _disabled = false;
 };
-
-#include "I_VConnection.h"
diff --git a/iocore/eventsystem/P_VIO.h b/iocore/eventsystem/P_VIO.h
index 5c0d057..b09a190 100644
--- a/iocore/eventsystem/P_VIO.h
+++ b/iocore/eventsystem/P_VIO.h
@@ -27,44 +27,45 @@
 TS_INLINE
 VIO::VIO(int aop) : cont(nullptr), nbytes(0), ndone(0), op(aop), buffer(), vc_server(nullptr), mutex(nullptr) {}
 
-/////////////////////////////////////////////////////////////
-//
-//  VIO::VIO()
-//
-/////////////////////////////////////////////////////////////
 TS_INLINE
 VIO::VIO() : cont(nullptr), nbytes(0), ndone(0), op(VIO::NONE), buffer(), vc_server(nullptr), mutex(nullptr) {}
 
 TS_INLINE Continuation *
-VIO::get_continuation()
+VIO::get_continuation() const
 {
   return cont;
 }
+
 TS_INLINE void
 VIO::set_writer(MIOBuffer *writer)
 {
   buffer.writer_for(writer);
 }
+
 TS_INLINE void
 VIO::set_reader(IOBufferReader *reader)
 {
   buffer.reader_for(reader);
 }
+
 TS_INLINE MIOBuffer *
-VIO::get_writer()
+VIO::get_writer() const
 {
   return buffer.writer();
 }
+
 TS_INLINE IOBufferReader *
-VIO::get_reader()
+VIO::get_reader() const
 {
   return (buffer.reader());
 }
+
 TS_INLINE int64_t
 VIO::ntodo() const
 {
   return nbytes - ndone;
 }
+
 TS_INLINE void
 VIO::done()
 {
@@ -75,11 +76,6 @@ VIO::done()
   }
 }
 
-/////////////////////////////////////////////////////////////
-//
-//  VIO::set_continuation()
-//
-/////////////////////////////////////////////////////////////
 TS_INLINE void
 VIO::set_continuation(Continuation *acont)
 {
@@ -96,11 +92,6 @@ VIO::set_continuation(Continuation *acont)
   return;
 }
 
-/////////////////////////////////////////////////////////////
-//
-//  VIO::reenable()
-//
-/////////////////////////////////////////////////////////////
 TS_INLINE void
 VIO::reenable()
 {
@@ -110,11 +101,6 @@ VIO::reenable()
   }
 }
 
-/////////////////////////////////////////////////////////////
-//
-//  VIO::reenable_re()
-//
-/////////////////////////////////////////////////////////////
 TS_INLINE void
 VIO::reenable_re()
 {
@@ -131,7 +117,7 @@ VIO::disable()
 }
 
 TS_INLINE bool
-VIO::is_disabled()
+VIO::is_disabled() const
 {
   return this->_disabled;
 }