git-svn-id: https://profuse.googlecode.com/svn/branches/v2@280 aa027e90-d47c-11dd-86d7-074df07e0730

This commit is contained in:
ksherlock 2010-05-26 13:22:46 +00:00
parent 4de285c9e1
commit c4849f78e5
2 changed files with 8 additions and 8 deletions

View File

@ -199,7 +199,7 @@ class FileEntry : public Entry {
void setName(const char *name);
void extend(unsigned newSize);
void truncateCommon(unsigned newSize);

View File

@ -167,7 +167,7 @@ int FileEntry::truncate(unsigned newSize)
if (_pageSize) _pageSize->clear();
}
extend(newSize);
truncateCommon(newSize);
_modification = Date::Today();
parent()->writeEntry(this);
@ -176,14 +176,14 @@ int FileEntry::truncate(unsigned newSize)
}
/*
* extend -- common truncation code.
* truncateCommon -- common truncation code.
* updates _lastByte and _lastBlock but does
* not update _modification or commit to disk.
*/
void FileEntry::extend(unsigned newSize)
void FileEntry::truncateCommon(unsigned newSize)
{
#undef __METHOD__
#define __METHOD__ "FileEntry::extend"
#define __METHOD__ "FileEntry::truncateCommon"
unsigned currentSize = fileSize();
@ -192,7 +192,7 @@ void FileEntry::extend(unsigned newSize)
{
if (newSize > _maxFileSize)
throw ProFUSE::POSIXException(__METHOD__ ": Unable to extend file.", ENOSPC);
throw ProFUSE::POSIXException(__METHOD__ ": Unable to expand file.", ENOSPC);
unsigned remainder = newSize - currentSize;
unsigned block = _lastBlock;
@ -251,12 +251,12 @@ int FileEntry::write(uint8_t *buffer, unsigned size, unsigned offset)
if (newSize > _maxFileSize)
{
throw ProFUSE::POSIXException(__METHOD__ ": Unable to extend file.", ENOSPC);
throw ProFUSE::POSIXException(__METHOD__ ": Unable to expand file.", ENOSPC);
}
if (offset > currentSize)
{
extend(offset);
truncateCommon(offset);
}
// now write the data...