summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-02-06 21:05:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:47 -0500
commit7a5fa7f12ec439ef5a4af29aa86498f799b6b9a5 (patch)
tree611c3787938bb8eb77a127a18a4932890ae2fd03 /source3/locking
parentc04068a42b230541559939004f33d72f1e76f075 (diff)
downloadsamba-7a5fa7f12ec439ef5a4af29aa86498f799b6b9a5.tar.gz
samba-7a5fa7f12ec439ef5a4af29aa86498f799b6b9a5.tar.bz2
samba-7a5fa7f12ec439ef5a4af29aa86498f799b6b9a5.zip
r21191: Add in the POSIX open/mkdir/unlink calls.
Move more error code returns to NTSTATUS. Client test code to follow... See if this passes the build-farm before I add it into 3.0.25. Jeremy. (This used to be commit 83dbbdff345fa9e427c9579183f4380004bf3dd7)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c9
-rw-r--r--source3/locking/posix.c14
2 files changed, 15 insertions, 8 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index d2e8b7ef59..39cc991b5f 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -81,7 +81,7 @@ BOOL is_locked(files_struct *fsp,
enum brl_type lock_type)
{
int strict_locking = lp_strict_locking(fsp->conn->params);
- enum brl_flavour lock_flav = lp_posix_cifsu_locktype();
+ enum brl_flavour lock_flav = lp_posix_cifsu_locktype(fsp);
BOOL ret = True;
if (count == 0) {
@@ -426,13 +426,14 @@ char *share_mode_str(int num, struct share_mode_entry *e)
slprintf(share_str, sizeof(share_str)-1, "share_mode_entry[%d]: %s "
"pid = %s, share_access = 0x%x, private_options = 0x%x, "
"access_mask = 0x%x, mid = 0x%x, type= 0x%x, file_id = %lu, "
- "uid = %u, dev = 0x%x, inode = %.0f",
+ "uid = %u, flags = %u, dev = 0x%x, inode = %.0f",
num,
e->op_type == UNUSED_SHARE_MODE_ENTRY ? "UNUSED" : "",
procid_str_static(&e->pid),
e->share_access, e->private_options,
e->access_mask, e->op_mid, e->op_type, e->share_file_id,
- (unsigned int)e->uid, (unsigned int)e->dev, (double)e->inode );
+ (unsigned int)e->uid, (unsigned int)e->flags,
+ (unsigned int)e->dev, (double)e->inode );
return share_str;
}
@@ -912,6 +913,7 @@ static void fill_share_mode_entry(struct share_mode_entry *e,
e->inode = fsp->inode;
e->share_file_id = fsp->fh->file_id;
e->uid = (uint32)uid;
+ e->flags = fsp->posix_open ? SHARE_MODE_FLAG_POSIX_OPEN : 0;
}
static void fill_deferred_open_entry(struct share_mode_entry *e,
@@ -927,6 +929,7 @@ static void fill_deferred_open_entry(struct share_mode_entry *e,
e->dev = dev;
e->inode = ino;
e->uid = (uint32)-1;
+ e->flags = 0;
}
static void add_share_mode_entry(struct share_mode_lock *lck,
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 806018da81..62804eb8e3 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -636,7 +636,7 @@ static size_t get_posix_pending_close_entries(files_struct *fsp, int **entries)
to delete all locks on this fsp before this function is called.
****************************************************************************/
-int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
+NTSTATUS fd_close_posix(struct connection_struct *conn, files_struct *fsp)
{
int saved_errno = 0;
int ret;
@@ -651,7 +651,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
*/
ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
fsp->fh->fd = -1;
- return ret;
+ return map_nt_error_from_unix(errno);
}
if (get_windows_lock_ref_count(fsp)) {
@@ -663,7 +663,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
add_fd_to_close_entry(fsp);
fsp->fh->fd = -1;
- return 0;
+ return NT_STATUS_OK;
}
/*
@@ -701,14 +701,18 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
ret = SMB_VFS_CLOSE(fsp,fsp->fh->fd);
- if (saved_errno != 0) {
+ if (ret == 0 && saved_errno != 0) {
errno = saved_errno;
ret = -1;
}
fsp->fh->fd = -1;
- return ret;
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ return NT_STATUS_OK;
}
/****************************************************************************