From 1c41725c54b35edc5407be733e32c68bc2b5fcf9 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 26 Feb 2013 15:21:22 -0700 Subject: [PATCH] Bug 3720: SourceLayout: shuffle fd_table definition into fde.h Shift the definition out of globals.h into fde.h where the type class is defined, and the instance into fde.cc. Fixing bug 3720; build errors on OpenIndiana and Solaris. Also, move it into the fde class scope as a static Table member. Provides wrapper definition of fd_table to reduce patch impact. --- src/Makefile.am | 9 +++++++++ src/fde.cc | 2 ++ src/fde.h | 6 ++++++ src/globals.h | 2 -- src/tests/stub_fd.cc | 2 ++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 803c430db8..8e9309ee2d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1628,6 +1628,8 @@ tests_testDiskIO_SOURCES = \ tests/stub_fatal.cc \ fd.h \ fd.cc \ + fde.h \ + fde.cc \ FileMap.h \ filemap.cc \ HttpBody.h \ @@ -2868,6 +2870,7 @@ tests_testStore_SOURCES= \ tests/stub_DiskIOModule.cc \ tests/stub_errorpage.cc \ fd.h \ + fde.h \ tests/stub_fd.cc \ tests/stub_helper.cc \ tests/stub_HelperChildConfig.cc \ @@ -3026,6 +3029,8 @@ tests_testUfs_SOURCES = \ tests/stub_fatal.cc \ fd.h \ fd.cc \ + fde.h \ + fde.cc \ client_db.h \ disk.h \ disk.cc \ @@ -3189,6 +3194,8 @@ tests_testRock_SOURCES = \ tests/stub_fatal.cc \ fd.h \ fd.cc \ + fde.h \ + fde.cc \ FileMap.h \ filemap.cc \ HttpHeaderFieldStat.h \ @@ -3349,6 +3356,8 @@ tests_testCoss_SOURCES = \ tests/stub_fatal.cc \ fd.h \ fd.cc \ + fde.h \ + fde.cc \ disk.h \ disk.cc \ FileMap.h \ diff --git a/src/fde.cc b/src/fde.cc index 8aae9767f5..c690c415dc 100644 --- a/src/fde.cc +++ b/src/fde.cc @@ -38,6 +38,8 @@ #include "SquidTime.h" #include "Store.h" +fde *fde::Table = NULL; + bool fde::readPending(int fdNumber) { diff --git a/src/fde.h b/src/fde.h index f82e190901..680cea615b 100644 --- a/src/fde.h +++ b/src/fde.h @@ -73,6 +73,10 @@ public: void noteUse(PconnPool *); public: + + /// global table of FD and their state. + static fde* Table; + unsigned int type; unsigned short remote_port; @@ -193,6 +197,8 @@ private: } }; +#define fd_table fde::Table + int fdNFree(void); #define FD_READ_METHOD(fd, buf, len) (*fd_table[fd].read_method)(fd, buf, len) diff --git a/src/globals.h b/src/globals.h index 3980d926d8..cc640597ab 100644 --- a/src/globals.h +++ b/src/globals.h @@ -60,8 +60,6 @@ extern const char *memStatusStr[]; extern const char *pingStatusStr[]; extern const char *storeStatusStr[]; extern const char *swapStatusStr[]; -class fde; -extern fde *fd_table; /* NULL */ extern int Biggest_FD; /* -1 */ extern int Number_FD; /* 0 */ extern int Opening_FD; /* 0 */ diff --git a/src/tests/stub_fd.cc b/src/tests/stub_fd.cc index a5eab4b03f..1c6f0efdf0 100644 --- a/src/tests/stub_fd.cc +++ b/src/tests/stub_fd.cc @@ -4,6 +4,8 @@ #define STUB_API "fd.cc" #include "tests/STUB.h" +fde *fde::Table = NULL; + int fdNFree(void) STUB_RETVAL(-1) void fd_open(int fd, unsigned int type, const char *desc) STUB void fd_close(int fd) STUB -- 2.47.2