return status;
}
+
+
+/*
+ determine if a file is open
+*/
+BOOL odb_is_open(struct odb_context *odb, DATA_BLOB *key)
+{
+ TDB_DATA dbuf;
+ TDB_DATA kbuf;
+
+ kbuf.dptr = key->data;
+ kbuf.dsize = key->length;
+
+ dbuf = tdb_fetch(odb->w->tdb, kbuf);
+ if (dbuf.dptr == NULL) {
+ return False;
+ }
+ free(dbuf.dptr);
+ return True;
+}
return status;
}
+
+
+/*
+ determine if a file is open - used to prevent some operations on open files
+*/
+BOOL pvfs_is_open(struct pvfs_state *pvfs, struct pvfs_filename *name)
+{
+ NTSTATUS status;
+ DATA_BLOB key;
+
+ status = pvfs_locking_key(name, name, &key);
+ if (!NT_STATUS_IS_OK(status)) {
+ return False;
+ }
+
+ return odb_is_open(pvfs->odb_context, &key);
+}
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
+ if (pvfs_is_open(pvfs, name)) {
+ return NT_STATUS_SHARING_VIOLATION;
+ }
+
dir = talloc_p(req, struct pvfs_dir);
if (dir == NULL) {
return NT_STATUS_NO_MEMORY;