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
5762dc82
Commit
5762dc82
authored
Jul 01, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix errors in 'read_disk' command
parent
840f15d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
camogm_read.c
camogm_read.c
+10
-7
No files found.
camogm_read.c
View file @
5762dc82
...
@@ -939,16 +939,15 @@ void *reader(void *arg)
...
@@ -939,16 +939,15 @@ void *reader(void *arg)
dump_index_dir
(
&
index_dir
);
dump_index_dir
(
&
index_dir
);
break
;
break
;
case
CMD_READ_DISK
:
case
CMD_READ_DISK
:
// mmap raw device buffer in MMAP_CHUNK_SIZE chunks and send them over socket
mmap_range
.
from
=
rawdev
->
start_pos
&
PAGE_BOUNDARY_MASK
;
mmap_range
.
from
=
rawdev
->
start_pos
&
PAGE_BOUNDARY_MASK
;
mmap_range
.
to
=
rawdev
->
start_pos
+
rawdev
->
mmap_default_size
;
mmap_range
.
to
=
mmap_range
.
from
+
rawdev
->
mmap_default_size
;
disk_chunks
=
(
size_t
)
ceil
((
double
)(
rawdev
->
end_pos
-
rawdev
->
start_pos
)
/
(
double
)
rawdev
->
mmap_default_size
);
disk_chunks
=
(
size_t
)
ceil
((
double
)(
rawdev
->
end_pos
-
rawdev
->
start_pos
)
/
(
double
)
rawdev
->
mmap_default_size
);
transfer
=
true
;
transfer
=
true
;
mm_file_start
=
rawdev
->
start_pos
;
mm_file_start
=
rawdev
->
start_pos
;
mm_file_size
=
rawdev
->
mmap_default_size
;
mm_file_size
=
rawdev
->
mmap_default_size
-
rawdev
->
start_pos
;
fprintf
(
debug_file
,
"Retrieving %d chunks from disk
\n
"
,
disk_chunks
);
close
(
fd
);
close
(
fd
);
while
(
disk_chunks
>
0
&&
transfer
)
{
while
(
disk_chunks
>
0
&&
transfer
)
{
fprintf
(
debug_file
,
"Waiting for connection
\n
"
);
fd
=
accept
(
sockfd
,
NULL
,
0
);
fd
=
accept
(
sockfd
,
NULL
,
0
);
if
(
mmap_disk
(
rawdev
,
&
mmap_range
)
==
0
)
{
if
(
mmap_disk
(
rawdev
,
&
mmap_range
)
==
0
)
{
send_buffer
(
fd
,
&
rawdev
->
disk_mmap
[
mm_file_start
],
mm_file_size
);
send_buffer
(
fd
,
&
rawdev
->
disk_mmap
[
mm_file_start
],
mm_file_size
);
...
@@ -961,19 +960,23 @@ void *reader(void *arg)
...
@@ -961,19 +960,23 @@ void *reader(void *arg)
transfer
=
false
;
transfer
=
false
;
D0
(
fprintf
(
debug_file
,
"Unable to unmap memory region
\n
"
));
D0
(
fprintf
(
debug_file
,
"Unable to unmap memory region
\n
"
));
}
}
fprintf
(
debug_file
,
"%d disk chunks left to send
\n
"
,
disk_chunks
);
mm_file_start
=
0
;
mm_file_start
=
0
;
mm_file_size
=
rawdev
->
mmap_default_size
;
disk_chunks
--
;
disk_chunks
--
;
mmap_range
.
from
=
mmap_range
.
to
+
1
;
mmap_range
.
from
=
mmap_range
.
to
;
mmap_range
.
to
=
mmap_range
.
from
+
rawdev
->
mmap_default_size
;
mmap_range
.
to
=
mmap_range
.
from
+
rawdev
->
mmap_default_size
;
if
(
mmap_range
.
to
>
rawdev
->
end_pos
)
if
(
mmap_range
.
to
>
rawdev
->
end_pos
)
{
mmap_range
.
to
=
rawdev
->
end_pos
;
mmap_range
.
to
=
rawdev
->
end_pos
;
mm_file_size
=
mmap_range
.
to
-
mmap_range
.
from
;
}
close
(
fd
);
close
(
fd
);
}
}
break
;
break
;
case
CMD_READ_FILE
:
case
CMD_READ_FILE
:
break
;
break
;
case
CMD_READ_ALL_FILES
:
case
CMD_READ_ALL_FILES
:
// read files from raw device buffer and send them over socket; the disk index directory
// should be built beforehand
if
(
index_dir
.
size
>
0
)
{
if
(
index_dir
.
size
>
0
)
{
mmap_range
.
from
=
rawdev
->
start_pos
;
mmap_range
.
from
=
rawdev
->
start_pos
;
mmap_range
.
to
=
rawdev
->
start_pos
+
rawdev
->
mmap_default_size
;
mmap_range
.
to
=
rawdev
->
start_pos
+
rawdev
->
mmap_default_size
;
...
...
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