summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2016-05-24 12:20:39 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2016-05-24 12:20:39 +1000
commitcace8acbbea275f9e1d7ed92c7489ff8ca8596d3 (patch)
tree0edea673be516a0200e61474e18e71518e7afc4f /src/include
parent2c16e4a8a669ee1aa22fbed2c7c4351c54fc74f1 (diff)
downloadmongo-cace8acbbea275f9e1d7ed92c7489ff8ca8596d3.tar.gz
WT-2630 Rename pluggable filesystem methods to avoid reserved names. (#2730)
* WT-2630 Rename pluggable filesystem methods to avoid reserved names. Use "fstr" consistently as the variable name and prefix for WT_FSTREAM.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/extern.h2
-rw-r--r--src/include/os.h7
-rw-r--r--src/include/os_fhandle.i29
-rw-r--r--src/include/os_fs.i17
-rw-r--r--src/include/os_fstream.i42
-rw-r--r--src/include/wiredtiger.in48
6 files changed, 74 insertions, 71 deletions
diff --git a/src/include/extern.h b/src/include/extern.h
index 53e49e51a26..f534785ebea 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -730,7 +730,7 @@ extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, b
extern int __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp);
extern int __wt_errno(void);
extern int __wt_filename(WT_SESSION_IMPL *session, const char *name, char **path);
-extern int __wt_fopen(WT_SESSION_IMPL *session, const char *name, uint32_t open_flags, uint32_t flags, WT_FSTREAM **fsp);
+extern int __wt_fopen(WT_SESSION_IMPL *session, const char *name, uint32_t open_flags, uint32_t flags, WT_FSTREAM **fstrp);
extern int __wt_get_vm_pagesize(void);
extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp);
extern int __wt_getlasterror(void);
diff --git a/src/include/os.h b/src/include/os.h
index bf60f32f764..1e08683bc83 100644
--- a/src/include/os.h
+++ b/src/include/os.h
@@ -141,7 +141,8 @@ struct __wt_fstream {
uint32_t flags;
int (*close)(WT_SESSION_IMPL *, WT_FSTREAM *);
- int (*flush)(WT_SESSION_IMPL *, WT_FSTREAM *);
- int (*getline)(WT_SESSION_IMPL *, WT_FSTREAM *, WT_ITEM *);
- int (*printf)(WT_SESSION_IMPL *, WT_FSTREAM *, const char *, va_list);
+ int (*fstr_flush)(WT_SESSION_IMPL *, WT_FSTREAM *);
+ int (*fstr_getline)(WT_SESSION_IMPL *, WT_FSTREAM *, WT_ITEM *);
+ int (*fstr_printf)(
+ WT_SESSION_IMPL *, WT_FSTREAM *, const char *, va_list);
};
diff --git a/src/include/os_fhandle.i b/src/include/os_fhandle.i
index 8d2cda4b305..cf790d6bc4d 100644
--- a/src/include/os_fhandle.i
+++ b/src/include/os_fhandle.i
@@ -22,11 +22,11 @@ __wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh, bool block)
handle = fh->handle;
if (block)
- return (handle->sync == NULL ? 0 :
- handle->sync(handle, (WT_SESSION *)session));
+ return (handle->fh_sync == NULL ? 0 :
+ handle->fh_sync(handle, (WT_SESSION *)session));
else
- return (handle->sync_nowait == NULL ? 0 :
- handle->sync_nowait(handle, (WT_SESSION *)session));
+ return (handle->fh_sync_nowait == NULL ? 0 :
+ handle->fh_sync_nowait(handle, (WT_SESSION *)session));
}
/*
@@ -55,14 +55,14 @@ __wt_fallocate(
* flavor, that failed, and we have to fallback to the locking flavor.
*/
handle = fh->handle;
- if (handle->fallocate_nolock != NULL) {
- if ((ret = handle->fallocate_nolock(
+ if (handle->fh_allocate_nolock != NULL) {
+ if ((ret = handle->fh_allocate_nolock(
handle, (WT_SESSION *)session, offset, len)) == 0)
return (0);
WT_RET_ERROR_OK(ret, ENOTSUP);
}
- if (handle->fallocate != NULL)
- return (handle->fallocate(
+ if (handle->fh_allocate != NULL)
+ return (handle->fh_allocate(
handle, (WT_SESSION *)session, offset, len));
return (ENOTSUP);
}
@@ -80,8 +80,8 @@ __wt_file_lock(WT_SESSION_IMPL * session, WT_FH *fh, bool lock)
"%s: handle-lock: %s", fh->handle->name, lock ? "lock" : "unlock"));
handle = fh->handle;
- return (handle->lock == NULL ? 0 :
- handle->lock(handle, (WT_SESSION*)session, lock));
+ return (handle->fh_lock == NULL ? 0 :
+ handle->fh_lock(handle, (WT_SESSION*)session, lock));
}
/*
@@ -98,7 +98,7 @@ __wt_read(
WT_STAT_FAST_CONN_INCR(session, read_io);
- return (fh->handle->read(
+ return (fh->handle->fh_read(
fh->handle, (WT_SESSION *)session, offset, len, buf));
}
@@ -112,7 +112,7 @@ __wt_filesize(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t *sizep)
WT_RET(__wt_verbose(
session, WT_VERB_HANDLEOPS, "%s: handle-size", fh->handle->name));
- return (fh->handle->size(fh->handle, (WT_SESSION *)session, sizep));
+ return (fh->handle->fh_size(fh->handle, (WT_SESSION *)session, sizep));
}
/*
@@ -128,7 +128,8 @@ __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len)
"%s: handle-truncate: %" PRIuMAX,
fh->handle->name, (uintmax_t)len));
- return (fh->handle->truncate(fh->handle, (WT_SESSION *)session, len));
+ return (fh->handle->fh_truncate(
+ fh->handle, (WT_SESSION *)session, len));
}
/*
@@ -149,6 +150,6 @@ __wt_write(WT_SESSION_IMPL *session,
WT_STAT_FAST_CONN_INCR(session, write_io);
- return (fh->handle->write(
+ return (fh->handle->fh_write(
fh->handle, (WT_SESSION *)session, offset, len, buf));
}
diff --git a/src/include/os_fs.i b/src/include/os_fs.i
index 151898711d8..88ee71d953a 100644
--- a/src/include/os_fs.i
+++ b/src/include/os_fs.i
@@ -30,7 +30,7 @@ __wt_fs_directory_list(WT_SESSION_IMPL *session,
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->directory_list(
+ ret = file_system->fs_directory_list(
file_system, wt_session, path, prefix, dirlistp, countp);
__wt_free(session, path);
@@ -52,7 +52,7 @@ __wt_fs_directory_list_free(
if (*dirlistp != NULL) {
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->directory_list_free(
+ ret = file_system->fs_directory_list_free(
file_system, wt_session, *dirlistp, count);
}
@@ -88,7 +88,7 @@ __wt_fs_directory_sync(WT_SESSION_IMPL *session, const char *name)
* needed.
*/
file_system = S2C(session)->file_system;
- if (file_system->directory_sync == NULL)
+ if (file_system->fs_directory_sync == NULL)
return (0);
copy = NULL;
@@ -109,7 +109,7 @@ __wt_fs_directory_sync(WT_SESSION_IMPL *session, const char *name)
}
wt_session = (WT_SESSION *)session;
- ret = file_system->directory_sync(file_system, wt_session, name);
+ ret = file_system->fs_directory_sync(file_system, wt_session, name);
__wt_free(session, copy);
return (ret);
@@ -133,7 +133,7 @@ __wt_fs_exist(WT_SESSION_IMPL *session, const char *name, bool *existp)
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->exist(file_system, wt_session, path, existp);
+ ret = file_system->fs_exist(file_system, wt_session, path, existp);
__wt_free(session, path);
return (ret);
@@ -169,7 +169,7 @@ __wt_fs_remove(WT_SESSION_IMPL *session, const char *name)
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->remove(file_system, wt_session, path);
+ ret = file_system->fs_remove(file_system, wt_session, path);
__wt_free(session, path);
return (ret);
@@ -211,7 +211,8 @@ __wt_fs_rename(WT_SESSION_IMPL *session, const char *from, const char *to)
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->rename(file_system, wt_session, from_path, to_path);
+ ret = file_system->fs_rename(
+ file_system, wt_session, from_path, to_path);
err: __wt_free(session, from_path);
__wt_free(session, to_path);
@@ -236,7 +237,7 @@ __wt_fs_size(WT_SESSION_IMPL *session, const char *name, wt_off_t *sizep)
file_system = S2C(session)->file_system;
wt_session = (WT_SESSION *)session;
- ret = file_system->size(file_system, wt_session, path, sizep);
+ ret = file_system->fs_size(file_system, wt_session, path, sizep);
__wt_free(session, path);
return (ret);
diff --git a/src/include/os_fstream.i b/src/include/os_fstream.i
index 37a6039d1b7..8c0fdadbdb0 100644
--- a/src/include/os_fstream.i
+++ b/src/include/os_fstream.i
@@ -11,9 +11,9 @@
* Get a line from a stream.
*/
static inline int
-__wt_getline(WT_SESSION_IMPL *session, WT_FSTREAM *fs, WT_ITEM *buf)
+__wt_getline(WT_SESSION_IMPL *session, WT_FSTREAM *fstr, WT_ITEM *buf)
{
- return (fs->getline(session, fs, buf));
+ return (fstr->fstr_getline(session, fstr, buf));
}
/*
@@ -21,14 +21,14 @@ __wt_getline(WT_SESSION_IMPL *session, WT_FSTREAM *fs, WT_ITEM *buf)
* Close a stream.
*/
static inline int
-__wt_fclose(WT_SESSION_IMPL *session, WT_FSTREAM **fsp)
+__wt_fclose(WT_SESSION_IMPL *session, WT_FSTREAM **fstrp)
{
- WT_FSTREAM *fs;
+ WT_FSTREAM *fstr;
- if ((fs = *fsp) == NULL)
+ if ((fstr = *fstrp) == NULL)
return (0);
- *fsp = NULL;
- return (fs->close(session, fs));
+ *fstrp = NULL;
+ return (fstr->close(session, fstr));
}
/*
@@ -36,9 +36,9 @@ __wt_fclose(WT_SESSION_IMPL *session, WT_FSTREAM **fsp)
* Flush a stream.
*/
static inline int
-__wt_fflush(WT_SESSION_IMPL *session, WT_FSTREAM *fs)
+__wt_fflush(WT_SESSION_IMPL *session, WT_FSTREAM *fstr)
{
- return (fs->flush(session, fs));
+ return (fstr->fstr_flush(session, fstr));
}
/*
@@ -47,12 +47,12 @@ __wt_fflush(WT_SESSION_IMPL *session, WT_FSTREAM *fs)
*/
static inline int
__wt_vfprintf(
- WT_SESSION_IMPL *session, WT_FSTREAM *fs, const char *fmt, va_list ap)
+ WT_SESSION_IMPL *session, WT_FSTREAM *fstr, const char *fmt, va_list ap)
{
WT_RET(__wt_verbose(
- session, WT_VERB_HANDLEOPS, "%s: handle-printf", fs->name));
+ session, WT_VERB_HANDLEOPS, "%s: handle-printf", fstr->name));
- return (fs->printf(session, fs, fmt, ap));
+ return (fstr->fstr_printf(session, fstr, fmt, ap));
}
/*
@@ -60,14 +60,14 @@ __wt_vfprintf(
* ANSI C fprintf.
*/
static inline int
-__wt_fprintf(WT_SESSION_IMPL *session, WT_FSTREAM *fs, const char *fmt, ...)
+__wt_fprintf(WT_SESSION_IMPL *session, WT_FSTREAM *fstr, const char *fmt, ...)
WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
WT_DECL_RET;
va_list ap;
va_start(ap, fmt);
- ret = __wt_vfprintf(session, fs, fmt, ap);
+ ret = __wt_vfprintf(session, fstr, fmt, ap);
va_end(ap);
return (ret);
@@ -79,18 +79,18 @@ __wt_fprintf(WT_SESSION_IMPL *session, WT_FSTREAM *fs, const char *fmt, ...)
*/
static inline int
__wt_sync_and_rename(WT_SESSION_IMPL *session,
- WT_FSTREAM **fsp, const char *from, const char *to)
+ WT_FSTREAM **fstrp, const char *from, const char *to)
{
WT_DECL_RET;
- WT_FSTREAM *fs;
+ WT_FSTREAM *fstr;
- fs = *fsp;
- *fsp = NULL;
+ fstr = *fstrp;
+ *fstrp = NULL;
/* Flush to disk and close the handle. */
- WT_TRET(__wt_fflush(session, fs));
- WT_TRET(__wt_fsync(session, fs->fh, true));
- WT_TRET(__wt_fclose(session, &fs));
+ WT_TRET(__wt_fflush(session, fstr));
+ WT_TRET(__wt_fsync(session, fstr->fh, true));
+ WT_TRET(__wt_fclose(session, &fstr));
WT_RET(ret);
return (__wt_rename_and_sync_directory(session, from, to));
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 4aef84f5f8c..243841c3227 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -3756,9 +3756,9 @@ struct __wt_file_system {
* directory.
* @param[out] countp the method the number of entries returned
*/
- int (*directory_list)(WT_FILE_SYSTEM *file_system, WT_SESSION *session,
- const char *directory, const char *prefix, char ***dirlist,
- uint32_t *countp);
+ int (*fs_directory_list)(WT_FILE_SYSTEM *file_system,
+ WT_SESSION *session, const char *directory, const char *prefix,
+ char ***dirlist, uint32_t *countp);
/*!
* Free memory allocated by WT_FILE_SYSTEM::directory_list.
@@ -3770,7 +3770,7 @@ struct __wt_file_system {
* @param dirlist array returned by WT_FILE_SYSTEM::directory_list
* @param count count returned by WT_FILE_SYSTEM::directory_list
*/
- int (*directory_list_free)(WT_FILE_SYSTEM *file_system,
+ int (*fs_directory_list_free)(WT_FILE_SYSTEM *file_system,
WT_SESSION *session, char **dirlist, uint32_t count);
/*!
@@ -3787,7 +3787,7 @@ struct __wt_file_system {
* @param session the current WiredTiger session
* @param directory the name of the directory
*/
- int (*directory_sync)(WT_FILE_SYSTEM *file_system,
+ int (*fs_directory_sync)(WT_FILE_SYSTEM *file_system,
WT_SESSION *session, const char *directory);
/*!
@@ -3800,7 +3800,7 @@ struct __wt_file_system {
* @param name the name of the file
* @param[out] existp If the named file system object exists
*/
- int (*exist)(WT_FILE_SYSTEM *file_system,
+ int (*fs_exist)(WT_FILE_SYSTEM *file_system,
WT_SESSION *session, const char *name, bool *existp);
/*!
@@ -3824,7 +3824,7 @@ struct __wt_file_system {
* with the WT_FILE_HANDLE:: structure should declare and allocate
* their own structure as a superset of a WT_FILE_HANDLE:: structure.
*/
- int (*open_file)(WT_FILE_SYSTEM *file_system, WT_SESSION *session,
+ int (*fs_open_file)(WT_FILE_SYSTEM *file_system, WT_SESSION *session,
const char *name, WT_OPEN_FILE_TYPE file_type, uint32_t flags,
WT_FILE_HANDLE **file_handlep);
@@ -3840,7 +3840,7 @@ struct __wt_file_system {
* @param session the current WiredTiger session
* @param name the name of the file system object
*/
- int (*remove)(
+ int (*fs_remove)(
WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name);
/*!
@@ -3856,7 +3856,7 @@ struct __wt_file_system {
* @param from the original name of the object
* @param to the new name for the object
*/
- int (*rename)(WT_FILE_SYSTEM *file_system,
+ int (*fs_rename)(WT_FILE_SYSTEM *file_system,
WT_SESSION *session, const char *from, const char *to);
/*!
@@ -3869,7 +3869,7 @@ struct __wt_file_system {
* @param name the name of the file system object
* @param[out] sizep the size of the file system entry
*/
- int (*size)(WT_FILE_SYSTEM *file_system,
+ int (*fs_size)(WT_FILE_SYSTEM *file_system,
WT_SESSION *session, const char *name, wt_off_t *sizep);
/*!
@@ -3938,7 +3938,7 @@ struct __wt_file_handle {
* @param advice one of ::WT_FILE_HANDLE_WILLNEED or
* ::WT_FILE_HANDLE_DONTNEED.
*/
- int (*fadvise)(WT_FILE_HANDLE *file_handle,
+ int (*fh_advise)(WT_FILE_HANDLE *file_handle,
WT_SESSION *session, wt_off_t offset, wt_off_t len, int advice);
/*!
@@ -3960,7 +3960,7 @@ struct __wt_file_handle {
* @param offset the file offset
* @param len the size of the advisory
*/
- int (*fallocate)(WT_FILE_HANDLE *file_handle,
+ int (*fh_allocate)(WT_FILE_HANDLE *file_handle,
WT_SESSION *session, wt_off_t, wt_off_t);
/*!
@@ -3982,7 +3982,7 @@ struct __wt_file_handle {
* @param offset the file offset
* @param len the size of the advisory
*/
- int (*fallocate_nolock)(WT_FILE_HANDLE *file_handle,
+ int (*fh_allocate_nolock)(WT_FILE_HANDLE *file_handle,
WT_SESSION *session, wt_off_t, wt_off_t);
/*!
@@ -3995,7 +3995,7 @@ struct __wt_file_handle {
* @param session the current WiredTiger session
* @param lock whether to lock or unlock
*/
- int (*lock)(
+ int (*fh_lock)(
WT_FILE_HANDLE *file_handle, WT_SESSION *session, bool lock);
/*!
@@ -4016,7 +4016,7 @@ struct __wt_file_handle {
* which can be optionally stored a pointer to an opaque cookie
* which is subsequently passed to WT_FILE_HANDLE::unmap.
*/
- int (*map)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
+ int (*fh_map)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
void *mapped_regionp, size_t *lengthp, void *mapped_cookiep);
/*!
@@ -4035,7 +4035,7 @@ struct __wt_file_handle {
* @param length the length of the mapped region to discard
* @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method
*/
- int (*map_discard)(WT_FILE_HANDLE *file_handle,
+ int (*fh_map_discard)(WT_FILE_HANDLE *file_handle,
WT_SESSION *session, void *map, size_t length, void *mapped_cookie);
/*!
@@ -4054,7 +4054,7 @@ struct __wt_file_handle {
* @param length the size of the mapped region to preload
* @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method
*/
- int (*map_preload)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
+ int (*fh_map_preload)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
const void *map, size_t length, void *mapped_cookie);
/*!
@@ -4072,7 +4072,7 @@ struct __wt_file_handle {
* @param length the length of the mapped region
* @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method
*/
- int (*unmap)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
+ int (*fh_unmap)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
void *mapped_region, size_t length, void *mapped_cookie);
/*!
@@ -4086,7 +4086,7 @@ struct __wt_file_handle {
* @param len the amount to read
* @param[out] buf buffer to hold the content read from file
*/
- int (*read)(WT_FILE_HANDLE *file_handle,
+ int (*fh_read)(WT_FILE_HANDLE *file_handle,
WT_SESSION *session, wt_off_t offset, size_t len, void *buf);
/*!
@@ -4098,7 +4098,7 @@ struct __wt_file_handle {
* @param session the current WiredTiger session
* @param sizep the size of the file
*/
- int (*size)(
+ int (*fh_size)(
WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t *sizep);
/*!
@@ -4113,7 +4113,7 @@ struct __wt_file_handle {
* @param file_handle the WT_FILE_HANDLE
* @param session the current WiredTiger session
*/
- int (*sync)(WT_FILE_HANDLE *file_handle, WT_SESSION *session);
+ int (*fh_sync)(WT_FILE_HANDLE *file_handle, WT_SESSION *session);
/*!
* Schedule the outstanding file writes required for durability and
@@ -4127,7 +4127,7 @@ struct __wt_file_handle {
* @param file_handle the WT_FILE_HANDLE
* @param session the current WiredTiger session
*/
- int (*sync_nowait)(WT_FILE_HANDLE *file_handle, WT_SESSION *session);
+ int (*fh_sync_nowait)(WT_FILE_HANDLE *file_handle, WT_SESSION *session);
/*!
* Lengthen or shorten a file to the specified length, based on the
@@ -4142,7 +4142,7 @@ struct __wt_file_handle {
* @param session the current WiredTiger session
* @param length desired file size after truncate
*/
- int (*truncate)(
+ int (*fh_truncate)(
WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t length);
/*!
@@ -4159,7 +4159,7 @@ struct __wt_file_handle {
* @param length amount of data to write
* @param buf content to be written to the file
*/
- int (*write)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
+ int (*fh_write)(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
wt_off_t offset, size_t length, const void *buf);
};
#endif /* !defined(SWIG) */