XRootD
Loading...
Searching...
No Matches
XrdOfsHanTab Class Reference

#include <XrdOfsHandle.hh>

+ Collaboration diagram for XrdOfsHanTab:

Public Member Functions

 XrdOfsHanTab (int psize=987, int size=1597)
 
 ~XrdOfsHanTab ()
 
void Add (XrdOfsHandle *hP)
 
XrdOfsHandleFind (XrdOfsHanKey &Key)
 
int Remove (XrdOfsHandle *rip)
 

Detailed Description

Definition at line 88 of file XrdOfsHandle.hh.

Constructor & Destructor Documentation

◆ XrdOfsHanTab()

XrdOfsHanTab::XrdOfsHanTab ( int  psize = 987,
int  size = 1597 
)

Definition at line 651 of file XrdOfsHandle.cc.

652{
653 prevtablesize = psize;
654 nashtablesize = csize;
655 Threshold = (csize * LoadMax) / 100;
656 nashnum = 0;
657 nashtable = (XrdOfsHandle **)
658 malloc( (size_t)(csize*sizeof(XrdOfsHandle *)) );
659 memset((void *)nashtable, 0, (size_t)(csize*sizeof(XrdOfsHandle *)));
660}

◆ ~XrdOfsHanTab()

XrdOfsHanTab::~XrdOfsHanTab ( )
inline

Definition at line 102 of file XrdOfsHandle.hh.

102{} // Never gets deleted

Member Function Documentation

◆ Add()

void XrdOfsHanTab::Add ( XrdOfsHandle hP)

Definition at line 666 of file XrdOfsHandle.cc.

667{
668 unsigned int kent;
669
670// Check if we should expand the table
671//
672 if (++nashnum > Threshold) Expand();
673
674// Add the entry to the table
675//
676 kent = hip->Path.Hash % nashtablesize;
677 hip->Next = nashtable[kent];
678 nashtable[kent] = hip;
679}

References XrdOfsHanKey::Hash.

Referenced by XrdOfsHandle::Alloc().

+ Here is the caller graph for this function:

◆ Find()

XrdOfsHandle * XrdOfsHanTab::Find ( XrdOfsHanKey Key)

Definition at line 730 of file XrdOfsHandle.cc.

731{
732 XrdOfsHandle *nip;
733 unsigned int kent;
734
735// Compute position of the hash table entry
736//
737 kent = Key.Hash%nashtablesize;
738
739// Find the entry
740//
741 nip = nashtable[kent];
742 while(nip && nip->Path != Key) nip = nip->Next;
743 return nip;
744}
unsigned int Hash

References XrdOfsHanKey::Hash.

Referenced by XrdOfsHandle::Alloc(), and XrdOfsHandle::Hide().

+ Here is the caller graph for this function:

◆ Remove()

int XrdOfsHanTab::Remove ( XrdOfsHandle rip)

Definition at line 750 of file XrdOfsHandle.cc.

751{
752 XrdOfsHandle *nip, *pip = 0;
753 unsigned int kent;
754
755// Compute position of the hash table entry
756//
757 kent = rip->Path.Hash%nashtablesize;
758
759// Find the entry
760//
761 nip = nashtable[kent];
762 while(nip && nip != rip) {pip = nip; nip = nip->Next;}
763
764// Remove if found
765//
766 if (nip)
767 {if (pip) pip->Next = nip->Next;
768 else nashtable[kent] = nip->Next;
769 nashnum--;
770 }
771 return nip != 0;
772}

References XrdOfsHanKey::Hash.

Referenced by XrdOfsHandle::Retire().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: