Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
06b2e543
Commit
06b2e543
authored
Jul 09, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add file search by time given
parent
343b9c9b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
413 additions
and
30 deletions
+413
-30
camogm.c
camogm.c
+2
-2
camogm_read.c
camogm_read.c
+309
-28
index_list.c
index_list.c
+98
-0
index_list.h
index_list.h
+4
-0
No files found.
camogm.c
View file @
06b2e543
...
...
@@ -812,7 +812,7 @@ void camogm_set_prefix(camogm_state *state, const char * p, path_type type)
D0
(
fprintf
(
debug_file
,
"WARNING: raw device write initiated
\n
"
));
state
->
rawdev_op
=
1
;
/* debug code follows */
state
->
rawdev
.
end_pos
=
1
34217728
;
state
->
rawdev
.
end_pos
=
1
28
*
1048576
;
/* end of debug code */
}
}
...
...
@@ -1687,7 +1687,7 @@ int main(int argc, char *argv[])
"format and stores the result files.
\n\n
"
;
int
ret
;
int
opt
;
uint16_t
port_num
;
uint16_t
port_num
=
0
;
char
pipe_name_str
[
ELPHEL_PATH_MAX
]
=
{
0
};
if
((
argc
<
5
)
||
(
argv
[
1
][
1
]
==
'-'
))
{
...
...
camogm_read.c
View file @
06b2e543
This diff is collapsed.
Click to expand it.
index_list.c
View file @
06b2e543
...
...
@@ -17,6 +17,8 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "index_list.h"
...
...
@@ -61,6 +63,81 @@ int add_node(struct disk_idir *idir, struct disk_index *index)
return
idir
->
size
;
}
int
insert_node
(
struct
disk_idir
*
idir
,
struct
disk_index
*
indx
)
{
int
ret
=
0
;
struct
disk_index
*
node
;
if
(
idir
->
head
==
NULL
)
{
add_node
(
idir
,
indx
);
return
1
;
}
node
=
idir
->
head
;
while
(
node
!=
NULL
)
{
if
(
indx
->
rawtime
<
node
->
rawtime
)
{
ret
=
insert_prev
(
idir
,
node
,
indx
);
break
;
}
node
=
node
->
next
;
}
if
(
node
==
NULL
)
ret
=
insert_next
(
idir
,
idir
->
tail
,
indx
);
return
ret
;
}
/**
* @brief Insert new index to the list before the index specified. It means that new index will
* be inserted toward the head.
* @param[in,out] idir pointer to the lined list of indexes
* @param[in] parent pointer to the element before which the new element will be inserted
* @param[in] new_indx pointer to the element which will be inserted
* @return The number of nodes in the list
*/
int
insert_prev
(
struct
disk_idir
*
idir
,
struct
disk_index
*
parent
,
struct
disk_index
*
new_indx
)
{
if
(
parent
->
prev
!=
NULL
)
{
new_indx
->
next
=
parent
;
new_indx
->
prev
=
parent
->
prev
;
parent
->
prev
->
next
=
new_indx
;
parent
->
prev
=
new_indx
;
}
else
{
new_indx
->
next
=
parent
;
new_indx
->
prev
=
NULL
;
parent
->
prev
=
new_indx
;
idir
->
head
=
new_indx
;
}
idir
->
size
++
;
return
idir
->
size
;
}
/**
* @brief Insert new index to the list after the index specified. It means that new index will
* be inserted toward the tail.
* @param[in,out] idir pointer to the linked list of indexes
* @param[in] parent pointer to the element after which the new element will be inserted
* @param[in] new_indx pointer to the element which will be inserted
* @return The number of nodes in the list
*/
int
insert_next
(
struct
disk_idir
*
idir
,
struct
disk_index
*
parent
,
struct
disk_index
*
new_indx
)
{
if
(
parent
->
next
!=
NULL
)
{
new_indx
->
next
=
parent
->
next
;
new_indx
->
prev
=
parent
;
parent
->
next
->
prev
=
new_indx
;
parent
->
next
=
new_indx
;
}
else
{
new_indx
->
next
=
NULL
;
new_indx
->
prev
=
parent
;
parent
->
next
=
new_indx
;
idir
->
tail
=
new_indx
;
}
idir
->
size
++
;
return
idir
->
size
;
}
/**
* @brief Find index node by its start offset
* @param[in] idir pointer to disk index directory
...
...
@@ -80,6 +157,27 @@ struct disk_index *find_by_offset(const struct disk_idir *idir, uint64_t offset)
return
index
;
}
struct
disk_index
*
find_nearest_by_time
(
const
struct
disk_idir
*
idir
,
time_t
time
)
{
struct
disk_index
*
ptr
=
NULL
;
struct
disk_index
*
index
=
idir
->
head
;
if
(
idir
->
size
==
0
)
return
NULL
;
if
(
index
->
next
!=
NULL
)
ptr
=
index
->
next
;
else
return
index
;
while
(
index
!=
NULL
)
{
if
(
fabs
(
difftime
(
index
->
rawtime
,
time
))
<
fabs
(
difftime
(
ptr
->
rawtime
,
time
)))
ptr
=
index
;
index
=
index
->
next
;
}
return
ptr
;
}
/**
* @brief Remove a single index node from disk index directory
* @param[in,out] idir pointer to disk index directory
...
...
index_list.h
View file @
06b2e543
...
...
@@ -68,7 +68,11 @@ struct disk_idir {
void
dump_index_dir
(
const
struct
disk_idir
*
idir
);
int
create_node
(
struct
disk_index
**
index
);
int
add_node
(
struct
disk_idir
*
idir
,
struct
disk_index
*
index
);
int
insert_prev
(
struct
disk_idir
*
idir
,
struct
disk_index
*
parent
,
struct
disk_index
*
new_indx
);
int
insert_next
(
struct
disk_idir
*
idir
,
struct
disk_index
*
parent
,
struct
disk_index
*
new_indx
);
int
insert_node
(
struct
disk_idir
*
idir
,
struct
disk_index
*
indx
);
struct
disk_index
*
find_by_offset
(
const
struct
disk_idir
*
idir
,
uint64_t
offset
);
struct
disk_index
*
find_nearest_by_time
(
const
struct
disk_idir
*
idir
,
time_t
time
);
int
remove_node
(
struct
disk_idir
*
idir
,
struct
disk_index
*
node
);
int
delete_idir
(
struct
disk_idir
*
idir
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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