--------------------- PatchSet 262 Date: 2002/12/05 23:10:50 Author: rbcollins Branch: unify-io Tag: (none) Log: starting on aufs open Members: src/fs/aufs/store_asyncufs.h:1.2.12.6->1.2.12.7 src/fs/aufs/store_io_aufs.cc:1.3.12.7->1.3.12.8 Index: squid3/src/fs/aufs/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_asyncufs.h,v retrieving revision 1.2.12.6 retrieving revision 1.2.12.7 diff -u -r1.2.12.6 -r1.2.12.7 --- squid3/src/fs/aufs/store_asyncufs.h 5 Dec 2002 12:57:32 -0000 1.2.12.6 +++ squid3/src/fs/aufs/store_asyncufs.h 5 Dec 2002 23:10:50 -0000 1.2.12.7 @@ -82,6 +82,20 @@ #include "ufscommon.h" +class AufsIO; +class AUFSFile : public DiskFile { + public: + virtual void deleteSelf() const; + AUFSFile (char const *path, AufsIO *); + ~AUFSFile(); + virtual void open (int, mode_t, IORequestor::Pointer); + virtual bool error() const; + virtual int getFD() const { return fd;} + private: + int fd; + char const *path_; +}; + class squidaiostate_t : public UFSStoreState { public: virtual void deleteSelf() const {delete this;} @@ -103,7 +117,7 @@ char *read_buf; link_list *pending_writes; link_list *pending_reads; - void ioCompletedNotification() {assert (0);} + void ioCompletedNotification(); private: CBDATA_CLASS(squidaiostate_t); }; @@ -139,12 +153,13 @@ extern STOBJUNLINK storeAufsUnlink; #include "IOStrategy.h" -class AufsIO : public IOStrategy +class AufsIO : public UFSStrategy { public: virtual bool shedLoad(); virtual void deleteSelf() const; virtual StoreIOState::Pointer createState(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data) const; + virtual DiskFile::Pointer newFile(char const *path); static AufsIO Instance; }; Index: squid3/src/fs/aufs/store_io_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_io_aufs.cc,v retrieving revision 1.3.12.7 retrieving revision 1.3.12.8 diff -u -r1.3.12.7 -r1.3.12.8 --- squid3/src/fs/aufs/store_io_aufs.cc 5 Dec 2002 12:57:33 -0000 1.3.12.7 +++ squid3/src/fs/aufs/store_io_aufs.cc 5 Dec 2002 23:10:50 -0000 1.3.12.8 @@ -26,6 +26,8 @@ /* === PUBLIC =========================================================== */ + + CBDATA_CLASS_INIT(squidaiostate_t); void * @@ -77,8 +79,39 @@ StoreIOState::Pointer AufsIO::createState(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data) const { + return new squidaiostate_t; +} + +DiskFile::Pointer +AufsIO::newFile (char const *path) +{ + return new AUFSFile (path, this); +} + +void +AUFSFile::deleteSelf() const {delete this;} + +AUFSFile::AUFSFile (char const *aPath, AufsIO *IO) { + assert (aPath); + debug (79,0)("UFSFile::UFSFile: %s\n", aPath); + path_ = xstrdup (aPath); +} + +AUFSFile::~AUFSFile() +{ + safe_free (path_); +} + +void +AUFSFile::open (int flags, mode_t mode, IORequestor::Pointer callback) +{ assert (0); - return NULL; +} + +bool +AUFSFile::error() const +{ + return true; } /* open for reading */ @@ -93,6 +126,10 @@ SD->IO->openFailed(); return NULL; } + + /* to consider: make createstate a private UFSStrategy call */ + StoreIOState::Pointer sio = ((UFSStrategy *)SD->IO)->createState (SD, e, callback, callback_data); + #if !ASYNC_OPEN int fd = file_open(path, O_RDONLY | O_BINARY); if (fd < 0) { @@ -100,7 +137,6 @@ return NULL; } #endif - StoreIOState::Pointer sio = new squidaiostate_t; sio->swap_filen = e->swap_filen; sio->swap_dirn = SD->index; sio->mode = O_RDONLY | O_BINARY; @@ -498,3 +534,9 @@ memPoolFree(aufs_qread_pool, qr); } } + +void +squidaiostate_t::ioCompletedNotification() +{ + assert (0); +}