diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-03-03 05:44:16 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-03-06 23:04:01 +0100 |
commit | 68b840726bdcb368b1cd8245c4089e5aa33dc386 (patch) | |
tree | eb353c72fabcdd2d68bd8b1ec839cf555e500d65 | |
parent | f6b6e963f65c39a0b34b5d23919c0c50e3e81168 (diff) | |
download | samba-68b840726bdcb368b1cd8245c4089e5aa33dc386.tar.gz samba-68b840726bdcb368b1cd8245c4089e5aa33dc386.tar.bz2 samba-68b840726bdcb368b1cd8245c4089e5aa33dc386.zip |
s3:smbd: keep 'num_files' and 'files' directly under smbd_server_connection
The plan is to have files_struct as some kind of low level
abstraction for a smb1/smb2 opens, that can be used by SMB_VFS modules.
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Mar 6 23:04:01 CET 2012 on sn-devel-104
-rw-r--r-- | source3/smbd/files.c | 14 | ||||
-rw-r--r-- | source3/smbd/globals.h | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 4a8967e964..10a0b8169d 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -105,7 +105,6 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn, sconn->first_file = (i+1) % (sconn->real_max_open_files); bitmap_set(sconn->file_bmap, i); - sconn->files_used += 1; fsp->fnum = i + FILE_HANDLE_OFFSET; SMB_ASSERT(fsp->fnum < 65536); @@ -123,9 +122,10 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn, } DLIST_ADD(sconn->files, fsp); + sconn->num_files += 1; - DEBUG(5,("allocated file structure %d, fnum = %d (%d used)\n", - i, fsp->fnum, sconn->files_used)); + DEBUG(5,("allocated file structure %d, fnum = %d (%u used)\n", + i, fsp->fnum, (unsigned int)sconn->num_files)); if (req != NULL) { req->chain_fsp = fsp; @@ -435,6 +435,8 @@ void file_free(struct smb_request *req, files_struct *fsp) struct smbd_server_connection *sconn = fsp->conn->sconn; DLIST_REMOVE(sconn->files, fsp); + SMB_ASSERT(sconn->num_files > 0); + sconn->num_files--; TALLOC_FREE(fsp->fake_file_handle); @@ -460,10 +462,8 @@ void file_free(struct smb_request *req, files_struct *fsp) TALLOC_FREE(fsp->update_write_time_event); bitmap_clear(sconn->file_bmap, fsp->fnum - FILE_HANDLE_OFFSET); - sconn->files_used--; - - DEBUG(5,("freed files structure %d (%d used)\n", - fsp->fnum, sconn->files_used)); + DEBUG(5,("freed files structure %d (%u used)\n", + fsp->fnum, (unsigned int)sconn->num_files)); fsp->conn->num_files_open--; diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index a47879fb0e..bfa649b98b 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -458,10 +458,11 @@ struct smbd_server_connection { size_t num_connections; struct connection_struct *connections; + size_t num_files; struct files_struct *files; + struct bitmap *file_bmap; int real_max_open_files; - int files_used; struct fsp_singleton_cache fsp_fi_cache; unsigned long file_gen_counter; int first_file; |