mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-09-23 06:49:02 +00:00
Delete copy constructors and assignment operators (#2257)
One of these was buggy and others had the wrong parameters and return types.
This commit is contained in:
parent
3790a0f8b4
commit
c5a75a1fb2
@ -40,7 +40,8 @@ class AutoLock
|
|||||||
bool is_lock_acquired;
|
bool is_lock_acquired;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AutoLock(const AutoLock&);
|
AutoLock(const AutoLock&) = delete;
|
||||||
|
AutoLock& operator=(const AutoLock&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoLock(pthread_mutex_t* pmutex, Type type = NONE);
|
explicit AutoLock(pthread_mutex_t* pmutex, Type type = NONE);
|
||||||
|
@ -31,24 +31,6 @@ AutoFdEntity::AutoFdEntity() : pFdEntity(nullptr), pseudo_fd(-1)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// [NOTE]
|
|
||||||
// The copy constructor should not be called, then this is private method.
|
|
||||||
// Even if it is called, the consistency of the number of
|
|
||||||
// references can be maintained, but this case is not assumed.
|
|
||||||
//
|
|
||||||
AutoFdEntity::AutoFdEntity(AutoFdEntity& other) : pFdEntity(nullptr), pseudo_fd(-1)
|
|
||||||
{
|
|
||||||
S3FS_PRN_WARN("This method should not be called. Please check the caller.");
|
|
||||||
|
|
||||||
if(other.pFdEntity){
|
|
||||||
if(-1 != (pseudo_fd = other.pFdEntity->Dup(other.pseudo_fd))){
|
|
||||||
pFdEntity = other.pFdEntity;
|
|
||||||
}else{
|
|
||||||
S3FS_PRN_ERR("Failed duplicating fd in AutoFdEntity.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoFdEntity::~AutoFdEntity()
|
AutoFdEntity::~AutoFdEntity()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
@ -131,28 +113,6 @@ FdEntity* AutoFdEntity::OpenExistFdEntity(const char* path, int flags)
|
|||||||
return pFdEntity;
|
return pFdEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [NOTE]
|
|
||||||
// This operator should not be called, then this is private method.
|
|
||||||
// Even if it is called, the consistency of the number of
|
|
||||||
// references can be maintained, but this case is not assumed.
|
|
||||||
//
|
|
||||||
bool AutoFdEntity::operator=(AutoFdEntity& other)
|
|
||||||
{
|
|
||||||
S3FS_PRN_WARN("This method should not be called. Please check the caller.");
|
|
||||||
|
|
||||||
Close();
|
|
||||||
|
|
||||||
if(other.pFdEntity){
|
|
||||||
if(-1 != (pseudo_fd = other.pFdEntity->Dup(other.pseudo_fd))){
|
|
||||||
pFdEntity = other.pFdEntity;
|
|
||||||
}else{
|
|
||||||
S3FS_PRN_ERR("Failed duplicating fd in AutoFdEntity.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
|
@ -43,8 +43,8 @@ class AutoFdEntity
|
|||||||
int pseudo_fd;
|
int pseudo_fd;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AutoFdEntity(AutoFdEntity& other);
|
AutoFdEntity(const AutoFdEntity&) = delete;
|
||||||
bool operator=(AutoFdEntity& other);
|
AutoFdEntity& operator=(const AutoFdEntity&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutoFdEntity();
|
AutoFdEntity();
|
||||||
|
@ -358,14 +358,6 @@ PageList::PageList(off_t size, bool is_loaded, bool is_modified, bool shrinked)
|
|||||||
Init(size, is_loaded, is_modified);
|
Init(size, is_loaded, is_modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
PageList::PageList(const PageList& other)
|
|
||||||
{
|
|
||||||
for(fdpage_list_t::const_iterator iter = other.pages.begin(); iter != other.pages.end(); ++iter){
|
|
||||||
pages.push_back(*iter);
|
|
||||||
}
|
|
||||||
is_shrink = other.is_shrink;
|
|
||||||
}
|
|
||||||
|
|
||||||
PageList::~PageList()
|
PageList::~PageList()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -98,7 +98,8 @@ class PageList
|
|||||||
static void FreeList(fdpage_list_t& list);
|
static void FreeList(fdpage_list_t& list);
|
||||||
|
|
||||||
explicit PageList(off_t size = 0, bool is_loaded = false, bool is_modified = false, bool shrinked = false);
|
explicit PageList(off_t size = 0, bool is_loaded = false, bool is_modified = false, bool shrinked = false);
|
||||||
explicit PageList(const PageList& other);
|
PageList(const PageList&) = delete;
|
||||||
|
PageList& operator=(const PageList&) = delete;
|
||||||
~PageList();
|
~PageList();
|
||||||
|
|
||||||
bool Init(off_t size, bool is_loaded, bool is_modified);
|
bool Init(off_t size, bool is_loaded, bool is_modified);
|
||||||
|
Loading…
Reference in New Issue
Block a user