s3: Lift smbd_server_conn from file_find_di_first
authorVolker Lendecke <vl@samba.org>
Mon, 27 Sep 2010 02:05:25 +0000 (04:05 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 28 Sep 2010 05:36:17 +0000 (07:36 +0200)
source3/include/proto.h
source3/modules/vfs_acl_common.c
source3/smbd/files.c
source3/smbd/open.c
source3/smbd/reply.c
source3/smbd/trans2.c

index d70c823e20fe2603c42e75c1559dc045bbdd9b3e..a6ae87f887678fcda41399c61f870921a99afa8f 100644 (file)
@@ -4763,7 +4763,8 @@ struct files_struct *files_forall(
 files_struct *file_find_fd(int fd);
 files_struct *file_find_dif(struct smbd_server_connection *sconn,
                            struct file_id id, unsigned long gen_id);
-files_struct *file_find_di_first(struct file_id id);
+files_struct *file_find_di_first(struct smbd_server_connection *sconn,
+                                struct file_id id);
 files_struct *file_find_di_next(files_struct *start_fsp);
 bool file_find_subpath(files_struct *dir_fsp);
 void file_sync_all(connection_struct *conn);
index e759dc2df3f3b1e82d9b19229fe426c7733377b9..dbf3a09395174194f2b42022e500a628b4bc538b 100644 (file)
@@ -806,7 +806,8 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 
        /* Ensure we have this file open with DELETE access. */
        id = vfs_file_id_from_sbuf(conn, &local_fname.st);
-       for (fsp = file_find_di_first(id); fsp; file_find_di_next(fsp)) {
+       for (fsp = file_find_di_first(conn->sconn, id); fsp;
+            file_find_di_next(fsp)) {
                if (fsp->access_mask & DELETE_ACCESS &&
                                fsp->delete_on_close) {
                        /* We did open this for delete,
index 3f353a3eb2901b6dd36b70b4e635b4c9a2936d5d..98afd77bcc926a09a9a701b83d2024eaaa551a68 100644 (file)
@@ -308,7 +308,8 @@ files_struct *file_find_dif(struct smbd_server_connection *sconn,
  calls.
 ****************************************************************************/
 
-files_struct *file_find_di_first(struct file_id id)
+files_struct *file_find_di_first(struct smbd_server_connection *sconn,
+                                struct file_id id)
 {
        files_struct *fsp;
 
@@ -319,7 +320,7 @@ files_struct *file_find_di_first(struct file_id id)
 
        fsp_fi_cache.id = id;
 
-       for (fsp=smbd_server_conn->files;fsp;fsp=fsp->next) {
+       for (fsp=sconn->files;fsp;fsp=fsp->next) {
                if (file_id_equal(&fsp->file_id, &id)) {
                        /* Setup positive cache. */
                        fsp_fi_cache.fsp = fsp;
index 44de5a3cd0374eda1f4fbadff87b5f8fa5a9b993..00bee5b862d3f62cfec8e68a9ad7fbf4be80cb98 100644 (file)
@@ -1165,7 +1165,7 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req,
        DEBUG(5,("fcb_or_dos_open: attempting old open semantics for "
                 "file %s.\n", smb_fname_str_dbg(smb_fname)));
 
-       for(fsp = file_find_di_first(id); fsp;
+       for(fsp = file_find_di_first(conn->sconn, id); fsp;
            fsp = file_find_di_next(fsp)) {
 
                DEBUG(10,("fcb_or_dos_open: checking file %s, fd = %d, "
@@ -2773,7 +2773,8 @@ void msg_file_was_renamed(struct messaging_context *msg,
                sharepath, smb_fname_str_dbg(smb_fname),
                file_id_string_tos(&id)));
 
-       for(fsp = file_find_di_first(id); fsp; fsp = file_find_di_next(fsp)) {
+       for(fsp = file_find_di_first(smbd_server_conn, id); fsp;
+           fsp = file_find_di_next(fsp)) {
                if (memcmp(fsp->conn->connectpath, sharepath, sp_len) == 0) {
 
                        DEBUG(10,("msg_file_was_renamed: renaming file fnum %d from %s -> %s\n",
index 3b4ea09336e9092e6cd33a32514192cda15c750e..c84c077d581b968ab9f35987c9c70b351934cad5 100644 (file)
@@ -5793,7 +5793,7 @@ static void rename_open_files(connection_struct *conn,
        bool did_rename = False;
        NTSTATUS status;
 
-       for(fsp = file_find_di_first(lck->id); fsp;
+       for(fsp = file_find_di_first(conn->sconn, lck->id); fsp;
            fsp = file_find_di_next(fsp)) {
                /* fsp_name is a relative path under the fsp. To change this for other
                   sharepaths we need to manipulate relative paths. */
@@ -6068,7 +6068,8 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
        if (dst_exists) {
                struct file_id fileid = vfs_file_id_from_sbuf(conn,
                    &smb_fname_dst->st);
-               files_struct *dst_fsp = file_find_di_first(fileid);
+               files_struct *dst_fsp = file_find_di_first(conn->sconn,
+                                                          fileid);
                /* The file can be open when renaming a stream */
                if (dst_fsp && !new_is_stream) {
                        DEBUG(3, ("rename_internals_fsp: Target file open\n"));
index 304476476e6bbf96a8140dd7dfd7b9c23757f219..0888ded21af344b805fc5eb13aca893474f2adbc 100644 (file)
@@ -4314,7 +4314,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                /* Do we have this path open ? */
                files_struct *fsp1;
                struct file_id fileid = vfs_file_id_from_sbuf(conn, psbuf);
-               fsp1 = file_find_di_first(fileid);
+               fsp1 = file_find_di_first(conn->sconn, fileid);
                if (fsp1 && fsp1->initial_allocation_size) {
                        allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, fsp1, psbuf);
                }
@@ -6987,7 +6987,7 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn,
        }
 
        id = vfs_file_id_from_sbuf(conn, &sbuf);
-       for(all_fsps = file_find_di_first(id); all_fsps;
+       for(all_fsps = file_find_di_first(conn->sconn, id); all_fsps;
                        all_fsps = file_find_di_next(all_fsps)) {
                /*
                 * We're setting the time explicitly for UNIX.