diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-17 02:55:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:57 -0500 |
commit | fef617c31bd4a8be09449d6bc726c729ae758423 (patch) | |
tree | 4951f62b04442e046f786b88e76dc48aac901e3f /source4/ntvfs/posix/pvfs_write.c | |
parent | f6da6a10de7d7f101f6485f4a34ef4ef5b6ab6c0 (diff) | |
download | samba-fef617c31bd4a8be09449d6bc726c729ae758423.tar.gz samba-fef617c31bd4a8be09449d6bc726c729ae758423.tar.bz2 samba-fef617c31bd4a8be09449d6bc726c729ae758423.zip |
r3012: added initial support for byte range locking in the posix vfs. This is
enough for us to pass locktest, but does not yet support lock timeouts
and some of the other esoteric features.
(This used to be commit 58a92abd88f190bc60894a68e0528e95ae33fe39)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_write.c')
-rw-r--r-- | source4/ntvfs/posix/pvfs_write.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c index a49f4fe947..80a3dae3a7 100644 --- a/source4/ntvfs/posix/pvfs_write.c +++ b/source4/ntvfs/posix/pvfs_write.c @@ -33,6 +33,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs, struct pvfs_state *pvfs = ntvfs->private_data; ssize_t ret; struct pvfs_file *f; + NTSTATUS status; switch (wr->generic.level) { case RAW_WRITE_WRITEX: @@ -40,6 +41,14 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs, if (!f) { return NT_STATUS_INVALID_HANDLE; } + status = pvfs_check_lock(pvfs, f, req->smbpid, + wr->writex.in.offset, + wr->writex.in.count, + WRITE_LOCK); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + ret = pwrite(f->fd, wr->writex.in.data, wr->writex.in.count, @@ -62,6 +71,14 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs, /* a truncate! */ ret = ftruncate(f->fd, wr->write.in.offset); } else { + status = pvfs_check_lock(pvfs, f, req->smbpid, + wr->write.in.offset, + wr->write.in.count, + WRITE_LOCK); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + ret = pwrite(f->fd, wr->write.in.data, wr->write.in.count, |