1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: Lift smbd_server_conn from file_find_dif

This commit is contained in:
Volker Lendecke 2010-09-27 04:00:31 +02:00
parent fb8686962a
commit b448e42de4
5 changed files with 9 additions and 7 deletions

View File

@ -4761,7 +4761,8 @@ struct files_struct *files_forall(
void *private_data),
void *private_data);
files_struct *file_find_fd(int fd);
files_struct *file_find_dif(struct file_id id, unsigned long gen_id);
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_next(files_struct *start_fsp);
bool file_find_subpath(files_struct *dir_fsp);

View File

@ -1117,7 +1117,7 @@ void msg_close_file(struct messaging_context *msg_ctx,
TALLOC_FREE(sm_str);
}
fsp = file_find_dif(e.id, e.share_file_id);
fsp = file_find_dif(smbd_server_conn, e.id, e.share_file_id);
if (!fsp) {
DEBUG(10,("msg_close_file: failed to find file.\n"));
return;

View File

@ -269,17 +269,18 @@ files_struct *file_find_fd(int fd)
Find a fsp given a device, inode and file_id.
****************************************************************************/
files_struct *file_find_dif(struct file_id id, unsigned long gen_id)
files_struct *file_find_dif(struct smbd_server_connection *sconn,
struct file_id id, unsigned long gen_id)
{
int count=0;
files_struct *fsp;
for (fsp=smbd_server_conn->files;fsp;fsp=fsp->next,count++) {
for (fsp=sconn->files; fsp; fsp=fsp->next,count++) {
/* We can have a fsp->fh->fd == -1 here as it could be a stat open. */
if (file_id_equal(&fsp->file_id, &id) &&
fsp->fh->gen_id == gen_id ) {
if (count > 10) {
DLIST_PROMOTE(smbd_server_conn->files, fsp);
DLIST_PROMOTE(sconn->files, fsp);
}
/* Paranoia check. */
if ((fsp->fh->fd == -1) &&

View File

@ -765,7 +765,7 @@ static void validate_my_share_entries(int num,
return;
}
fsp = file_find_dif(share_entry->id,
fsp = file_find_dif(smbd_server_conn, share_entry->id,
share_entry->share_file_id);
if (!fsp) {
DEBUG(0,("validate_my_share_entries: PANIC : %s\n",

View File

@ -273,7 +273,7 @@ static files_struct *initial_break_processing(struct file_id id, unsigned long f
* we have an oplock on it.
*/
fsp = file_find_dif(id, file_id);
fsp = file_find_dif(smbd_server_conn, id, file_id);
if(fsp == NULL) {
/* The file could have been closed in the meantime - return success. */