]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
s/fileno/filen/ in Rock store code to avoid conflicts with fileno(3).
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Tue, 23 Aug 2011 16:22:16 +0000 (20:22 +0400)
committerDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Tue, 23 Aug 2011 16:22:16 +0000 (20:22 +0400)
Apparently, older GCC versions include more standard headers than it
should which causes build failures.

src/fs/rock/RockRebuild.cc
src/fs/rock/RockRebuild.h
src/fs/rock/RockSwapDir.cc

index 24a1f6fd19c233f1967c46f3b24036c862c45b6f..4fa92556613c0d82ab5ab5c3c26093bc00025c40 100644 (file)
@@ -18,7 +18,7 @@ Rock::Rebuild::Rebuild(SwapDir *dir): AsyncJob("Rock::Rebuild"),
     dbEntryLimit(0),
     fd(-1),
     dbOffset(0),
-    fileno(0)
+    filen(0)
 {
     assert(sd);
     memset(&counts, 0, sizeof(counts));
@@ -56,7 +56,7 @@ Rock::Rebuild::start() {
         failure("cannot read db header", errno);
 
     dbOffset = SwapDir::HeaderSize;
-    fileno = 0;    
+    filen = 0;    
 
     checkpoint();
 }
@@ -84,13 +84,13 @@ Rock::Rebuild::Steps(void *data)
 
 void
 Rock::Rebuild::steps() {
-    debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+    debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
         dbOffset << " <= " << dbSize);
 
     const int maxCount = dbEntryLimit;
     const int wantedCount = opt_foreground_rebuild ? maxCount : 50;
     const int stepCount = min(wantedCount, maxCount);
-    for (int i = 0; i < stepCount && dbOffset < dbSize; ++i, ++fileno) {
+    for (int i = 0; i < stepCount && dbOffset < dbSize; ++i, ++filen) {
         doOneEntry();
         dbOffset += dbEntrySize;
 
@@ -103,7 +103,7 @@ Rock::Rebuild::steps() {
 
 void
 Rock::Rebuild::doOneEntry() {
-    debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+    debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
         dbOffset << " <= " << dbSize);
 
     ++counts.scancount;
@@ -141,7 +141,7 @@ Rock::Rebuild::doOneEntry() {
         // skip empty slots
         if (loadedE.swap_filen > 0 || loadedE.swap_file_sz > 0) {
             counts.invalid++;
-            //sd->unlink(fileno); leave garbage on disk, it should not hurt
+            //sd->unlink(filen); leave garbage on disk, it should not hurt
         }
         return;
        }
@@ -153,7 +153,7 @@ Rock::Rebuild::doOneEntry() {
     counts.objcount++;
     // loadedE->dump(5);
 
-    sd->addEntry(fileno, header, loadedE);
+    sd->addEntry(filen, header, loadedE);
 }
 
 void
@@ -166,7 +166,7 @@ Rock::Rebuild::swanSong() {
 
 void
 Rock::Rebuild::failure(const char *msg, int errNo) {
-    debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+    debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
         dbOffset << " <= " << dbSize);
 
     if (errNo)
index f9bd43ab2a116aa0562a5468fe4ab6fd4e080c39..0d0c556675af3ad74e8ad19711e0d44f0e2cdbec 100644 (file)
@@ -36,7 +36,7 @@ private:
 
     int fd; // store db file descriptor
     int64_t dbOffset;
-    int fileno;
+    int filen;
 
     struct _store_rebuild_data counts;
 
index bf072156076052ca42f971715018b05742bbe68f..4532873e4c8f7e04a2768282a32df69cbc1817cc 100644 (file)
@@ -46,8 +46,8 @@ Rock::SwapDir::get(const cache_key *key)
     if (!map || !theFile || !theFile->canRead())
         return NULL;
 
-    sfileno fileno;
-    const Ipc::StoreMapSlot *const slot = map->openForReading(key, fileno);
+    sfileno filen;
+    const Ipc::StoreMapSlot *const slot = map->openForReading(key, filen);
     if (!slot)
         return NULL;
 
@@ -57,7 +57,7 @@ Rock::SwapDir::get(const cache_key *key)
     StoreEntry *e = new StoreEntry();
     e->lock_count = 0;
     e->swap_dirn = index;
-    e->swap_filen = fileno;
+    e->swap_filen = filen;
     e->swap_file_sz = basics.swap_file_sz;
     e->lastref = basics.lastref;
     e->timestamp = basics.timestamp;
@@ -322,20 +322,20 @@ Rock::SwapDir::rebuild() {
 /* Add a new object to the cache with empty memory copy and pointer to disk
  * use to rebuild store from disk. Based on UFSSwapDir::addDiskRestore */
 bool
-Rock::SwapDir::addEntry(const int fileno, const DbCellHeader &header, const StoreEntry &from)
+Rock::SwapDir::addEntry(const int filen, const DbCellHeader &header, const StoreEntry &from)
 {
     debugs(47, 8, HERE << &from << ' ' << from.getMD5Text() <<
-       ", fileno="<< std::setfill('0') << std::hex << std::uppercase <<
-       std::setw(8) << fileno);
+       ", filen="<< std::setfill('0') << std::hex << std::uppercase <<
+       std::setw(8) << filen);
 
     sfileno newLocation = 0;
     if (Ipc::StoreMapSlot *slot = map->openForWriting(reinterpret_cast<const cache_key *>(from.key), newLocation)) {
-        if (fileno == newLocation) {
+        if (filen == newLocation) {
             slot->set(from);
-            map->extras(fileno) = header;
+            map->extras(filen) = header;
         } // else some other, newer entry got into our cell
         map->closeForWriting(newLocation, false);
-        return fileno == newLocation;
+        return filen == newLocation;
     }
 
     return false;
@@ -386,16 +386,16 @@ Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreI
     const int64_t payloadEnd = sizeof(DbCellHeader) + header.payloadSize;
     assert(payloadEnd <= max_objsize);
 
-    sfileno fileno;
+    sfileno filen;
     Ipc::StoreMapSlot *const slot =
-        map->openForWriting(reinterpret_cast<const cache_key *>(e.key), fileno);
+        map->openForWriting(reinterpret_cast<const cache_key *>(e.key), filen);
     if (!slot) {
         debugs(47, 5, HERE << "Rock::SwapDir::createStoreIO: map->add failed");
         return NULL;
     }
     e.swap_file_sz = header.payloadSize; // and will be copied to the map
     slot->set(e);
-    map->extras(fileno) = header;
+    map->extras(filen) = header;
 
     // XXX: We rely on our caller, storeSwapOutStart(), to set e.fileno.
     // If that does not happen, the entry will not decrement the read level!
@@ -403,11 +403,11 @@ Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreI
     IoState *sio = new IoState(this, &e, cbFile, cbIo, data);
 
     sio->swap_dirn = index;
-    sio->swap_filen = fileno;
+    sio->swap_filen = filen;
     sio->payloadEnd = payloadEnd;
     sio->diskOffset = diskOffset(sio->swap_filen);
 
-    debugs(47,5, HERE << "dir " << index << " created new fileno " <<
+    debugs(47,5, HERE << "dir " << index << " created new filen " <<
         std::setfill('0') << std::hex << std::uppercase << std::setw(8) <<
         sio->swap_filen << std::dec << " at " << sio->diskOffset);
 
@@ -468,7 +468,7 @@ Rock::SwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreIOS
     sio->payloadEnd = sizeof(DbCellHeader) + map->extras(e.swap_filen).payloadSize;
     assert(sio->payloadEnd <= max_objsize); // the payload fits the slot
 
-    debugs(47,5, HERE << "dir " << index << " has old fileno: " <<
+    debugs(47,5, HERE << "dir " << index << " has old filen: " <<
         std::setfill('0') << std::hex << std::uppercase << std::setw(8) <<
         sio->swap_filen);