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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 264ec45  Cleanup: VIO
264ec45 is described below

commit 264ec459cf34ee872f9430e096c097e56d6aa678
Author: Masaori Koshiba <[email protected]>
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)
---
 iocore/eventsystem/I_IOBuffer.h |  4 ++--
 iocore/eventsystem/I_VIO.h      | 28 ++++++++++------------------
 iocore/eventsystem/P_VIO.h      | 36 +++++++++++-------------------------
 3 files changed, 23 insertions(+), 45 deletions(-)

diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index 404b41d..e74bb15 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -1298,13 +1298,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 b805220..d2b2b10 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);
 
   /**
@@ -95,15 +93,15 @@ public:
     @return The number of bytes to be processed by the operation.
 
   */
-  int64_t ntodo();
+  int64_t ntodo() const;
 
   /////////////////////
   // buffer settings //
   /////////////////////
   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();
-
-  explicit 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 4eebf06..b934e91 100644
--- a/iocore/eventsystem/P_VIO.h
+++ b/iocore/eventsystem/P_VIO.h
@@ -27,44 +27,45 @@
 TS_INLINE
 VIO::VIO(int aop) : op(aop), buffer(), mutex(nullptr) {}
 
-/////////////////////////////////////////////////////////////
-//
-//  VIO::VIO()
-//
-/////////////////////////////////////////////////////////////
 TS_INLINE
 VIO::VIO() : buffer(), 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()
+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;
 }

Reply via email to