Skip to content

Commit

Permalink
added 'filesize' parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
usrecnik committed Oct 10, 2017
1 parent f6cfc34 commit b1654bf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ Defines verbosity used for stdout messages. Default value is `INFO`.
Where to store temporary files - offline copies of DDL statements while their files are open.
`/tmp` location is used by default. All files created by **ddlfs** have names prefixed by `ddlfs-<PID>` in this folder.

**`filesize=`**`0`
All `.sql` files report file size as specified by this parameter - unless if file is currently open; correct file size
is always returned for currently open files. Usign default value `0` (or not specifying this parameter) should be OK for
most cases, however, some applications refuse to read files with zero length and only read files up to returned file size.
If you use such application with `ddlfs` specify this parameter to be greater than any database object (`10485760`, this
is 10mb, should be enough in most cases).

Tips for VIM
------------
Expand Down
10 changes: 10 additions & 0 deletions docs/ddlfs.man
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ Defines verbosity level used for stdout messages.
Where to store temporary files - offline copies of DDL statements while their files are open.
\fI/tmp\fR location is used by default. All files created by \fBddlfs\fR are prefixed by ddlfs-<PID> in this folder.

.TP
.BR filesize=\fI0\fR
All .sql files report file size as specified by this parameter - unless if file is currently open; correct file size
is always returned for currently open files. Usign default value 0 (or not specifying this parameter) should be OK for
most cases, however, some applications refuse to read files with zero length and only read files up to returned file size.
If you use such application with `ddlfs` specify this parameter to be greater than any database object (`10485760`,
this is 10mb, should be enough in most cases).




2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static struct fuse_opt ddlfs_opts[] = {
MYFS_OPT("schemas=%s", schemas, 1),
MYFS_OPT("loglevel=%s", loglevel, 1),
MYFS_OPT("temppath=%s", temppath, 1),
MYFS_OPT("filesize=%d", filesize, 1),
MYFS_OPT("lowercase", lowercase, 1),
MYFS_OPT("nolowercase", lowercase, 0),

Expand Down Expand Up @@ -95,6 +96,7 @@ struct fuse_args parse_arguments(int argc, char *argv[]) {
logmsg(LOG_DEBUG, ".. schemas : [%s]", g_conf.schemas);
logmsg(LOG_DEBUG, ".. lowercase: [%d]", g_conf.lowercase);
logmsg(LOG_DEBUG, ".. temppath : [%s]", g_conf.temppath);
logmsg(LOG_DEBUG, ".. filesize : [%d]", g_conf.filesize);
logmsg(LOG_DEBUG, ".");

return args;
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct s_global_config {
char *database;
char *schemas;
int lowercase;
int filesize;
char *loglevel;
} g_conf;

Expand Down
3 changes: 2 additions & 1 deletion src/fuse-impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ __asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#include "vfs.h"
#include "logging.h"
#include "query.h"
#include "config.h"
#include "fuse-impl.h"

#define DEPTH_SCHEMA 0
Expand Down Expand Up @@ -129,7 +130,7 @@ int fs_getattr( const char *path, struct stat *st )
}

struct stat tmp_st;
tmp_st.st_size = 0;
tmp_st.st_size = g_conf.filesize;

if (depth == DEPTH_MAX) {
char *fname;
Expand Down

0 comments on commit b1654bf

Please sign in to comment.