Skip to content

Commit

Permalink
Merge pull request #123 from garlick/reorg_source
Browse files Browse the repository at this point in the history
misc test cleanup and move diod to the src/cmd directory
  • Loading branch information
mergify[bot] authored Jan 16, 2025
2 parents 105a5c4 + b66c8a9 commit 597be9d
Show file tree
Hide file tree
Showing 53 changed files with 576 additions and 679 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ AC_CONFIG_FILES( \
Makefile \
diod.spec \
src/libtap/Makefile \
src/libtest/Makefile \
src/libdiod/Makefile \
src/liblsd/Makefile \
src/libnpfs/Makefile \
Expand All @@ -231,7 +232,6 @@ AC_CONFIG_FILES( \
man/diod.conf.5 \
etc/diod.service \
etc/auto.diod \
src/daemon/Makefile \
src/cmd/Makefile \
src/Makefile \
tests/Makefile \
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ sudo -n make -C src/libnpfs check TESTS="\
test_setgroups.t \
test_setreuid.t" || die "test failed"

sudo -n make -C src/daemon check TESTS="\
sudo -n make -C src/libdiod check TESTS="\
test_multiuser.t" || die "test failed"
4 changes: 2 additions & 2 deletions scripts/check-valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ TESTS="src/libnpfs/test_encoding.t \
src/libnpfs/test_fidpool.t \
src/libnpclient/test_simple.t \
src/libdiod/test_configfile.t \
src/daemon/test_read.t \
src/daemon/test_directory.t"
src/libdiod/test_read.t \
src/libdiod/test_directory.t"

exit_rc=0

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SUBDIRS = \
libtap \
libtest \
liblsd \
libnpfs \
libnpclient \
libdiod \
daemon \
cmd
5 changes: 4 additions & 1 deletion src/cmd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AM_CPPFLAGS = \
$(LUA_INCLUDE)
AM_CPPFLAGS += $(ncurses_CPPFLAGS)

sbin_PROGRAMS = diodcat dtop diodload diodls diodshowmount dioddate
sbin_PROGRAMS = diod diodcat dtop diodload diodls diodshowmount dioddate

if ENABLE_DIODMOUNT
sbin_PROGRAMS += diodmount
Expand All @@ -24,6 +24,9 @@ common_sources = \
opt.c \
opt.h

diod_LDADD = $(common_ldadd)
diod_SOURCES = diod.c $(common_sources)

diodmount_LDADD = $(common_ldadd)
diodmount_SOURCES = diodmount.c $(common_sources)

Expand Down
2 changes: 1 addition & 1 deletion src/daemon/diod.c → src/cmd/diod.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include "src/libdiod/diod_rdma.h"
#endif

#include "ops.h"
#include "src/libdiod/diod_ops.h"

#if USE_IMPERSONATION_GANESHA
#include "src/libnpfs/ganesha-syscalls.h"
Expand Down
4 changes: 4 additions & 0 deletions src/cmd/opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef CMD_OPT_H
#define CMD_OPT_H

typedef struct opt_struct *Opt;

Opt opt_create (void);
Expand All @@ -28,6 +31,7 @@ int opt_scanf (Opt o, const char *fmt, ...)

int opt_check_allowed_csv (Opt o, const char *s);

#endif

/*
* vi:tabstop=4 shiftwidth=4 expandtab
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef CMD_SAMPLE_H
#define CMD_SAMPLE_H

typedef struct sample_struct *sample_t;

sample_t sample_create (int stale_secs);
Expand All @@ -27,6 +30,8 @@ double sample_val (sample_t s, time_t tnow);
int sample_val_cmp (sample_t s1, sample_t s2, time_t tnow);
int sample_rate_cmp (sample_t s1, sample_t s2, time_t tnow);

#endif

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
74 changes: 0 additions & 74 deletions src/daemon/Makefile.am

This file was deleted.

31 changes: 30 additions & 1 deletion src/libdiod/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@ libdiod_a_SOURCES = \
diod_conf.h \
diod_sock.c \
diod_sock.h \
diod_fid.c \
diod_fid.h \
diod_ioctx.c \
diod_ioctx.h \
diod_xattr.c \
diod_xattr.h \
diod_exp.c \
diod_exp.h \
diod_ops.c \
diod_ops.h \
lsderr.c

if RDMATRANS
libdiod_a_SOURCES += diod_rdma.c diod_rdma.h
endif

test_ldadd = \
$(top_builddir)/src/libtest/libtest.a \
$(builddir)/libdiod.a \
$(top_builddir)/src/libnpclient/libnpclient.a \
$(top_builddir)/src/libnpfs/libnpfs.a \
Expand All @@ -30,10 +41,16 @@ test_ldadd = \
$(top_builddir)/src/libtap/libtap.a \
$(LUA_LIB) \
$(LIBCAP) \
$(LIBMUNGE) \
$(LIBWRAP) \
$(LIBPTHREAD)

TESTS = \
test_configfile.t
test_configfile.t \
test_threadwrlock.t \
test_read.t \
test_directory.t \
test_multiuser.t

check_PROGRAMS = $(TESTS)
TEST_EXTENSIONS = .t
Expand All @@ -42,3 +59,15 @@ T_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \

test_configfile_t_SOURCES = test/configfile.c
test_configfile_t_LDADD = $(test_ldadd)

test_threadwrlock_t_SOURCES = test/threadwrlock.c
test_threadwrlock_t_LDADD = $(test_ldadd)

test_read_t_SOURCES = test/read.c
test_read_t_LDADD = $(test_ldadd)

test_directory_t_SOURCES = test/directory.c
test_directory_t_LDADD = $(test_ldadd)

test_multiuser_t_SOURCES = test/multiuser.c
test_multiuser_t_LDADD = $(test_ldadd)
7 changes: 7 additions & 0 deletions src/libdiod/diod_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef _LIBDIOD_DIOD_AUTH_H
#define _LIBDIOD_DIOD_AUTH_H

#include "src/libnpfs/npfs.h"

extern Npauth *diod_auth_functions;

struct Npcfid;

int diod_auth (struct Npcfid *afid, u32 uid);

#endif
7 changes: 7 additions & 0 deletions src/libdiod/diod_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef LIBDIOD_DIOD_CONF_H
#define LIBDIOD_DIOD_CONF_H

#include "src/liblsd/list.h"

#define DFLT_DEBUGLEVEL 0
#define DFLT_NWTHREADS 16
#define DFLT_MAXMMAP 0
Expand Down Expand Up @@ -111,6 +116,8 @@ char *diod_conf_get_exportopts(void);
int diod_conf_opt_exportopts(void);
void diod_conf_set_exportopts(char *opts);

#endif

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
6 changes: 3 additions & 3 deletions src/daemon/exp.c → src/libdiod/diod_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#include "src/liblsd/list.h"
#include "src/liblsd/hostlist.h"

#include "src/libdiod/diod_conf.h"
#include "src/libdiod/diod_log.h"
#include "exp.h"
#include "diod_conf.h"
#include "diod_log.h"
#include "diod_exp.h"

static int
_match_export_users (Export *x, Npuser *user)
Expand Down
7 changes: 7 additions & 0 deletions src/daemon/exp.h → src/libdiod/diod_exp.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef LIBDIOD_DIOD_EXP_H
#define LIBDIOD_DIOD_EXP_H

#include "src/libnpfs/npfs.h"

int diod_fetch_xflags (Npstr *aname, int *xfp);
int diod_match_exports (char *path, Npconn *conn, Npuser *user, int *xfp);
char *diod_get_exports (char *name, void *a);

#endif
11 changes: 5 additions & 6 deletions src/daemon/fid.c → src/libdiod/diod_fid.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@
#include "src/liblsd/hash.h"
#include "src/liblsd/hostlist.h"

#include "src/libdiod/diod_conf.h"
#include "src/libdiod/diod_log.h"

#include "ioctx.h"
#include "xattr.h"
#include "fid.h"
#include "diod_conf.h"
#include "diod_log.h"
#include "diod_ioctx.h"
#include "diod_xattr.h"
#include "diod_fid.h"

/* Allocate local fid struct and attach to fid->aux.
*/
Expand Down
11 changes: 11 additions & 0 deletions src/daemon/fid.h → src/libdiod/diod_fid.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef LIBDIOD_DIOD_FID_H
#define LIBDIOD_DIOD_FID_H

#include "src/libnpfs/npfs.h"

#include "diod_xattr.h"
#include "diod_fid.h"
#include "diod_ioctx.h"

#define DIOD_FID_FLAGS_ROFS 0x01
#define DIOD_FID_FLAGS_MOUNTPT 0x02
#define DIOD_FID_FLAGS_SHAREFD 0x04
Expand All @@ -24,6 +33,8 @@ Fid *diod_fidalloc (Npfid *fid, Npstr *ns);
Fid *diod_fidclone (Npfid *newfid, Npfid *fid);
void diod_fiddestroy (Npfid *fid);

#endif

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
12 changes: 6 additions & 6 deletions src/daemon/ioctx.c → src/libdiod/diod_ioctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#include "src/liblsd/hostlist.h"
#include "src/libnpfs/xpthread.h"

#include "src/libdiod/diod_conf.h"
#include "src/libdiod/diod_log.h"
#include "diod_conf.h"
#include "diod_log.h"

#include "ioctx.h"
#include "xattr.h"
#include "fid.h"
#include "ops.h"
#include "diod_ioctx.h"
#include "diod_xattr.h"
#include "diod_fid.h"
#include "diod_ops.h"

typedef struct pathpool_struct *PathPool;

Expand Down
8 changes: 8 additions & 0 deletions src/daemon/ioctx.h → src/libdiod/diod_ioctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* SPDX-License-Identifier: GPL-2.0-or-later
\************************************************************/

#ifndef LIBDIOD_DIOD_IOCTX_H
#define LIBDIOD_DIOD_IOCTX_H

#include <sys/types.h>
#include "src/libnpfs/npfs.h"

typedef struct path_struct *Path;
typedef struct ioctx_struct *IOCtx;

Expand Down Expand Up @@ -45,6 +51,8 @@ int ioctx_utimes (IOCtx ioctx, const utimbuf *times);
u32 ioctx_iounit (IOCtx ioctx);
Npqid *ioctx_qid (IOCtx ioctx);

#endif

/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
Loading

0 comments on commit 597be9d

Please sign in to comment.