Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hpc
gekkofs
Commits
c1ad07f9
Commit
c1ad07f9
authored
May 18, 2022
by
Ramon Nou
Committed by
Ramon Nou
Jun 21, 2022
Browse files
Disable unused code - Remove statvfs (unused)
Check Parents
parent
72be2450
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/client/gkfs_functions.cpp
View file @
c1ad07f9
...
...
@@ -411,6 +411,7 @@ gkfs_statfs(struct statfs* buf) {
return
0
;
}
#ifdef ENABLE_UNUSED_FUNCTIONS
/**
* gkfs wrapper for statvfs() system calls
* errno may be set
...
...
@@ -444,6 +445,7 @@ gkfs_statvfs(struct statvfs* buf) {
ST_NOATIME
|
ST_NODIRATIME
|
ST_NOSUID
|
ST_NODEV
|
ST_SYNCHRONOUS
;
return
0
;
}
#endif
/**
* gkfs wrapper for lseek() system calls with available file descriptor
...
...
@@ -1094,7 +1096,7 @@ gkfs_getdents64(unsigned int fd, struct linux_dirent64* dirp,
#ifdef HAS_SYMLINKS
#ifdef ENABLE_UNUSED_FUNCTIONS
/**
* gkfs wrapper for make symlink() system calls
* errno may be set
...
...
@@ -1177,7 +1179,7 @@ gkfs_readlink(const std::string& path, char* buf, int bufsize) {
std
::
strcpy
(
buf
+
CTX
->
mountdir
().
size
(),
md
->
target_path
().
c_str
());
return
path_size
;
}
#endif
#endif
}
// namespace gkfs::syscall
...
...
tests/integration/coverage/test_error_operations.py
View file @
c1ad07f9
...
...
@@ -74,6 +74,10 @@ def test_open_error(gkfs_daemon, gkfs_client):
# Undefined in man
ret
=
gkfs_client
.
open
(
file2
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Truncate the file
ret
=
gkfs_client
.
open
(
file2
,
os
.
O_TRUNC
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Open unexistent file
...
...
@@ -125,18 +129,24 @@ def test_statfs(gkfs_daemon, gkfs_client):
assert
ret
.
statfsbuf
.
f_bavail
!=
0
assert
ret
.
statfsbuf
.
f_files
==
0
assert
ret
.
statfsbuf
.
f_ffree
==
0
def
test_check_parents
(
gkfs_daemon
,
gkfs_client
):
file
=
gkfs_daemon
.
mountdir
/
"dir"
/
"file"
file2
=
gkfs_daemon
.
mountdir
/
"file2"
file3
=
gkfs_daemon
.
mountdir
/
"file2"
/
"file3"
def
test_statvfs
(
gkfs_daemon
,
gkfs_client
):
# Statfs check most of the outputs
# Parent directory does not exist
ret
=
gkfs_client
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOENT
# Create file
ret
=
gkfs_client
.
open
(
file2
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Create file over a file
ret
=
gkfs_client
.
open
(
file3
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOTDIR
ret
=
gkfs_client
.
statvfs
(
gkfs_daemon
.
mountdir
)
assert
ret
.
retval
==
0
assert
ret
.
statvfsbuf
.
f_bsize
!=
0
assert
ret
.
statvfsbuf
.
f_blocks
!=
0
assert
ret
.
statvfsbuf
.
f_bfree
!=
0
assert
ret
.
statvfsbuf
.
f_bavail
!=
0
assert
ret
.
statvfsbuf
.
f_files
==
0
assert
ret
.
statvfsbuf
.
f_ffree
==
0
\ No newline at end of file
tests/integration/harness/CMakeLists.txt
View file @
c1ad07f9
...
...
@@ -65,7 +65,6 @@ add_executable(gkfs.io
gkfs.io/unlink.cpp
gkfs.io/access.cpp
gkfs.io/statfs.cpp
gkfs.io/statvfs.cpp
)
include
(
FetchContent
)
...
...
tests/integration/harness/gkfs.io/commands.hpp
View file @
c1ad07f9
...
...
@@ -102,9 +102,6 @@ access_init(CLI::App& app);
void
statfs_init
(
CLI
::
App
&
app
);
void
statvfs_init
(
CLI
::
App
&
app
);
// UTIL
void
file_compare_init
(
CLI
::
App
&
app
);
...
...
tests/integration/harness/gkfs.io/main.cpp
View file @
c1ad07f9
...
...
@@ -59,7 +59,6 @@ init_commands(CLI::App& app) {
truncate_init
(
app
);
access_init
(
app
);
statfs_init
(
app
);
statvfs_init
(
app
);
// utils
file_compare_init
(
app
);
chdir_init
(
app
);
...
...
tests/integration/harness/gkfs.io/serialize.hpp
View file @
c1ad07f9
...
...
@@ -188,22 +188,6 @@ struct adl_serializer<struct ::statfs> {
}
};
// ADL specialization for struct ::statvfs (not exhaustive) type
template
<
>
struct
adl_serializer
<
struct
::
statvfs
>
{
static
void
to_json
(
json
&
j
,
const
struct
::
statvfs
opt
)
{
j
=
json
{
{
"f_bsize"
,
opt
.
f_bsize
},
{
"f_blocks"
,
opt
.
f_blocks
},
{
"f_bfree"
,
opt
.
f_bfree
},
{
"f_bavail"
,
opt
.
f_bavail
},
{
"f_files"
,
opt
.
f_files
},
{
"f_ffree"
,
opt
.
f_ffree
},
{
"f_favail"
,
opt
.
f_favail
}};
}
};
#ifdef STATX_TYPE
// ADL specialization for struct ::statx type
template
<
>
...
...
tests/integration/harness/gkfs.io/statvfs.cpp
deleted
100644 → 0
View file @
72be2450
/*
Copyright 2018-2022, Barcelona Supercomputing Center (BSC), Spain
Copyright 2015-2022, Johannes Gutenberg Universitaet Mainz, Germany
This software was partially supported by the
EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).
This software was partially supported by the
ADA-FS project under the SPPEXA project funded by the DFG.
This file is part of GekkoFS.
GekkoFS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GekkoFS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GekkoFS. If not, see <https://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-3.0-or-later
*/
/* C++ includes */
#include
<CLI11/CLI11.hpp>
#include
<nlohmann/json.hpp>
#include
<memory>
#include
<fmt/format.h>
#include
<commands.hpp>
#include
<reflection.hpp>
#include
<serialize.hpp>
/* C includes */
#include
<sys/types.h>
#include
<sys/statvfs.h>
#include
<unistd.h>
using
json
=
nlohmann
::
json
;
struct
statvfs_options
{
bool
verbose
{};
std
::
string
pathname
;
REFL_DECL_STRUCT
(
statvfs_options
,
REFL_DECL_MEMBER
(
bool
,
verbose
),
REFL_DECL_MEMBER
(
std
::
string
,
pathname
));
};
struct
statvfs_output
{
int
retval
;
int
errnum
;
struct
::
statvfs
statvfsbuf
;
REFL_DECL_STRUCT
(
statvfs_output
,
REFL_DECL_MEMBER
(
int
,
retval
),
REFL_DECL_MEMBER
(
int
,
errnum
),
REFL_DECL_MEMBER
(
struct
::
statvfs
,
statvfsbuf
));
};
void
to_json
(
json
&
record
,
const
statvfs_output
&
out
)
{
record
=
serialize
(
out
);
}
void
statvfs_exec
(
const
statvfs_options
&
opts
)
{
struct
::
statvfs
statvfsbuf
;
auto
rv
=
::
statvfs
(
opts
.
pathname
.
c_str
(),
&
statvfsbuf
);
if
(
opts
.
verbose
)
{
fmt
::
print
(
"statvfs(pathname=
\"
{}
\"
) = {}, errno: {} [{}]
\n
"
,
opts
.
pathname
,
rv
,
errno
,
::
strerror
(
errno
));
return
;
}
json
out
=
statvfs_output
{
rv
,
errno
,
statvfsbuf
};
fmt
::
print
(
"{}
\n
"
,
out
.
dump
(
2
));
}
void
statvfs_init
(
CLI
::
App
&
app
)
{
// Create the option and subcommand objects
auto
opts
=
std
::
make_shared
<
statvfs_options
>
();
auto
*
cmd
=
app
.
add_subcommand
(
"statvfs"
,
"Execute the statvfs() system call"
);
// Add options to cmd, binding them to opts
cmd
->
add_flag
(
"-v,--verbose"
,
opts
->
verbose
,
"Produce human readable output"
);
cmd
->
add_option
(
"pathname"
,
opts
->
pathname
,
"Directory name"
)
->
required
()
->
type_name
(
""
);
cmd
->
callback
([
opts
]()
{
statvfs_exec
(
*
opts
);
});
}
tests/integration/harness/io.py
View file @
c1ad07f9
...
...
@@ -105,26 +105,6 @@ class StructStatfsSchema(Schema):
'f_bavail'
,
'f_files'
,
'f_ffree'
])(
**
data
)
class
StructStatvfsSchema
(
Schema
):
"""Schema that deserializes a struct statvfs"""
f_bsize
=
fields
.
Integer
(
required
=
True
)
f_blocks
=
fields
.
Integer
(
required
=
True
)
f_bfree
=
fields
.
Integer
(
required
=
True
)
f_bavail
=
fields
.
Integer
(
required
=
True
)
f_files
=
fields
.
Integer
(
required
=
True
)
f_ffree
=
fields
.
Integer
(
required
=
True
)
f_favail
=
fields
.
Integer
(
required
=
True
)
# f_fsid = fields.Integer(required=True)
# f_namelen = fields.Integer(required=True)
# f_frsize = fields.Integer(required=True)
# f_flags = fields.Integer(required=True)
@
post_load
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StructStatfs'
,
[
'f_bsize'
,
'f_blocks'
,
'f_bfree'
,
'f_bavail'
,
'f_files'
,
'f_ffree'
,
'f_favail'
])(
**
data
)
class
StructStatxTimestampSchema
(
Schema
):
"""Schema that deserializes a struct timespec"""
...
...
@@ -352,17 +332,6 @@ class StatfsOutputSchema(Schema):
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StatfsReturn'
,
[
'retval'
,
'statfsbuf'
,
'errno'
])(
**
data
)
class
StatvfsOutputSchema
(
Schema
):
"""Schema to deserialize the results of a statfs() execution"""
retval
=
fields
.
Integer
(
required
=
True
)
statvfsbuf
=
fields
.
Nested
(
StructStatvfsSchema
,
required
=
True
)
errno
=
Errno
(
data_key
=
'errnum'
,
required
=
True
)
@
post_load
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StatvfsReturn'
,
[
'retval'
,
'statvfsbuf'
,
'errno'
])(
**
data
)
class
LseekOutputSchema
(
Schema
):
"""Schema to deserialize the results of an lseek() execution"""
retval
=
fields
.
Integer
(
required
=
True
)
...
...
@@ -505,7 +474,6 @@ class IOParser:
'unlink'
:
UnlinkOutputSchema
(),
'access'
:
AccessOutputSchema
(),
'statfs'
:
StatfsOutputSchema
(),
'statvfs'
:
StatvfsOutputSchema
(),
# UTIL
'file_compare'
:
FileCompareOutputSchema
(),
'chdir'
:
ChdirOutputSchema
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment