From 52cb05678a9b08b5aa7dbe13ae6b54ff9ee4ecac Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 10 Jun 2000 13:38:07 +0000 Subject: continued the split of the kernel level oplocks code into a more modular form. In this pass I added oplock_irix.c and added a "struct kernel_oplocks" that describes a kernel oplock implementation. (This used to be commit b5ceab810292602ea9a81696c20a781c16b706c2) --- source3/smbd/oplock_irix.c | 282 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 source3/smbd/oplock_irix.c (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c new file mode 100644 index 0000000000..0820c4048d --- /dev/null +++ b/source3/smbd/oplock_irix.c @@ -0,0 +1,282 @@ +#define OLD_NTDOMAIN 1 +#if HAVE_KERNEL_OPLOCKS_IRIX + +/* + Unix SMB/Netbios implementation. + Version 1.9. + oplock processing + Copyright (C) Andrew Tridgell 1992-1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +extern int DEBUGLEVEL; + + +static int oplock_pipe_write = -1; +static int oplock_pipe_read = -1; + +/**************************************************************************** +test to see if IRIX kernel oplocks work +****************************************************************************/ +static BOOL irix_oplocks_available(void) +{ + int fd; + int pfd[2]; + pstring tmpname; + + oplock_set_capability(True, False); + + slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), (int)sys_getpid()); + + if(pipe(pfd) != 0) { + DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error was %s\n", + strerror(errno) )); + return False; + } + + if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) { + DEBUG(0,("check_kernel_oplocks: Unable to open temp test file %s. Error was %s\n", + tmpname, strerror(errno) )); + unlink( tmpname ); + close(pfd[0]); + close(pfd[1]); + return False; + } + + unlink(tmpname); + + if(fcntl(fd, F_OPLKREG, pfd[1]) == -1) { + DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \ +Disabling kernel oplock support.\n" )); + close(pfd[0]); + close(pfd[1]); + close(fd); + return False; + } + + if(fcntl(fd, F_OPLKACK, OP_REVOKE) < 0 ) { + DEBUG(0,("check_kernel_oplocks: Error when removing kernel oplock. Error was %s. \ +Disabling kernel oplock support.\n", strerror(errno) )); + close(pfd[0]); + close(pfd[1]); + close(fd); + return False; + } + + close(pfd[0]); + close(pfd[1]); + close(fd); + + return True; +} + + + +/**************************************************************************** + * Deal with the IRIX kernel <--> smbd + * oplock break protocol. +****************************************************************************/ +static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_len) +{ + oplock_stat_t os; + SMB_DEV_T dev; + SMB_INO_T inode; + char dummy; + + /* + * Read one byte of zero to clear the + * kernel break notify message. + */ + + if(read(oplock_pipe_read, &dummy, 1) != 1) { + DEBUG(0,("receive_local_message: read of kernel notification failed. \ +Error was %s.\n", strerror(errno) )); + smb_read_error = READ_ERROR; + return False; + } + + /* + * Do a query to get the + * device and inode of the file that has the break + * request outstanding. + */ + + if(fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { + DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \ +Error was %s.\n", strerror(errno) )); + if(errno == EAGAIN) { + /* + * Duplicate kernel break message - ignore. + */ + memset(buffer, '\0', KERNEL_OPLOCK_BREAK_MSG_LEN); + return True; + } + smb_read_error = READ_ERROR; + return False; + } + + dev = (SMB_DEV_T)os.os_dev; + inode = (SMB_INO_T)os.os_ino; + + DEBUG(5,("receive_local_message: kernel oplock break request received for \ +dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode )); + + /* + * Create a kernel oplock break message. + */ + + /* Setup the message header */ + SIVAL(buffer,OPBRK_CMD_LEN_OFFSET,KERNEL_OPLOCK_BREAK_MSG_LEN); + SSVAL(buffer,OPBRK_CMD_PORT_OFFSET,0); + + buffer += OPBRK_CMD_HEADER_LEN; + + SSVAL(buffer,OPBRK_MESSAGE_CMD_OFFSET,KERNEL_OPLOCK_BREAK_CMD); + + memcpy(buffer + KERNEL_OPLOCK_BREAK_DEV_OFFSET, (char *)&dev, sizeof(dev)); + memcpy(buffer + KERNEL_OPLOCK_BREAK_INODE_OFFSET, (char *)&inode, sizeof(inode)); + + return True; +} + + +/**************************************************************************** + Attempt to set an kernel oplock on a file. +****************************************************************************/ +static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) +{ + if (fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) { + if(errno != EAGAIN) { + DEBUG(0,("set_file_oplock: Unable to get kernel oplock on file %s, dev = %x, \ +inode = %.0f. Error was %s\n", + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, + strerror(errno) )); + } else { + DEBUG(5,("set_file_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ +inode = %.0f. Another process had the file open.\n", + fsp->fsp_name, fsp->fd, (unsigned int)fsp->dev, (double)fsp->inode )); + } + return False; + } + + DEBUG(10,("set_file_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f\n", + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode)); + + return True; +} + + +/**************************************************************************** + Release a kernel oplock on a file. +****************************************************************************/ +static void irix_release_kernel_oplock(files_struct *fsp) +{ + if (DEBUGLVL(10)) { + /* + * Check and print out the current kernel + * oplock state of this file. + */ + int state = fcntl(fsp->fd, F_OPLKACK, -1); + dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f has kernel \ +oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, + (double)fsp->inode, state ); + } + + /* + * Remove the kernel oplock on this file. + */ + if(fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) { + if( DEBUGLVL( 0 )) { + dbgtext("release_kernel_oplock: Error when removing kernel oplock on file " ); + dbgtext("%s, dev = %x, inode = %.0f. Error was %s\n", + fsp->fsp_name, (unsigned int)fsp->dev, + (double)fsp->inode, strerror(errno) ); + } + } +} + + +/**************************************************************************** +parse a kernel oplock message +****************************************************************************/ +static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, SMB_INO_T *inode, SMB_DEV_T *dev) +{ + /* Ensure that the msg length is correct. */ + if(msg_len != KERNEL_OPLOCK_BREAK_MSG_LEN) { + DEBUG(0,("process_local_message: incorrect length for KERNEL_OPLOCK_BREAK_CMD (was %d, \ +should be %d).\n", msg_len, KERNEL_OPLOCK_BREAK_MSG_LEN)); + return False; + } + + memcpy((char *)inode, msg_start+KERNEL_OPLOCK_BREAK_INODE_OFFSET, sizeof(*inode)); + memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); + + DEBUG(5,("process_local_message: kernel oplock break request for \ +file dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode)); + + return True; +} + + +/**************************************************************************** +set *maxfd to include oplock read pipe +****************************************************************************/ +static BOOL irix_oplock_msg_waiting(fd_set *fds) +{ + if (oplock_pipe_read == -1) return False; + + return FD_ISSET(oplock_pipe_read,fds); +} + + +/**************************************************************************** +setup kernel oplocks +****************************************************************************/ +struct kernel_oplocks *irix_init_kernel_oplocks(void) +{ + int pfd[2]; + static struct kernel_oplocks koplocks; + + if (!irix_oplocks_available()) return NULL; + + if(pipe(pfd) != 0) { + DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. Error was %s\n", + strerror(errno) )); + return False; + } + + oplock_pipe_read = pfd[0]; + oplock_pipe_write = pfd[1]; + + koplocks.receive_message = irix_oplock_receive_message; + koplocks.set_oplock = irix_set_kernel_oplock; + koplocks.release_oplock = irix_release_kernel_oplock; + koplocks.parse_message = irix_kernel_oplock_parse; + koplocks.msg_waiting = irix_oplock_msg_waiting; + koplocks.notification_fd = oplock_pipe_read; + + return &koplocks; +} + + + +#else + void oplock_irix_dummy(void) {} +#endif /* HAVE_KERNEL_OPLOCKS_IRIX */ + +#undef OLD_NTDOMAIN -- cgit From 26848a3478ab132cd924f14a66f85f74c2433329 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 10 Jun 2000 14:29:31 +0000 Subject: a first pass at Linux kernel oplocks support (This used to be commit 3253085d9883a181c04b9c9ecf7d0ccdfbcee88d) --- source3/smbd/oplock_irix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 0820c4048d..6eb8ff9191 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -3,8 +3,8 @@ /* Unix SMB/Netbios implementation. - Version 1.9. - oplock processing + Version 2.x + IRIX kernel oplock processing Copyright (C) Andrew Tridgell 1992-1998 This program is free software; you can redistribute it and/or modify -- cgit From 8843a6379d7c1cf59f0f3673cbc567b09994b7d2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 11 Jun 2000 05:57:58 +0000 Subject: Linux kernel oplocks now seem to work, but need a _lot_ of testing I had to modify sys_select() to not loop on EINTR. I added a wrapper called sys_select_intr() which gives the old behaviour. (This used to be commit b28cc4163bc2faaa80c5782fc02c8f03c410cdeb) --- source3/smbd/oplock_irix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 6eb8ff9191..8d55a3d4a0 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -1,5 +1,4 @@ #define OLD_NTDOMAIN 1 -#if HAVE_KERNEL_OPLOCKS_IRIX /* Unix SMB/Netbios implementation. @@ -24,6 +23,7 @@ #include "includes.h" +#if HAVE_KERNEL_OPLOCKS_IRIX extern int DEBUGLEVEL; @@ -227,7 +227,7 @@ should be %d).\n", msg_len, KERNEL_OPLOCK_BREAK_MSG_LEN)); memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); DEBUG(5,("process_local_message: kernel oplock break request for \ -file dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode)); +file dev = %x, inode = %.0f\n", (unsigned int)*dev, (double)*inode)); return True; } -- cgit From b2d01bd2dbfed8b35cc324fad42eac562fcad3b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 12 Jun 2000 15:53:31 +0000 Subject: totally rewrote the async signal, notification and oplock notification handling in Samba. This was needed due to several limitations and races in the previous code - as a side effect the new code is much cleaner :) in summary: - changed sys_select() to avoid a signal/select race condition. It is a rare race but once we have signals doing notification and oplocks it is important. - changed our main processing loop to take advantage of the new sys_select semantics - split the notify code into implementaion dependent and general parts. Added the following structure that defines an implementation: struct cnotify_fns { void * (*register_notify)(connection_struct *conn, char *path, uint32 flags); BOOL (*check_notify)(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *data, time_t t); void (*remove_notify)(void *data); }; then I wrote two implementations, one using hash/poll (like our old code) and the other using the new Linux kernel change notify. It should be easy to add other change notify implementations by creating a sructure of the above type. - fixed a bug in change notify where we were returning the wrong error code. - rewrote the core change notify code to be much simpler - moved to real-time signals for leases and change notify Amazingly, it all seems to work. I was very surprised! (This used to be commit 44766c39e0027c762bee8b33b12c621c109a3267) --- source3/smbd/oplock_irix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 8d55a3d4a0..c4d528c835 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -218,16 +218,16 @@ static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, SMB_INO_T *in { /* Ensure that the msg length is correct. */ if(msg_len != KERNEL_OPLOCK_BREAK_MSG_LEN) { - DEBUG(0,("process_local_message: incorrect length for KERNEL_OPLOCK_BREAK_CMD (was %d, \ -should be %d).\n", msg_len, KERNEL_OPLOCK_BREAK_MSG_LEN)); + DEBUG(0,("incorrect length for KERNEL_OPLOCK_BREAK_CMD (was %d, should be %d).\n", + msg_len, KERNEL_OPLOCK_BREAK_MSG_LEN)); return False; } memcpy((char *)inode, msg_start+KERNEL_OPLOCK_BREAK_INODE_OFFSET, sizeof(*inode)); memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); - DEBUG(5,("process_local_message: kernel oplock break request for \ -file dev = %x, inode = %.0f\n", (unsigned int)*dev, (double)*inode)); + DEBUG(5,("kernel oplock break request for file dev = %x, inode = %.0f\n", + (unsigned int)*dev, (double)*inode)); return True; } -- cgit From a69d47640cb150fbffa12dee68ead34a5b1931bb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Jun 2000 00:32:32 +0000 Subject: Fixes for IRIX kernel oplocks and systems that don't have nss.h Jeremy. (This used to be commit 711f15ac230092bac000e63f99e8dfaa4a644847) --- source3/smbd/oplock_irix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index c4d528c835..cf1cbbb0fc 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -26,7 +26,6 @@ #if HAVE_KERNEL_OPLOCKS_IRIX extern int DEBUGLEVEL; - static int oplock_pipe_write = -1; static int oplock_pipe_read = -1; @@ -93,6 +92,7 @@ Disabling kernel oplock support.\n", strerror(errno) )); ****************************************************************************/ static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_len) { + extern int smb_read_error; oplock_stat_t os; SMB_DEV_T dev; SMB_INO_T inode; -- cgit From da3053048c3d224a20d6383ac6682d31059cd46c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 11 Mar 2001 00:32:10 +0000 Subject: Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549) --- source3/smbd/oplock_irix.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index cf1cbbb0fc..faf7e8e3c8 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -1,6 +1,4 @@ -#define OLD_NTDOMAIN 1 - -/* +/* Unix SMB/Netbios implementation. Version 2.x IRIX kernel oplock processing @@ -278,5 +276,3 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void) #else void oplock_irix_dummy(void) {} #endif /* HAVE_KERNEL_OPLOCKS_IRIX */ - -#undef OLD_NTDOMAIN -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/smbd/oplock_irix.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index faf7e8e3c8..c6055fc329 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -22,7 +22,6 @@ #include "includes.h" #if HAVE_KERNEL_OPLOCKS_IRIX -extern int DEBUGLEVEL; static int oplock_pipe_write = -1; static int oplock_pipe_read = -1; -- cgit From 88b55f47b4914f7d390939e4394ec3edd42be91f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 20 Oct 2001 21:59:34 +0000 Subject: Move from timestamp to gen count file id's for finding oplocked files in a tdb. Jeremy. (This used to be commit 058ae6b58f61ef46013dd076af3a84de5fbaaab1) --- source3/smbd/oplock_irix.c | 179 ++++++++++++++++++++++++--------------------- 1 file changed, 94 insertions(+), 85 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index c6055fc329..1052046175 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -27,8 +27,9 @@ static int oplock_pipe_write = -1; static int oplock_pipe_read = -1; /**************************************************************************** -test to see if IRIX kernel oplocks work + Test to see if IRIX kernel oplocks work. ****************************************************************************/ + static BOOL irix_oplocks_available(void) { int fd; @@ -81,106 +82,113 @@ Disabling kernel oplock support.\n", strerror(errno) )); return True; } - - /**************************************************************************** * Deal with the IRIX kernel <--> smbd * oplock break protocol. ****************************************************************************/ + static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_len) { extern int smb_read_error; - oplock_stat_t os; - SMB_DEV_T dev; - SMB_INO_T inode; - char dummy; - - /* - * Read one byte of zero to clear the - * kernel break notify message. - */ - - if(read(oplock_pipe_read, &dummy, 1) != 1) { - DEBUG(0,("receive_local_message: read of kernel notification failed. \ + oplock_stat_t os; + char dummy; + files_struct *fsp; + + /* + * Read one byte of zero to clear the + * kernel break notify message. + */ + + if(read(oplock_pipe_read, &dummy, 1) != 1) { + DEBUG(0,("receive_local_message: read of kernel notification failed. \ Error was %s.\n", strerror(errno) )); - smb_read_error = READ_ERROR; - return False; - } - - /* - * Do a query to get the - * device and inode of the file that has the break - * request outstanding. - */ - - if(fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { - DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \ + smb_read_error = READ_ERROR; + return False; + } + + /* + * Do a query to get the + * device and inode of the file that has the break + * request outstanding. + */ + + if(fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { + DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \ Error was %s.\n", strerror(errno) )); - if(errno == EAGAIN) { - /* - * Duplicate kernel break message - ignore. - */ - memset(buffer, '\0', KERNEL_OPLOCK_BREAK_MSG_LEN); - return True; - } - smb_read_error = READ_ERROR; - return False; - } - - dev = (SMB_DEV_T)os.os_dev; - inode = (SMB_INO_T)os.os_ino; - - DEBUG(5,("receive_local_message: kernel oplock break request received for \ -dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode )); - - /* - * Create a kernel oplock break message. - */ - - /* Setup the message header */ - SIVAL(buffer,OPBRK_CMD_LEN_OFFSET,KERNEL_OPLOCK_BREAK_MSG_LEN); - SSVAL(buffer,OPBRK_CMD_PORT_OFFSET,0); - - buffer += OPBRK_CMD_HEADER_LEN; + if(errno == EAGAIN) { + /* + * Duplicate kernel break message - ignore. + */ + memset(buffer, '\0', KERNEL_OPLOCK_BREAK_MSG_LEN); + return True; + } + smb_read_error = READ_ERROR; + return False; + } + + /* + * We only have device and inode info here - we have to guess that this + * is the first fsp open with this dev,ino pair. + */ + + if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, (SMB_INO_T)os.os_ino)) == NULL) { + DEBUG(0,("receive_local_message: unable to find open file with dev = %x, inode = %.0f\n", + (unsigned int)os.os_dev, (double)os.os_ino )); + return False; + } - SSVAL(buffer,OPBRK_MESSAGE_CMD_OFFSET,KERNEL_OPLOCK_BREAK_CMD); + DEBUG(5,("receive_local_message: kernel oplock break request received for \ +dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); - memcpy(buffer + KERNEL_OPLOCK_BREAK_DEV_OFFSET, (char *)&dev, sizeof(dev)); - memcpy(buffer + KERNEL_OPLOCK_BREAK_INODE_OFFSET, (char *)&inode, sizeof(inode)); + /* + * Create a kernel oplock break message. + */ + + /* Setup the message header */ + SIVAL(buffer,OPBRK_CMD_LEN_OFFSET,KERNEL_OPLOCK_BREAK_MSG_LEN); + SSVAL(buffer,OPBRK_CMD_PORT_OFFSET,0); + + buffer += OPBRK_CMD_HEADER_LEN; - return True; + SSVAL(buffer,OPBRK_MESSAGE_CMD_OFFSET,KERNEL_OPLOCK_BREAK_CMD); + + memcpy(buffer + KERNEL_OPLOCK_BREAK_DEV_OFFSET, (char *)&fsp->dev, sizeof(fsp->dev)); + memcpy(buffer + KERNEL_OPLOCK_BREAK_INODE_OFFSET, (char *)&fsp->inode, sizeof(fsp->inode)); + memcpy(buffer + KERNEL_OPLOCK_BREAK_FILEID_OFFSET, (char *)&fsp->file_id, sizeof(fsp->file_id)); + + return True; } - /**************************************************************************** Attempt to set an kernel oplock on a file. ****************************************************************************/ + static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) { if (fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { DEBUG(0,("set_file_oplock: Unable to get kernel oplock on file %s, dev = %x, \ -inode = %.0f. Error was %s\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, +inode = %.0f, file_id = %ul. Error was %s\n", + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, strerror(errno) )); } else { DEBUG(5,("set_file_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ -inode = %.0f. Another process had the file open.\n", - fsp->fsp_name, fsp->fd, (unsigned int)fsp->dev, (double)fsp->inode )); +inode = %.0f, file_id = %ul. Another process had the file open.\n", + fsp->fsp_name, fsp->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); } return False; } - DEBUG(10,("set_file_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode)); + DEBUG(10,("set_file_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f, file_id = %ul\n", + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id)); return True; } - /**************************************************************************** Release a kernel oplock on a file. ****************************************************************************/ + static void irix_release_kernel_oplock(files_struct *fsp) { if (DEBUGLVL(10)) { @@ -189,9 +197,9 @@ static void irix_release_kernel_oplock(files_struct *fsp) * oplock state of this file. */ int state = fcntl(fsp->fd, F_OPLKACK, -1); - dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f has kernel \ + dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, state ); + (double)fsp->inode, fsp->file_id, state ); } /* @@ -200,18 +208,19 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, if(fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) { if( DEBUGLVL( 0 )) { dbgtext("release_kernel_oplock: Error when removing kernel oplock on file " ); - dbgtext("%s, dev = %x, inode = %.0f. Error was %s\n", + dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, strerror(errno) ); + (double)fsp->inode, fsp->file_id, strerror(errno) ); } } } - /**************************************************************************** -parse a kernel oplock message + Parse a kernel oplock message. ****************************************************************************/ -static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, SMB_INO_T *inode, SMB_DEV_T *dev) + +static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, + SMB_INO_T *inode, SMB_DEV_T *dev, unsigned long *file_id) { /* Ensure that the msg length is correct. */ if(msg_len != KERNEL_OPLOCK_BREAK_MSG_LEN) { @@ -220,36 +229,39 @@ static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, SMB_INO_T *in return False; } - memcpy((char *)inode, msg_start+KERNEL_OPLOCK_BREAK_INODE_OFFSET, sizeof(*inode)); - memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); + memcpy((char *)inode, msg_start+KERNEL_OPLOCK_BREAK_INODE_OFFSET, sizeof(*inode)); + memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); + memcpy((char *)file_id, msg_start+KERNEL_OPLOCK_BREAK_FILEID_OFFSET, sizeof(*file_id)); - DEBUG(5,("kernel oplock break request for file dev = %x, inode = %.0f\n", - (unsigned int)*dev, (double)*inode)); + DEBUG(5,("kernel oplock break request for file dev = %x, inode = %.0f, file_id = %ul\n", + (unsigned int)*dev, (double)*inode, *file_id)); return True; } - /**************************************************************************** -set *maxfd to include oplock read pipe + Set *maxfd to include oplock read pipe. ****************************************************************************/ + static BOOL irix_oplock_msg_waiting(fd_set *fds) { - if (oplock_pipe_read == -1) return False; + if (oplock_pipe_read == -1) + return False; return FD_ISSET(oplock_pipe_read,fds); } - /**************************************************************************** -setup kernel oplocks + Setup kernel oplocks. ****************************************************************************/ + struct kernel_oplocks *irix_init_kernel_oplocks(void) { int pfd[2]; static struct kernel_oplocks koplocks; - if (!irix_oplocks_available()) return NULL; + if (!irix_oplocks_available()) + return NULL; if(pipe(pfd) != 0) { DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. Error was %s\n", @@ -269,9 +281,6 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void) return &koplocks; } - - - #else void oplock_irix_dummy(void) {} #endif /* HAVE_KERNEL_OPLOCKS_IRIX */ -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/smbd/oplock_irix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 1052046175..14f6de27c4 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 2.x + Unix SMB/CIFS implementation. IRIX kernel oplock processing Copyright (C) Andrew Tridgell 1992-1998 -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/smbd/oplock_irix.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 14f6de27c4..ffcf3d0af4 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -56,7 +56,7 @@ static BOOL irix_oplocks_available(void) unlink(tmpname); - if(fcntl(fd, F_OPLKREG, pfd[1]) == -1) { + if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) { DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \ Disabling kernel oplock support.\n" )); close(pfd[0]); @@ -65,7 +65,7 @@ Disabling kernel oplock support.\n" )); return False; } - if(fcntl(fd, F_OPLKACK, OP_REVOKE) < 0 ) { + if(sys_fcntl_long(fd, F_OPLKACK, OP_REVOKE) < 0 ) { DEBUG(0,("check_kernel_oplocks: Error when removing kernel oplock. Error was %s. \ Disabling kernel oplock support.\n", strerror(errno) )); close(pfd[0]); @@ -99,7 +99,7 @@ static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_le */ if(read(oplock_pipe_read, &dummy, 1) != 1) { - DEBUG(0,("receive_local_message: read of kernel notification failed. \ + DEBUG(0,("irix_oplock_receive_message: read of kernel notification failed. \ Error was %s.\n", strerror(errno) )); smb_read_error = READ_ERROR; return False; @@ -111,8 +111,8 @@ Error was %s.\n", strerror(errno) )); * request outstanding. */ - if(fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { - DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \ + if(sys_fcntl_ptr(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { + DEBUG(0,("irix_oplock_receive_message: fcntl of kernel notification failed. \ Error was %s.\n", strerror(errno) )); if(errno == EAGAIN) { /* @@ -131,12 +131,12 @@ Error was %s.\n", strerror(errno) )); */ if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, (SMB_INO_T)os.os_ino)) == NULL) { - DEBUG(0,("receive_local_message: unable to find open file with dev = %x, inode = %.0f\n", + DEBUG(0,("irix_oplock_receive_message: unable to find open file with dev = %x, inode = %.0f\n", (unsigned int)os.os_dev, (double)os.os_ino )); return False; } - DEBUG(5,("receive_local_message: kernel oplock break request received for \ + DEBUG(5,("irix_oplock_receive_message: kernel oplock break request received for \ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); /* @@ -164,21 +164,21 @@ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->i static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) { - if (fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) { + if (sys_fcntl_long(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { - DEBUG(0,("set_file_oplock: Unable to get kernel oplock on file %s, dev = %x, \ + DEBUG(0,("irix_set_kernel_oplock: Unable to get kernel oplock on file %s, dev = %x, \ inode = %.0f, file_id = %ul. Error was %s\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, strerror(errno) )); } else { - DEBUG(5,("set_file_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ + DEBUG(5,("irix_set_kernel_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ inode = %.0f, file_id = %ul. Another process had the file open.\n", fsp->fsp_name, fsp->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); } return False; } - DEBUG(10,("set_file_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f, file_id = %ul\n", + DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f, file_id = %ul\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id)); return True; @@ -195,8 +195,8 @@ static void irix_release_kernel_oplock(files_struct *fsp) * Check and print out the current kernel * oplock state of this file. */ - int state = fcntl(fsp->fd, F_OPLKACK, -1); - dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ + int state = sys_fcntl_long(fsp->fd, F_OPLKACK, -1); + dbgtext("irix_release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, state ); } @@ -204,9 +204,9 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, /* * Remove the kernel oplock on this file. */ - if(fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) { + if(sys_fcntl_long(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) { if( DEBUGLVL( 0 )) { - dbgtext("release_kernel_oplock: Error when removing kernel oplock on file " ); + dbgtext("irix_release_kernel_oplock: Error when removing kernel oplock on file " ); dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, strerror(errno) ); -- cgit From a32a7969c598b32c58fad4a7d1cb88cafb4a9e26 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 8 Jul 2005 07:54:28 +0000 Subject: r8231: Patch from James Peach to fix the IRIX build. Thanks, Volker (This used to be commit 1ebb3aa0d5007c470862e3adca92d2941ffa294c) --- source3/smbd/oplock_irix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index ffcf3d0af4..f4405a021e 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -164,7 +164,7 @@ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->i static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) { - if (sys_fcntl_long(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) { + if (sys_fcntl_long(fsp->fh->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { DEBUG(0,("irix_set_kernel_oplock: Unable to get kernel oplock on file %s, dev = %x, \ inode = %.0f, file_id = %ul. Error was %s\n", @@ -173,7 +173,7 @@ inode = %.0f, file_id = %ul. Error was %s\n", } else { DEBUG(5,("irix_set_kernel_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ inode = %.0f, file_id = %ul. Another process had the file open.\n", - fsp->fsp_name, fsp->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); + fsp->fsp_name, fsp->fh->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); } return False; } @@ -195,7 +195,7 @@ static void irix_release_kernel_oplock(files_struct *fsp) * Check and print out the current kernel * oplock state of this file. */ - int state = sys_fcntl_long(fsp->fd, F_OPLKACK, -1); + int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); dbgtext("irix_release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, state ); @@ -204,7 +204,7 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, /* * Remove the kernel oplock on this file. */ - if(sys_fcntl_long(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) { + if(sys_fcntl_long(fsp->fh->fd, F_OPLKACK, OP_REVOKE) < 0) { if( DEBUGLVL( 0 )) { dbgtext("irix_release_kernel_oplock: Error when removing kernel oplock on file " ); dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n", -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/smbd/oplock_irix.c | 51 +++++----------------------------------------- 1 file changed, 5 insertions(+), 46 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index f4405a021e..f49aa297e4 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -86,7 +86,7 @@ Disabling kernel oplock support.\n", strerror(errno) )); * oplock break protocol. ****************************************************************************/ -static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_len) +static files_struct *irix_oplock_receive_message(fd_set *fds) { extern int smb_read_error; oplock_stat_t os; @@ -102,7 +102,7 @@ static BOOL irix_oplock_receive_message(fd_set *fds, char *buffer, int buffer_le DEBUG(0,("irix_oplock_receive_message: read of kernel notification failed. \ Error was %s.\n", strerror(errno) )); smb_read_error = READ_ERROR; - return False; + return NULL; } /* @@ -122,7 +122,7 @@ Error was %s.\n", strerror(errno) )); return True; } smb_read_error = READ_ERROR; - return False; + return NULL; } /* @@ -138,24 +138,8 @@ Error was %s.\n", strerror(errno) )); DEBUG(5,("irix_oplock_receive_message: kernel oplock break request received for \ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); - - /* - * Create a kernel oplock break message. - */ - - /* Setup the message header */ - SIVAL(buffer,OPBRK_CMD_LEN_OFFSET,KERNEL_OPLOCK_BREAK_MSG_LEN); - SSVAL(buffer,OPBRK_CMD_PORT_OFFSET,0); - - buffer += OPBRK_CMD_HEADER_LEN; - - SSVAL(buffer,OPBRK_MESSAGE_CMD_OFFSET,KERNEL_OPLOCK_BREAK_CMD); - - memcpy(buffer + KERNEL_OPLOCK_BREAK_DEV_OFFSET, (char *)&fsp->dev, sizeof(fsp->dev)); - memcpy(buffer + KERNEL_OPLOCK_BREAK_INODE_OFFSET, (char *)&fsp->inode, sizeof(fsp->inode)); - memcpy(buffer + KERNEL_OPLOCK_BREAK_FILEID_OFFSET, (char *)&fsp->file_id, sizeof(fsp->file_id)); - - return True; + + return fsp; } /**************************************************************************** @@ -214,30 +198,6 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, } } -/**************************************************************************** - Parse a kernel oplock message. -****************************************************************************/ - -static BOOL irix_kernel_oplock_parse(char *msg_start, int msg_len, - SMB_INO_T *inode, SMB_DEV_T *dev, unsigned long *file_id) -{ - /* Ensure that the msg length is correct. */ - if(msg_len != KERNEL_OPLOCK_BREAK_MSG_LEN) { - DEBUG(0,("incorrect length for KERNEL_OPLOCK_BREAK_CMD (was %d, should be %d).\n", - msg_len, KERNEL_OPLOCK_BREAK_MSG_LEN)); - return False; - } - - memcpy((char *)inode, msg_start+KERNEL_OPLOCK_BREAK_INODE_OFFSET, sizeof(*inode)); - memcpy((char *)dev, msg_start+KERNEL_OPLOCK_BREAK_DEV_OFFSET, sizeof(*dev)); - memcpy((char *)file_id, msg_start+KERNEL_OPLOCK_BREAK_FILEID_OFFSET, sizeof(*file_id)); - - DEBUG(5,("kernel oplock break request for file dev = %x, inode = %.0f, file_id = %ul\n", - (unsigned int)*dev, (double)*inode, *file_id)); - - return True; -} - /**************************************************************************** Set *maxfd to include oplock read pipe. ****************************************************************************/ @@ -274,7 +234,6 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void) koplocks.receive_message = irix_oplock_receive_message; koplocks.set_oplock = irix_set_kernel_oplock; koplocks.release_oplock = irix_release_kernel_oplock; - koplocks.parse_message = irix_kernel_oplock_parse; koplocks.msg_waiting = irix_oplock_msg_waiting; koplocks.notification_fd = oplock_pipe_read; -- cgit From f3d7084bad17fe1d4745493cbf99faaaf5532ab4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 1 Oct 2005 10:00:07 +0000 Subject: r10672: Attempt to fix the IRIX build. James, could you test the Oplock code on a box? Thanks, Volker (This used to be commit 9fcf83dcd828515a6f6ac535cd47398b7e04e748) --- source3/smbd/oplock_irix.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index f49aa297e4..2224f9a668 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -99,8 +99,9 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) */ if(read(oplock_pipe_read, &dummy, 1) != 1) { - DEBUG(0,("irix_oplock_receive_message: read of kernel notification failed. \ -Error was %s.\n", strerror(errno) )); + DEBUG(0,("irix_oplock_receive_message: read of kernel " + "notification failed. Error was %s.\n", + strerror(errno) )); smb_read_error = READ_ERROR; return NULL; } @@ -112,14 +113,14 @@ Error was %s.\n", strerror(errno) )); */ if(sys_fcntl_ptr(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { - DEBUG(0,("irix_oplock_receive_message: fcntl of kernel notification failed. \ -Error was %s.\n", strerror(errno) )); + DEBUG(0,("irix_oplock_receive_message: fcntl of kernel " + "notification failed. Error was %s.\n", + strerror(errno) )); if(errno == EAGAIN) { /* * Duplicate kernel break message - ignore. */ - memset(buffer, '\0', KERNEL_OPLOCK_BREAK_MSG_LEN); - return True; + return NULL; } smb_read_error = READ_ERROR; return NULL; @@ -130,14 +131,17 @@ Error was %s.\n", strerror(errno) )); * is the first fsp open with this dev,ino pair. */ - if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, (SMB_INO_T)os.os_ino)) == NULL) { - DEBUG(0,("irix_oplock_receive_message: unable to find open file with dev = %x, inode = %.0f\n", - (unsigned int)os.os_dev, (double)os.os_ino )); - return False; + if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, + (SMB_INO_T)os.os_ino)) == NULL) { + DEBUG(0,("irix_oplock_receive_message: unable to find open " + "file with dev = %x, inode = %.0f\n", + (unsigned int)os.os_dev, (double)os.os_ino )); + return NULL; } - DEBUG(5,("irix_oplock_receive_message: kernel oplock break request received for \ -dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); + DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " + "received for dev = %x, inode = %.0f\n, file_id = %ul", + (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); return fsp; } -- cgit From 5c149702b0885db8d63f189f4bba0e17fdaad7a4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 14 Feb 2006 23:00:39 +0000 Subject: r13498: Fix the kernel oplocks code for IRIX. Should fix #3515. Jeremy. (This used to be commit 006cf9c3654e7f18e01b75a5fe87798df862d26a) --- source3/smbd/oplock_irix.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 2224f9a668..29bbb0f2ca 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -93,6 +93,9 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) char dummy; files_struct *fsp; + /* Ensure we only get one call per select fd set. */ + FD_CLR(fds, oplock_pipe_read); + /* * Read one byte of zero to clear the * kernel break notify message. @@ -204,14 +207,36 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, /**************************************************************************** Set *maxfd to include oplock read pipe. + Note that fds MAY BE NULL ! If so we must do our own select. ****************************************************************************/ static BOOL irix_oplock_msg_waiting(fd_set *fds) { + int maxfd, selrtn; + fd_set myfds; + struct timeval to; + if (oplock_pipe_read == -1) return False; - return FD_ISSET(oplock_pipe_read,fds); + if (fds) { + return FD_ISSET(oplock_pipe_read,fds); + } + + FD_ZERO(&myfds); + maxfd = setup_oplock_select_set(&myfds); + /* Only do the select if we have something to select *on*. */ + if (maxfd == 0) { + return False; + } + + /* Do a zero-time select. We just need to find out if there + * are any outstanding messages. We use sys_select_intr as + * we need to ignore any signals. */ + + to = timeval_set(0, 0); + selrtn = sys_select_intr(maxfd+1,&myfds,NULL,NULL,&to); + return (selrtn == 1) ? True : False; } /**************************************************************************** -- cgit From 0c0ce531a87f7e5f5a1a2980335322615a98c037 Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 15 Feb 2006 01:05:06 +0000 Subject: r13500: Fix ordering of FD_* arguments. (This used to be commit ed619421de024c44f5f05b3c03bb5311ce73830f) --- source3/smbd/oplock_irix.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 29bbb0f2ca..fa86211c7f 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -94,7 +94,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) files_struct *fsp; /* Ensure we only get one call per select fd set. */ - FD_CLR(fds, oplock_pipe_read); + FD_CLR(oplock_pipe_read, fds); /* * Read one byte of zero to clear the @@ -220,22 +220,18 @@ static BOOL irix_oplock_msg_waiting(fd_set *fds) return False; if (fds) { - return FD_ISSET(oplock_pipe_read,fds); - } - - FD_ZERO(&myfds); - maxfd = setup_oplock_select_set(&myfds); - /* Only do the select if we have something to select *on*. */ - if (maxfd == 0) { - return False; + return FD_ISSET(oplock_pipe_read, fds); } /* Do a zero-time select. We just need to find out if there * are any outstanding messages. We use sys_select_intr as * we need to ignore any signals. */ + FD_ZERO(&myfds); + FD_SET(oplock_pipe_read, &myfds); + to = timeval_set(0, 0); - selrtn = sys_select_intr(maxfd+1,&myfds,NULL,NULL,&to); + selrtn = sys_select_intr(oplock_pipe_read+1,&myfds,NULL,NULL,&to); return (selrtn == 1) ? True : False; } -- cgit From 447d49be9e42f05211cb77ddc5a8189329791ecf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 27 Feb 2006 18:48:33 +0000 Subject: r13724: Remove unused variable. Bug #3559 from jason@ncac.gwu.edu. Jeremy. (This used to be commit 0295ed3d5c3bb34ef29d01100a6156a754377930) --- source3/smbd/oplock_irix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index fa86211c7f..8f01438745 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -206,13 +206,13 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, } /**************************************************************************** - Set *maxfd to include oplock read pipe. + See if there is a message waiting in this fd set. Note that fds MAY BE NULL ! If so we must do our own select. ****************************************************************************/ static BOOL irix_oplock_msg_waiting(fd_set *fds) { - int maxfd, selrtn; + int selrtn; fd_set myfds; struct timeval to; -- cgit From 97ee5b1afa342eea40f973f5370c9f620c63bd01 Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 21 Mar 2006 02:56:49 +0000 Subject: r14600: Refactor capability interface from being IRIX-specific to using only the POSIX interface. Note that this removes support for inherited capabilities. This wasn't used, and probably should not be. (This used to be commit 763f4c01488a96aec000c18bca313da37ed1df1b) --- source3/smbd/oplock_irix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 8f01438745..83883444a7 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -35,7 +35,7 @@ static BOOL irix_oplocks_available(void) int pfd[2]; pstring tmpname; - oplock_set_capability(True, False); + set_effective_capability(KERNEL_OPLOCK_CAPABILITY); slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), (int)sys_getpid()); -- cgit From 5910e397d3f2d49c3ec13e064f402137205031a8 Mon Sep 17 00:00:00 2001 From: James Peach Date: Fri, 5 May 2006 02:06:37 +0000 Subject: r15446: Tidy up the formatting of locking debug messages and make it more consistent. Bring oplocks withing the purview of the locking debug channel. (This used to be commit e817cfd7d3a42d141198122eada58b5a7ba90e9c) --- source3/smbd/oplock_irix.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 83883444a7..73d582157d 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define DBGC_CLASS DBGC_LOCKING #include "includes.h" #if HAVE_KERNEL_OPLOCKS_IRIX -- cgit From cc9ea93456e594432e203e6d2d2f4dbcaac9a3dd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 17 May 2006 23:15:53 +0000 Subject: r15668: DOS or FCB opens share one share mode entry from different fsp pointers. Ensure we cope with this to pass Samba4 DENY tests (we used to pass these, there must have been a regression with newer code). We now pass them. Jeremy (This used to be commit fd6fa1d4eaf61783df74ee2da50d331477f06998) --- source3/smbd/oplock_irix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 73d582157d..248d902028 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -145,7 +145,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " "received for dev = %x, inode = %.0f\n, file_id = %ul", - (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); + (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id )); return fsp; } @@ -160,18 +160,18 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) if(errno != EAGAIN) { DEBUG(0,("irix_set_kernel_oplock: Unable to get kernel oplock on file %s, dev = %x, \ inode = %.0f, file_id = %ul. Error was %s\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id, + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id, strerror(errno) )); } else { DEBUG(5,("irix_set_kernel_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ inode = %.0f, file_id = %ul. Another process had the file open.\n", - fsp->fsp_name, fsp->fh->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id )); + fsp->fsp_name, fsp->fh->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id )); } return False; } DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f, file_id = %ul\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->file_id)); + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id)); return True; } @@ -190,7 +190,7 @@ static void irix_release_kernel_oplock(files_struct *fsp) int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); dbgtext("irix_release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->file_id, state ); + (double)fsp->inode, fsp->fh->file_id, state ); } /* @@ -201,7 +201,7 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, dbgtext("irix_release_kernel_oplock: Error when removing kernel oplock on file " ); dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->file_id, strerror(errno) ); + (double)fsp->inode, fsp->fh->file_id, strerror(errno) ); } } } -- cgit From 6914b29daa6700f0d4f1b93866074ce71f63a626 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Tue, 12 Dec 2006 20:15:47 +0000 Subject: r20131: get rid of a few no previous prototype warnings (This used to be commit e710a7d39a662a1a339f3f71c4b051fde1bb5a16) --- source3/smbd/oplock_irix.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 248d902028..b62975dd27 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -266,5 +266,6 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void) return &koplocks; } #else + void oplock_irix_dummy(void); void oplock_irix_dummy(void) {} #endif /* HAVE_KERNEL_OPLOCKS_IRIX */ -- cgit From def7b0bca194502832192270322c6232622ee48e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 16 Jan 2007 15:50:25 +0000 Subject: r20833: Reformatting (This used to be commit 2c2d5308a23df0b6b078bc647ad550c43b51ee1e) --- source3/smbd/oplock_irix.c | 64 +++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index b62975dd27..c1159cd73b 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -38,16 +38,19 @@ static BOOL irix_oplocks_available(void) set_effective_capability(KERNEL_OPLOCK_CAPABILITY); - slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), (int)sys_getpid()); + slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), + (int)sys_getpid()); if(pipe(pfd) != 0) { - DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error was %s\n", + DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error " + "was %s\n", strerror(errno) )); return False; } if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) { - DEBUG(0,("check_kernel_oplocks: Unable to open temp test file %s. Error was %s\n", + DEBUG(0,("check_kernel_oplocks: Unable to open temp test file " + "%s. Error was %s\n", tmpname, strerror(errno) )); unlink( tmpname ); close(pfd[0]); @@ -58,8 +61,9 @@ static BOOL irix_oplocks_available(void) unlink(tmpname); if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) { - DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \ -Disabling kernel oplock support.\n" )); + DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not " + "available on this machine. Disabling kernel oplock " + "support.\n" )); close(pfd[0]); close(pfd[1]); close(fd); @@ -67,8 +71,9 @@ Disabling kernel oplock support.\n" )); } if(sys_fcntl_long(fd, F_OPLKACK, OP_REVOKE) < 0 ) { - DEBUG(0,("check_kernel_oplocks: Error when removing kernel oplock. Error was %s. \ -Disabling kernel oplock support.\n", strerror(errno) )); + DEBUG(0,("check_kernel_oplocks: Error when removing kernel " + "oplock. Error was %s. Disabling kernel oplock " + "support.\n", strerror(errno) )); close(pfd[0]); close(pfd[1]); close(fd); @@ -145,7 +150,8 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " "received for dev = %x, inode = %.0f\n, file_id = %ul", - (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id )); + (unsigned int)fsp->dev, (double)fsp->inode, + fsp->fh->file_id )); return fsp; } @@ -158,20 +164,28 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) { if (sys_fcntl_long(fsp->fh->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { - DEBUG(0,("irix_set_kernel_oplock: Unable to get kernel oplock on file %s, dev = %x, \ -inode = %.0f, file_id = %ul. Error was %s\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id, + DEBUG(0,("irix_set_kernel_oplock: Unable to get " + "kernel oplock on file %s, dev = %x, inode " + "= %.0f, file_id = %ul. Error was %s\n", + fsp->fsp_name, (unsigned int)fsp->dev, + (double)fsp->inode, fsp->fh->file_id, strerror(errno) )); } else { - DEBUG(5,("irix_set_kernel_oplock: Refused oplock on file %s, fd = %d, dev = %x, \ -inode = %.0f, file_id = %ul. Another process had the file open.\n", - fsp->fsp_name, fsp->fh->fd, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id )); + DEBUG(5,("irix_set_kernel_oplock: Refused oplock on " + "file %s, fd = %d, dev = %x, inode = %.0f, " + "file_id = %ul. Another process had the file " + "open.\n", + fsp->fsp_name, fsp->fh->fd, + (unsigned int)fsp->dev, (double)fsp->inode, + fsp->fh->file_id )); } return False; } - DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev = %x, inode = %.0f, file_id = %ul\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id)); + DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev " + "= %x, inode = %.0f, file_id = %ul\n", + fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, + fsp->fh->file_id)); return True; } @@ -188,8 +202,9 @@ static void irix_release_kernel_oplock(files_struct *fsp) * oplock state of this file. */ int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); - dbgtext("irix_release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \ -oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, + dbgtext("irix_release_kernel_oplock: file %s, dev = %x, " + "inode = %.0f file_id = %ul, has kernel oplock state " + "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fh->file_id, state ); } @@ -198,10 +213,13 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, */ if(sys_fcntl_long(fsp->fh->fd, F_OPLKACK, OP_REVOKE) < 0) { if( DEBUGLVL( 0 )) { - dbgtext("irix_release_kernel_oplock: Error when removing kernel oplock on file " ); - dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n", + dbgtext("irix_release_kernel_oplock: Error when " + "removing kernel oplock on file " ); + dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. " + "Error was %s\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->fh->file_id, strerror(errno) ); + (double)fsp->inode, fsp->fh->file_id, + strerror(errno) ); } } } @@ -249,8 +267,8 @@ struct kernel_oplocks *irix_init_kernel_oplocks(void) return NULL; if(pipe(pfd) != 0) { - DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. Error was %s\n", - strerror(errno) )); + DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. " + "Error was %s\n", strerror(errno) )); return False; } -- cgit From e8156439f24137b5418baad20a7f00f6949cfe29 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 09:30:34 +0000 Subject: r23183: Check in a change made by Tridge: This replaces the internal explicit dev/ino file id representation by a "struct file_id". This is necessary as cluster file systems and NFS don't necessarily assign the same device number to the shared file system. With this structure in place we can now easily add different schemes to map a file to a unique 64-bit device node. Jeremy, you might note that I did not change the external interface of smb_share_modes.c. Volker (This used to be commit 9b10dbbd5de8813fc15ebbb6be9b18010ffe8139) --- source3/smbd/oplock_irix.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index c1159cd73b..1ac0cb4674 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -149,9 +149,9 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) } DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " - "received for dev = %x, inode = %.0f\n, file_id = %ul", - (unsigned int)fsp->dev, (double)fsp->inode, - fsp->fh->file_id )); + "received for file_id %s gen_id = %ul", + file_id_static_string(&fsp->file_id), + fsp->fh->gen_id )); return fsp; } @@ -165,27 +165,27 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) if (sys_fcntl_long(fsp->fh->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { DEBUG(0,("irix_set_kernel_oplock: Unable to get " - "kernel oplock on file %s, dev = %x, inode " - "= %.0f, file_id = %ul. Error was %s\n", - fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->fh->file_id, + "kernel oplock on file %s, file_id %s " + "gen_id = %ul. Error was %s\n", + fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fh->gen_id, strerror(errno) )); } else { DEBUG(5,("irix_set_kernel_oplock: Refused oplock on " - "file %s, fd = %d, dev = %x, inode = %.0f, " - "file_id = %ul. Another process had the file " + "file %s, fd = %d, file_id = 5s, " + "gen_id = %ul. Another process had the file " "open.\n", fsp->fsp_name, fsp->fh->fd, - (unsigned int)fsp->dev, (double)fsp->inode, - fsp->fh->file_id )); + file_id_static_string(&fsp->file_id), + fsp->fh->gen_id )); } return False; } - DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev " - "= %x, inode = %.0f, file_id = %ul\n", - fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, - fsp->fh->file_id)); + DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, file_id = %s " + "gen_id = %ul\n", + fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fh->gen_id)); return True; } @@ -202,10 +202,10 @@ static void irix_release_kernel_oplock(files_struct *fsp) * oplock state of this file. */ int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); - dbgtext("irix_release_kernel_oplock: file %s, dev = %x, " - "inode = %.0f file_id = %ul, has kernel oplock state " - "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->fh->file_id, state ); + dbgtext("irix_release_kernel_oplock: file %s, file_id = %s" + "gen_id = %ul, has kernel oplock state " + "of %x.\n", fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fh->gen_id, state ); } /* @@ -215,10 +215,10 @@ static void irix_release_kernel_oplock(files_struct *fsp) if( DEBUGLVL( 0 )) { dbgtext("irix_release_kernel_oplock: Error when " "removing kernel oplock on file " ); - dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. " + dbgtext("%s, file_id = %s gen_id = %ul. " "Error was %s\n", - fsp->fsp_name, (unsigned int)fsp->dev, - (double)fsp->inode, fsp->fh->file_id, + fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fh->gen_id, strerror(errno) ); } } -- cgit From fb76516ccd06bd5d2e013d07c4477e28df74962a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 10:48:42 +0000 Subject: r23185: Try to fix the IRIX build, also add the forgotten file_id.c in .26 (This used to be commit 5360e6405b170137e558fd0696ebd6030e0f5deb) --- source3/smbd/oplock_irix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 1ac0cb4674..eb0164ae50 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -140,8 +140,9 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) * is the first fsp open with this dev,ino pair. */ - if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, - (SMB_INO_T)os.os_ino)) == NULL) { + if ((fsp = file_find_di_first( + file_id_create((SMB_DEV_T)os.os_dev, + (SMB_INO_T)os.os_ino))) == NULL) { DEBUG(0,("irix_oplock_receive_message: unable to find open " "file with dev = %x, inode = %.0f\n", (unsigned int)os.os_dev, (double)os.os_ino )); -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/smbd/oplock_irix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index eb0164ae50..9cf387da6e 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/smbd/oplock_irix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 9cf387da6e..6f2dceeddc 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #define DBGC_CLASS DBGC_LOCKING -- cgit From 3e8fc031c8c28880657423de632172b2717f07a7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 7 Aug 2007 14:06:27 +0000 Subject: r24272: try to fix the build on irix... metze (This used to be commit dd7e94258b0fc0157d890d71f05c6fe16b6a2ea9) --- source3/smbd/oplock_irix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 6f2dceeddc..75f807f86b 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -96,6 +96,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) extern int smb_read_error; oplock_stat_t os; char dummy; + struct file_id fileid; files_struct *fsp; /* Ensure we only get one call per select fd set. */ @@ -137,11 +138,14 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) /* * We only have device and inode info here - we have to guess that this * is the first fsp open with this dev,ino pair. + * + * NOTE: this doesn't work if any VFS modules overloads + * the file_id_create() hook! */ - if ((fsp = file_find_di_first( - file_id_create((SMB_DEV_T)os.os_dev, - (SMB_INO_T)os.os_ino))) == NULL) { + fileid = file_id_create_dev((SMB_DEV_T)os.os_dev, + (SMB_INO_T)os.os_ino); + if ((fsp = file_find_di_first(fileid)) == NULL) { DEBUG(0,("irix_oplock_receive_message: unable to find open " "file with dev = %x, inode = %.0f\n", (unsigned int)os.os_dev, (double)os.os_ino )); -- cgit From 4ee8b2937d48308c6089fb539fdbd8625dfde360 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 10 Sep 2007 10:56:07 +0000 Subject: r25055: Add file_id_string_tos This removes file_id_string_static and file_id_string_static2 (This used to be commit 638c848c9afe374feb30e34c494f89b2a6c64f7b) --- source3/smbd/oplock_irix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 75f807f86b..dde32fa288 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -154,7 +154,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " "received for file_id %s gen_id = %ul", - file_id_static_string(&fsp->file_id), + file_id_string_tos(&fsp->file_id), fsp->fh->gen_id )); return fsp; @@ -171,7 +171,7 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) DEBUG(0,("irix_set_kernel_oplock: Unable to get " "kernel oplock on file %s, file_id %s " "gen_id = %ul. Error was %s\n", - fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fsp_name, file_id_string_tos(&fsp->file_id), fsp->fh->gen_id, strerror(errno) )); } else { @@ -180,7 +180,7 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) "gen_id = %ul. Another process had the file " "open.\n", fsp->fsp_name, fsp->fh->fd, - file_id_static_string(&fsp->file_id), + file_id_string_tos(&fsp->file_id), fsp->fh->gen_id )); } return False; @@ -188,7 +188,7 @@ static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, file_id = %s " "gen_id = %ul\n", - fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fsp_name, file_id_string_tos(&fsp->file_id), fsp->fh->gen_id)); return True; @@ -208,7 +208,7 @@ static void irix_release_kernel_oplock(files_struct *fsp) int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); dbgtext("irix_release_kernel_oplock: file %s, file_id = %s" "gen_id = %ul, has kernel oplock state " - "of %x.\n", fsp->fsp_name, file_id_static_string(&fsp->file_id), + "of %x.\n", fsp->fsp_name, file_id_string_tos(&fsp->file_id), fsp->fh->gen_id, state ); } @@ -221,7 +221,7 @@ static void irix_release_kernel_oplock(files_struct *fsp) "removing kernel oplock on file " ); dbgtext("%s, file_id = %s gen_id = %ul. " "Error was %s\n", - fsp->fsp_name, file_id_static_string(&fsp->file_id), + fsp->fsp_name, file_id_string_tos(&fsp->file_id), fsp->fh->gen_id, strerror(errno) ); } -- cgit From dd16ae2506abe46093118e2a33d9d0cae6455d07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 14 Sep 2007 01:07:57 +0000 Subject: r25141: More pstring removal. Jeremy. (This used to be commit cfcf7cf03e1be34e6839c1a659c4e8c1b5358c37) --- source3/smbd/oplock_irix.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index dde32fa288..9f81a960f5 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -33,17 +33,25 @@ static BOOL irix_oplocks_available(void) { int fd; int pfd[2]; - pstring tmpname; + TALLOC_CTX *ctx = talloc_stackframe(); + char *tmpname = NULL; set_effective_capability(KERNEL_OPLOCK_CAPABILITY); - slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), - (int)sys_getpid()); + tmpname = talloc_asprintf(ctx, + "%s/koplock.%d", + lp_lockdir(), + (int)sys_getpid()); + if (!tmpname) { + TALLOC_FREE(ctx); + return False; + } if(pipe(pfd) != 0) { DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error " "was %s\n", strerror(errno) )); + TALLOC_FREE(ctx); return False; } @@ -54,11 +62,14 @@ static BOOL irix_oplocks_available(void) unlink( tmpname ); close(pfd[0]); close(pfd[1]); + TALLOC_FREE(ctx); return False; } unlink(tmpname); + TALLOC_FREE(ctx); + if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) { DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not " "available on this machine. Disabling kernel oplock " -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/smbd/oplock_irix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 9f81a960f5..8dd4e27973 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -29,7 +29,7 @@ static int oplock_pipe_read = -1; Test to see if IRIX kernel oplocks work. ****************************************************************************/ -static BOOL irix_oplocks_available(void) +static bool irix_oplocks_available(void) { int fd; int pfd[2]; @@ -175,7 +175,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) Attempt to set an kernel oplock on a file. ****************************************************************************/ -static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type) +static bool irix_set_kernel_oplock(files_struct *fsp, int oplock_type) { if (sys_fcntl_long(fsp->fh->fd, F_OPLKREG, oplock_pipe_write) == -1) { if(errno != EAGAIN) { @@ -244,7 +244,7 @@ static void irix_release_kernel_oplock(files_struct *fsp) Note that fds MAY BE NULL ! If so we must do our own select. ****************************************************************************/ -static BOOL irix_oplock_msg_waiting(fd_set *fds) +static bool irix_oplock_msg_waiting(fd_set *fds) { int selrtn; fd_set myfds; -- cgit From 73d407968002587eadd0ff13eb413ddf07c78771 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 3 Nov 2007 15:12:42 -0700 Subject: Remove the smb_read_error global variable and replace it with accessor functions. "One global or pstring a day...." :-). Jeremy. (This used to be commit d50d14c300abc83b7015718ec48acc8b3227a273) --- source3/smbd/oplock_irix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 8dd4e27973..b8d49f03a1 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -104,7 +104,6 @@ static bool irix_oplocks_available(void) static files_struct *irix_oplock_receive_message(fd_set *fds) { - extern int smb_read_error; oplock_stat_t os; char dummy; struct file_id fileid; @@ -122,7 +121,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(0,("irix_oplock_receive_message: read of kernel " "notification failed. Error was %s.\n", strerror(errno) )); - smb_read_error = READ_ERROR; + set_smb_read_error(SMB_READ_ERROR); return NULL; } @@ -142,7 +141,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) */ return NULL; } - smb_read_error = READ_ERROR; + set_smb_read_error(SMB_READ_ERROR); return NULL; } -- cgit From 30a48a5c6c22484c6c06830e404242c1caa47d88 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 7 Nov 2007 22:28:26 +0100 Subject: Try to fix the build on irix. There were two callers of set_smb_read_error() in irix_oplocks.c not converted to the new prototype. Michael (This used to be commit e398a8d7b60127001d309c2fd0b1f13337f9b46d) --- source3/smbd/oplock_irix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index b8d49f03a1..a4ea63bc0a 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -121,7 +121,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(0,("irix_oplock_receive_message: read of kernel " "notification failed. Error was %s.\n", strerror(errno) )); - set_smb_read_error(SMB_READ_ERROR); + set_smb_read_error(get_srv_read_error(), SMB_READ_ERROR); return NULL; } @@ -141,7 +141,7 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) */ return NULL; } - set_smb_read_error(SMB_READ_ERROR); + set_smb_read_error(get_srv_read_error(), SMB_READ_ERROR); return NULL; } -- cgit From 88c27f83d449fa20cba47cbf0a5dbaedc99859d8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 25 Jan 2008 23:54:22 +0100 Subject: Convert receive_smb_raw to NTSTATUS (This used to be commit ba771bd858602452a9e58c3aab1336f2ac8a25ef) --- source3/smbd/oplock_irix.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index a4ea63bc0a..788cd04c17 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -121,7 +121,6 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) DEBUG(0,("irix_oplock_receive_message: read of kernel " "notification failed. Error was %s.\n", strerror(errno) )); - set_smb_read_error(get_srv_read_error(), SMB_READ_ERROR); return NULL; } @@ -141,7 +140,6 @@ static files_struct *irix_oplock_receive_message(fd_set *fds) */ return NULL; } - set_smb_read_error(get_srv_read_error(), SMB_READ_ERROR); return NULL; } -- cgit From 4a09c5a09f791738453947f07abe8d0f100fe53d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Jul 2008 15:39:41 -0700 Subject: Two more fixes from Jim Brown for SGI compiler warnings. Jeremy. (This used to be commit d85cbdbe296ec6de5bdbd66a90ca41345f55c837) --- source3/smbd/oplock_irix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/oplock_irix.c') diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c index 788cd04c17..8c287c9836 100644 --- a/source3/smbd/oplock_irix.c +++ b/source3/smbd/oplock_irix.c @@ -184,7 +184,7 @@ static bool irix_set_kernel_oplock(files_struct *fsp, int oplock_type) strerror(errno) )); } else { DEBUG(5,("irix_set_kernel_oplock: Refused oplock on " - "file %s, fd = %d, file_id = 5s, " + "file %s, fd = %d, file_id = %s, " "gen_id = %ul. Another process had the file " "open.\n", fsp->fsp_name, fsp->fh->fd, -- cgit