It's no longer possible to remove or recreate a file that is opened with
uncached access. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1928 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1621,6 +1621,12 @@ Inode::Remove(Transaction *transaction,const char *name,off_t *_id,bool isDirect
|
|||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// You can't unlink a mounted or the VM file while it is being used - while
|
||||||
|
// this is not really necessary, it copies the behaviour of the original BFS
|
||||||
|
// and let you and me feel a little bit safer
|
||||||
|
if (inode->Flags() & INODE_NO_CACHE)
|
||||||
|
return B_NOT_ALLOWED;
|
||||||
|
|
||||||
// It's a bit stupid, but indices are regarded as directories
|
// It's a bit stupid, but indices are regarded as directories
|
||||||
// in BFS - so a test for a directory always succeeds, but you
|
// in BFS - so a test for a directory always succeeds, but you
|
||||||
// should really be able to do whatever you want with your indices
|
// should really be able to do whatever you want with your indices
|
||||||
@@ -1682,7 +1688,8 @@ Inode::Remove(Transaction *transaction,const char *name,off_t *_id,bool isDirect
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::Create(Transaction *transaction,Inode *parent, const char *name, int32 mode, int omode, uint32 type, off_t *_id, Inode **_inode)
|
Inode::Create(Transaction *transaction, Inode *parent, const char *name, int32 mode,
|
||||||
|
int omode, uint32 type, off_t *_id, Inode **_inode)
|
||||||
{
|
{
|
||||||
block_run parentRun = parent ? parent->BlockRun() : block_run::Run(0,0,0);
|
block_run parentRun = parent ? parent->BlockRun() : block_run::Run(0,0,0);
|
||||||
Volume *volume = transaction->GetVolume();
|
Volume *volume = transaction->GetVolume();
|
||||||
@@ -1712,6 +1719,11 @@ Inode::Create(Transaction *transaction,Inode *parent, const char *name, int32 mo
|
|||||||
if (inode->IsDirectory())
|
if (inode->IsDirectory())
|
||||||
return B_IS_A_DIRECTORY;
|
return B_IS_A_DIRECTORY;
|
||||||
|
|
||||||
|
// if it is a mounted device or the VM file, we don't allow to delete it
|
||||||
|
// while it is open and in use
|
||||||
|
if (inode->Flags() & INODE_NO_CACHE)
|
||||||
|
return B_NOT_ALLOWED;
|
||||||
|
|
||||||
// if omode & O_TRUNC, truncate the existing file
|
// if omode & O_TRUNC, truncate the existing file
|
||||||
if (omode & O_TRUNC) {
|
if (omode & O_TRUNC) {
|
||||||
WriteLocked locked(inode->Lock());
|
WriteLocked locked(inode->Lock());
|
||||||
|
|||||||
Reference in New Issue
Block a user