Ignore:
Timestamp:
Sep 30, 2007, 3:42:50 AM (18 years ago)
Author:
Paul Smedley
Message:

Update trunk to 3.2.0pre1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/smbd/oplock_irix.c

    r1 r77  
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    8    the Free Software Foundation; either version 2 of the License, or
     8   the Free Software Foundation; either version 3 of the License, or
    99   (at your option) any later version.
    1010   
     
    1515   
    1616   You should have received a copy of the GNU General Public License
    17    along with this program; if not, write to the Free Software
    18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     17   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1918*/
    2019
     
    3534        int fd;
    3635        int pfd[2];
    37         pstring tmpname;
     36        TALLOC_CTX *ctx = talloc_stackframe();
     37        char *tmpname = NULL;
    3838
    3939        set_effective_capability(KERNEL_OPLOCK_CAPABILITY);
    4040
    41         slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(),
    42                  (int)sys_getpid());
     41        tmpname = talloc_asprintf(ctx,
     42                                "%s/koplock.%d",
     43                                lp_lockdir(),
     44                                (int)sys_getpid());
     45        if (!tmpname) {
     46                TALLOC_FREE(ctx);
     47                return False;
     48        }
    4349
    4450        if(pipe(pfd) != 0) {
     
    4652                         "was %s\n",
    4753                         strerror(errno) ));
     54                TALLOC_FREE(ctx);
    4855                return False;
    4956        }
     
    5663                close(pfd[0]);
    5764                close(pfd[1]);
     65                TALLOC_FREE(ctx);
    5866                return False;
    5967        }
    6068
    6169        unlink(tmpname);
     70
     71        TALLOC_FREE(ctx);
    6272
    6373        if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) {
     
    98108        oplock_stat_t os;
    99109        char dummy;
     110        struct file_id fileid;
    100111        files_struct *fsp;
    101112
     
    139150         * We only have device and inode info here - we have to guess that this
    140151         * is the first fsp open with this dev,ino pair.
     152         *
     153         * NOTE: this doesn't work if any VFS modules overloads
     154         *       the file_id_create() hook!
    141155         */
    142156
    143         if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev,
    144                                       (SMB_INO_T)os.os_ino)) == NULL) {
     157        fileid = file_id_create_dev((SMB_DEV_T)os.os_dev,
     158                                    (SMB_INO_T)os.os_ino);
     159        if ((fsp = file_find_di_first(fileid)) == NULL) {
    145160                DEBUG(0,("irix_oplock_receive_message: unable to find open "
    146161                         "file with dev = %x, inode = %.0f\n",
     
    150165     
    151166        DEBUG(5,("irix_oplock_receive_message: kernel oplock break request "
    152                  "received for dev = %x, inode = %.0f\n, file_id = %ul",
    153                  (unsigned int)fsp->dev, (double)fsp->inode,
    154                  fsp->fh->file_id ));
     167                 "received for file_id %s gen_id = %ul",
     168                 file_id_string_tos(&fsp->file_id),
     169                 fsp->fh->gen_id ));
    155170
    156171        return fsp;
     
    166181                if(errno != EAGAIN) {
    167182                        DEBUG(0,("irix_set_kernel_oplock: Unable to get "
    168                                  "kernel oplock on file %s, dev = %x, inode "
    169                                  "= %.0f, file_id = %ul. Error was %s\n",
    170                                  fsp->fsp_name, (unsigned int)fsp->dev,
    171                                  (double)fsp->inode, fsp->fh->file_id,
     183                                 "kernel oplock on file %s, file_id %s "
     184                                 "gen_id = %ul. Error was %s\n",
     185                                 fsp->fsp_name, file_id_string_tos(&fsp->file_id),
     186                                 fsp->fh->gen_id,
    172187                                 strerror(errno) ));
    173188                } else {
    174189                        DEBUG(5,("irix_set_kernel_oplock: Refused oplock on "
    175                                  "file %s, fd = %d, dev = %x, inode = %.0f, "
    176                                  "file_id = %ul. Another process had the file "
     190                                 "file %s, fd = %d, file_id = 5s, "
     191                                 "gen_id = %ul. Another process had the file "
    177192                                 "open.\n",
    178193                                 fsp->fsp_name, fsp->fh->fd,
    179                                  (unsigned int)fsp->dev, (double)fsp->inode,
    180                                  fsp->fh->file_id ));
     194                                 file_id_string_tos(&fsp->file_id),
     195                                 fsp->fh->gen_id ));
    181196                }
    182197                return False;
    183198        }
    184199       
    185         DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev "
    186                   "= %x, inode = %.0f, file_id = %ul\n",
    187                   fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode,
    188                   fsp->fh->file_id));
     200        DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, file_id = %s "
     201                  "gen_id = %ul\n",
     202                  fsp->fsp_name, file_id_string_tos(&fsp->file_id),
     203                  fsp->fh->gen_id));
    189204
    190205        return True;
     
    203218                 */
    204219                int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1);
    205                 dbgtext("irix_release_kernel_oplock: file %s, dev = %x, "
    206                         "inode = %.0f file_id = %ul, has kernel oplock state "
    207                         "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
    208                         (double)fsp->inode, fsp->fh->file_id, state );
     220                dbgtext("irix_release_kernel_oplock: file %s, file_id = %s"
     221                        "gen_id = %ul, has kernel oplock state "
     222                        "of %x.\n", fsp->fsp_name, file_id_string_tos(&fsp->file_id),
     223                        fsp->fh->gen_id, state );
    209224        }
    210225
     
    216231                        dbgtext("irix_release_kernel_oplock: Error when "
    217232                                "removing kernel oplock on file " );
    218                         dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. "
     233                        dbgtext("%s, file_id = %s gen_id = %ul. "
    219234                                "Error was %s\n",
    220                                 fsp->fsp_name, (unsigned int)fsp->dev,
    221                                 (double)fsp->inode, fsp->fh->file_id,
     235                                fsp->fsp_name, file_id_string_tos(&fsp->file_id),
     236                                fsp->fh->gen_id,
    222237                                strerror(errno) );
    223238                }
Note: See TracChangeset for help on using the changeset viewer.