Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Open sidebar
admire
Hercules
Commits
e3566088
Commit
e3566088
authored
4 years ago
by
Mario Andres Serruya
Browse files
Options
Download
Email Patches
Plain Diff
Directory functionality tested
parent
a87f9545
master
Debug
malleability
memory
redis
temporal
ucx
workflow
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/CMakeLists.txt
+7
-32
app/CMakeLists.txt
app/dirr.c
+71
-0
app/dirr.c
inc/directory.h
+1
-1
inc/directory.h
with
79 additions
and
33 deletions
+79
-33
app/CMakeLists.txt
+
7
-
32
View file @
e3566088
set_source_files_properties
(
../src/comms.c ../src/crc.c ../src/directory.c ../src/hercules.c ../src/imss.c PROPERTIES LANGUAGE CXX
)
set_source_files_properties
(
../src/memalloc.c ../src/policies.c ../src/stat.c ../src/workers.c PROPERTIES LANGUAGE CXX
)
set_source_files_properties
(
./server.c ./release_imss.c PROPERTIES LANGUAGE CXX
)
set_source_files_properties
(
./dirr.c PROPERTIES LANGUAGE CXX
)
set_source_files_properties
(
collective_write.c PROPERTIES LANGUAGE CXX
)
set_source_files_properties
(
individual_write.c PROPERTIES LANGUAGE CXX
)
#set_source_files_properties(router_test.c PROPERTIES LANGUAGE CXX )
#find_package(PkgConfig)
#
#pkg_check_modules(PC_ZeroMQ QUIET zmq)
#
#find_path(ZeroMQ_INCLUDE_DIR
# NAMES zmq.hpp
# PATHS ${PC_ZeroMQ_INCLUDE_DIRS}
# )
#
#find_library(ZeroMQ_LIBRARY
# NAMES zmq
# PATHS ${PC_ZeroMQ_LIBRARY_DIRS}
# )
ADD_EXECUTABLE
(
server
./server.c
...
...
@@ -34,10 +17,6 @@ ADD_EXECUTABLE( release_imss
./release_imss.c
)
#ADD_EXECUTABLE( router_test
# ./router_test.c
#)
ADD_LIBRARY
(
imss SHARED
../src/crc.c
../src/stat.c
...
...
@@ -49,12 +28,10 @@ ADD_LIBRARY( imss SHARED
../src/directory.c
)
#ADD_EXECUTABLE( collective_write
# ./collective_write.c
#)
#ADD_EXECUTABLE( individual_write
# ./individual_write.c
#)
ADD_EXECUTABLE
(
dirr
./dirr.c
../src/directory.c
)
SET
(
IMSS_INC
"-I
${
CMAKE_SOURCE_DIR
}
/inc"
)
SET
(
IMSS_LIB
"-L
${
CMAKE_SOURCE_DIR
}
/build/app"
)
...
...
@@ -62,10 +39,8 @@ SET(IMSS_LIB "-L${CMAKE_SOURCE_DIR}/build/app")
target_include_directories
(
imss PUBLIC zmq
)
#${ZeroMQ_INCLUDE_DIR})
target_include_directories
(
server PUBLIC zmq
)
#${ZeroMQ_INCLUDE_DIR})
target_include_directories
(
release_imss PUBLIC zmq
)
#${ZeroMQ_INCLUDE_DIR})
#target_include_directories(router_test PUBLIC zmq ) #${ZeroMQ_INCLUDE_DIR})
TARGET_LINK_LIBRARIES
(
imss
${
CMAKE_THREAD_LIBS_INIT
}
zmq
${
MPI_LIBRARIES
}
${
GLIB_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
server
${
CMAKE_THREAD_LIBS_INIT
}
zmq
${
MPI_LIBRARIES
}
${
GLIB_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
dirr
${
GLIB_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
release_imss zmq
)
#TARGET_LINK_LIBRARIES(collective_write imss ${CMAKE_THREAD_LIBS_INIT} zmq ${MPI_LIBRARIES} ${GLIB_LIBRARIES} )
#TARGET_LINK_LIBRARIES(individual_write imss ${CMAKE_THREAD_LIBS_INIT} zmq ${MPI_LIBRARIES} ${GLIB_LIBRARIES} )
#TARGET_LINK_LIBRARIES(router_test zmq ${MPI_LIBRARIES} )
This diff is collapsed.
Click to expand it.
app/dirr.c
0 → 100644
+
71
-
0
View file @
e3566088
#include
<stdio.h>
#include
<stdlib.h>
#include
<sys/signal.h>
#include
"directory.h"
#define URI 256
int
num_nodes
;
extern
GNode
*
tree_root
;
char
**
uris
;
void
release
(
int
signal
)
{
g_node_traverse
(
tree_root
,
G_PRE_ORDER
,
G_TRAVERSE_ALL
,
-
1
,
gnodetraverse
,
NULL
);
free
(
uris
);
exit
(
0
);
}
int
main
()
{
//Create the tree_root node.
char
*
root_data
=
(
char
*
)
malloc
(
1
);
root_data
[
0
]
=
'/'
;
tree_root
=
g_node_new
((
void
*
)
root_data
);
printf
(
"Number of nodes to be introduced into the tree: "
);
scanf
(
"%d"
,
&
num_nodes
);
uris
=
(
char
**
)
malloc
(
sizeof
(
char
*
)
*
num_nodes
);
for
(
int
i
=
0
;
i
<
num_nodes
;
i
++
)
{
uris
[
i
]
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
URI
);
memset
(
uris
[
i
],
0
,
URI
);
printf
(
"Introduce element number %d: "
,
i
);
scanf
(
"%s"
,
uris
[
i
]);
}
signal
(
SIGINT
,
release
);
printf
(
"
\n
Elements introduced:
\n
"
);
for
(
int
i
=
0
;
i
<
num_nodes
;
i
++
)
{
GTree_insert
(
uris
[
i
]);
printf
(
"%d. %s
\n
"
,
i
,
uris
[
i
]);
}
printf
(
"
\n
"
);
while
(
1
)
{
char
request
[
URI
];
printf
(
"
\n
REQUEST AN ELEMENT: "
);
scanf
(
"%s"
,
&
request
);
printf
(
"Element requested: %s
\n
"
,
request
);
int
num_dir_elements
;
char
*
dir_elements
=
GTree_getdir
(
request
,
&
num_dir_elements
);
printf
(
"%d elements found inside it:
\n
"
,
num_dir_elements
);
for
(
int
i
=
0
;
i
<
num_dir_elements
;
i
++
)
printf
(
"%d. %s
\n
"
,
i
+
1
,
dir_elements
+
URI
*
i
);
free
(
dir_elements
);
}
return
0
;
}
This diff is collapsed.
Click to expand it.
inc/directory.h
+
1
-
1
View file @
e3566088
...
...
@@ -7,7 +7,7 @@
int32_t
GTree_search
(
GNode
*
parent_node
,
char
*
desired_data
,
GNode
**
found_node
);
//Method retrieving a buffer with all the files within a directory.
char
*
GTree_getdir
(
char
*
desired_dir
,
int32_t
*
numdir_elems
);
char
*
GTree_getdir
(
char
*
desired_dir
,
int32_t
*
numdir_elems
);
//Method inserting a new path.
int32_t
GTree_insert
(
char
*
desired_data
);
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets