>From df688dc6d922ccc0edeb45faed06715c9309a793 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 21 Nov 2013 21:33:33 -0800 Subject: [PATCH] Rename the profile enums with a SAMBA_ prefix to avoid conflict with system files. WRITE_FLUSH is defined in fs.h in Linux. Signed-off-by: Jeremy Allison --- source3/include/smb.h | 18 +++++++++--------- source3/include/smbprofile.h | 2 +- source3/smbd/close.c | 2 +- source3/smbd/fileio.c | 26 +++++++++++++------------- source3/smbd/oplock.c | 2 +- source3/smbd/reply.c | 4 ++-- source3/smbd/vfs.c | 6 +++--- source3/utils/status_profile.c | 16 ++++++++-------- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index 52e1d7d..34900db 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -897,15 +897,15 @@ struct smb_extended_info { */ enum flush_reason_enum { - SEEK_FLUSH, - READ_FLUSH, - WRITE_FLUSH, - READRAW_FLUSH, - OPLOCK_RELEASE_FLUSH, - CLOSE_FLUSH, - SYNC_FLUSH, - SIZECHANGE_FLUSH, + SAMBA_SEEK_FLUSH, + SAMBA_READ_FLUSH, + SAMBA_WRITE_FLUSH, + SAMBA_READRAW_FLUSH, + SAMBA_OPLOCK_RELEASE_FLUSH, + SAMBA_CLOSE_FLUSH, + SAMBA_SYNC_FLUSH, + SAMBA_SIZECHANGE_FLUSH, /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */ - NUM_FLUSH_REASONS}; + SAMBA_NUM_FLUSH_REASONS}; #endif /* _SMB_H */ diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index 79410e5..8ecbc30 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -870,7 +870,7 @@ struct profile_stats { unsigned writecache_non_oplock_writes; unsigned writecache_direct_writes; unsigned writecache_init_writes; - unsigned writecache_flushed_writes[NUM_FLUSH_REASONS]; + unsigned writecache_flushed_writes[SAMBA_NUM_FLUSH_REASONS]; unsigned writecache_num_perfect_writes; unsigned writecache_num_write_caches; unsigned writecache_allocated_write_caches; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 6153066..02babb7 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -148,7 +148,7 @@ static NTSTATUS close_filestruct(files_struct *fsp) NTSTATUS status = NT_STATUS_OK; if (fsp->fh->fd != -1) { - if(flush_write_cache(fsp, CLOSE_FLUSH) == -1) { + if(flush_write_cache(fsp, SAMBA_CLOSE_FLUSH) == -1) { status = map_nt_error_from_unix(errno); } delete_write_cache(fsp); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 96eb24b..9ac4ae4 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -82,7 +82,7 @@ ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n) return n; } - flush_write_cache(fsp, READ_FLUSH); + flush_write_cache(fsp, SAMBA_READ_FLUSH); fsp->fh->pos = pos; @@ -379,13 +379,13 @@ nonop=%u allocated=%u active=%u direct=%u perfect=%u readhits=%u\n", profile_p->writecache_read_hits )); DEBUG(3,("WRITECACHE: Flushes SEEK=%d, READ=%d, WRITE=%d, READRAW=%d, OPLOCK=%d, CLOSE=%d, SYNC=%d\n", - profile_p->writecache_flushed_writes[SEEK_FLUSH], - profile_p->writecache_flushed_writes[READ_FLUSH], - profile_p->writecache_flushed_writes[WRITE_FLUSH], - profile_p->writecache_flushed_writes[READRAW_FLUSH], - profile_p->writecache_flushed_writes[OPLOCK_RELEASE_FLUSH], - profile_p->writecache_flushed_writes[CLOSE_FLUSH], - profile_p->writecache_flushed_writes[SYNC_FLUSH] )); + profile_p->writecache_flushed_writes[SAMBA_SEEK_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_READ_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_WRITE_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_READRAW_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_OPLOCK_RELEASE_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_CLOSE_FLUSH], + profile_p->writecache_flushed_writes[SAMBA_SYNC_FLUSH] )); } #endif @@ -393,7 +393,7 @@ nonop=%u allocated=%u active=%u direct=%u perfect=%u readhits=%u\n", /* If we're using receivefile don't * deal with a write cache. */ - flush_write_cache(fsp, WRITE_FLUSH); + flush_write_cache(fsp, SAMBA_WRITE_FLUSH); delete_write_cache(fsp); wcp = NULL; } @@ -689,7 +689,7 @@ nonop=%u allocated=%u active=%u direct=%u perfect=%u readhits=%u\n", +-----------------------+--------+ */ - flush_write_cache(fsp, WRITE_FLUSH); + flush_write_cache(fsp, SAMBA_WRITE_FLUSH); wcp->offset = wcp->file_size; wcp->data_size = pos - wcp->file_size + 1; memset(wcp->data, '\0', wcp->data_size); @@ -793,12 +793,12 @@ cache: fd = %d, off=%.0f, size=%u\n", fsp->fh->fd, (double)wcp->offset, (unsigne } if (cache_flush_needed) { - DEBUG(3,("WRITE_FLUSH:%d: due to noncontinuous write: fd = %d, size = %.0f, pos = %.0f, \ + DEBUG(3,("SAMBA_WRITE_FLUSH:%d: due to noncontinuous write: fd = %d, size = %.0f, pos = %.0f, \ n = %u, wcp->offset=%.0f, wcp->data_size=%u\n", write_path, fsp->fh->fd, (double)wcp->file_size, (double)pos, (unsigned int)n, (double)wcp->offset, (unsigned int)wcp->data_size )); - flush_write_cache(fsp, WRITE_FLUSH); + flush_write_cache(fsp, SAMBA_WRITE_FLUSH); } } @@ -1027,7 +1027,7 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug if (lp_strict_sync(SNUM(conn)) && (lp_syncalways(SNUM(conn)) || write_through)) { - int ret = flush_write_cache(fsp, SYNC_FLUSH); + int ret = flush_write_cache(fsp, SAMBA_SYNC_FLUSH); if (ret == -1) { return map_nt_error_from_unix(errno); } diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 312855d..02cd0bb 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -114,7 +114,7 @@ static void release_file_oplock(files_struct *fsp) fsp->oplock_type = NO_OPLOCK; fsp->sent_oplock_break = NO_BREAK_SENT; - flush_write_cache(fsp, OPLOCK_RELEASE_FLUSH); + flush_write_cache(fsp, SAMBA_OPLOCK_RELEASE_FLUSH); delete_write_cache(fsp); TALLOC_FREE(fsp->oplock_timeout); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b160290..ffbfabb 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3390,7 +3390,7 @@ void reply_readbraw(struct smb_request *req) return; } - flush_write_cache(fsp, READRAW_FLUSH); + flush_write_cache(fsp, SAMBA_READRAW_FLUSH); startpos = IVAL_TO_SMB_OFF_T(req->vwv+1, 0); if(req->wct == 10) { @@ -4888,7 +4888,7 @@ void reply_lseek(struct smb_request *req) return; } - flush_write_cache(fsp, SEEK_FLUSH); + flush_write_cache(fsp, SAMBA_SEEK_FLUSH); mode = SVAL(req->vwv+1, 0) & 3; /* NB. This doesn't use IVAL_TO_SMB_OFF_T as startpos can be signed in this case. */ diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index ca6500c..de0cc97 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -551,7 +551,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len) contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_SHRINK); - flush_write_cache(fsp, SIZECHANGE_FLUSH); + flush_write_cache(fsp, SAMBA_SIZECHANGE_FLUSH); if ((ret = SMB_VFS_FTRUNCATE(fsp, (off_t)len)) != -1) { set_filelen_write_cache(fsp, len); } @@ -616,7 +616,7 @@ int vfs_set_filelen(files_struct *fsp, off_t len) DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n", fsp_str_dbg(fsp), (double)len)); - flush_write_cache(fsp, SIZECHANGE_FLUSH); + flush_write_cache(fsp, SAMBA_SIZECHANGE_FLUSH); if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) { set_filelen_write_cache(fsp, len); notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED, @@ -705,7 +705,7 @@ int vfs_fill_sparse(files_struct *fsp, off_t len) contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_FILL_SPARSE); - flush_write_cache(fsp, SIZECHANGE_FLUSH); + flush_write_cache(fsp, SAMBA_SIZECHANGE_FLUSH); offset = fsp->fsp_name->st.st_ex_size; num_to_write = len - fsp->fsp_name->st.st_ex_size; diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c index 0f72219..0923bae 100644 --- a/source3/utils/status_profile.c +++ b/source3/utils/status_profile.c @@ -136,14 +136,14 @@ bool status_profile_dump(bool verbose) d_printf("non_oplock_writes: %u\n", profile_p->writecache_non_oplock_writes); d_printf("direct_writes: %u\n", profile_p->writecache_direct_writes); d_printf("init_writes: %u\n", profile_p->writecache_init_writes); - d_printf("flushed_writes[SEEK]: %u\n", profile_p->writecache_flushed_writes[SEEK_FLUSH]); - d_printf("flushed_writes[READ]: %u\n", profile_p->writecache_flushed_writes[READ_FLUSH]); - d_printf("flushed_writes[WRITE]: %u\n", profile_p->writecache_flushed_writes[WRITE_FLUSH]); - d_printf("flushed_writes[READRAW]: %u\n", profile_p->writecache_flushed_writes[READRAW_FLUSH]); - d_printf("flushed_writes[OPLOCK_RELEASE]: %u\n", profile_p->writecache_flushed_writes[OPLOCK_RELEASE_FLUSH]); - d_printf("flushed_writes[CLOSE]: %u\n", profile_p->writecache_flushed_writes[CLOSE_FLUSH]); - d_printf("flushed_writes[SYNC]: %u\n", profile_p->writecache_flushed_writes[SYNC_FLUSH]); - d_printf("flushed_writes[SIZECHANGE]: %u\n", profile_p->writecache_flushed_writes[SIZECHANGE_FLUSH]); + d_printf("flushed_writes[SEEK]: %u\n", profile_p->writecache_flushed_writes[SAMBA_SEEK_FLUSH]); + d_printf("flushed_writes[READ]: %u\n", profile_p->writecache_flushed_writes[SAMBA_READ_FLUSH]); + d_printf("flushed_writes[WRITE]: %u\n", profile_p->writecache_flushed_writes[SAMBA_WRITE_FLUSH]); + d_printf("flushed_writes[READRAW]: %u\n", profile_p->writecache_flushed_writes[SAMBA_READRAW_FLUSH]); + d_printf("flushed_writes[OPLOCK_RELEASE]: %u\n", profile_p->writecache_flushed_writes[SAMBA_OPLOCK_RELEASE_FLUSH]); + d_printf("flushed_writes[CLOSE]: %u\n", profile_p->writecache_flushed_writes[SAMBA_CLOSE_FLUSH]); + d_printf("flushed_writes[SYNC]: %u\n", profile_p->writecache_flushed_writes[SAMBA_SYNC_FLUSH]); + d_printf("flushed_writes[SIZECHANGE]: %u\n", profile_p->writecache_flushed_writes[SAMBA_SIZECHANGE_FLUSH]); d_printf("num_perfect_writes: %u\n", profile_p->writecache_num_perfect_writes); d_printf("num_write_caches: %u\n", profile_p->writecache_num_write_caches); d_printf("allocated_write_caches: %u\n", profile_p->writecache_allocated_write_caches); -- 1.7.9.5