Skip to content

Commit

Permalink
Swap argument order for file names and initargs in rrd create
Browse files Browse the repository at this point in the history
  • Loading branch information
wingo committed Jun 13, 2018
1 parent bd216c2 commit 57b8c18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/README.rrd.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ following keys defined:
to be marked as known. Defaults to `0.5`, indicating that at least
half of corresponding PDPs must be marked as known.

— Function **rrd.create_file** *arg* *filename*
— Function **rrd.create_file** *filename* *arg*

Create a new round-robin database as if calling `rrd.new` on *arg*, and
then arrange for it to be mapped directly to *filename*. Any subsequent
update to the returned RRD database will be written to the file.

— Function **rrd.create_shm** *arg* *name*
— Function **rrd.create_shm** *name* *arg*

Like **rrd.create_file**, but determining the file name by passing
*name* to the `resolve` function of `core.shm`.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/rrd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function new(arg)
return open_mem(ptr, len)
end

function create_file(arg, filename)
function create_file(filename, arg)
local rrd = new(arg)
local fd = assert(S.open(filename, "creat, rdwr, excl", '0664'))
local f = file.fdopen(fd, 'wronly', filename)
Expand All @@ -286,10 +286,10 @@ function create_file(arg, filename)
return open_mem(ptr, rrd.size)
end

function create_shm(arg, name)
function create_shm(name, arg)
local path = shm.resolve(name)
shm.mkdir(lib.dirname(path))
return create_file(arg, shm.root..'/'..path)
return create_file(shm.root..'/'..path, name)
end

function dump(rrd, stream)
Expand Down

0 comments on commit 57b8c18

Please sign in to comment.