Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
fcfd70dd
Commit
fcfd70dd
authored
Aug 11, 2004
by
lw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy .dbs files to /tmp and map copied file.
parent
5847ffa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
7 deletions
+33
-7
src/lib/co/src/co_dbs.c
src/lib/co/src/co_dbs.c
+25
-6
wb/lib/wb/src/wb_vrepdbs.cpp
wb/lib/wb/src/wb_vrepdbs.cpp
+8
-1
No files found.
src/lib/co/src/co_dbs.c
View file @
fcfd70dd
...
...
@@ -409,15 +409,18 @@ dbs_Map(pwr_tStatus *sts, const char *filename)
struct
stat
sb
;
int
ret
;
int
fd
;
int
tfd
;
int
i
;
dbs_sSect
*
sect
;
dbs_sFile
file
;
//
dbs_sFile file;
void
*
base
=
0
;
int
nVolRef
;
dbs_sVolRef
*
vrp
;
dbs_sMenv
*
mep
=
0
;
dbs_sVenv
*
vep
=
0
;
char
buf
[
512
];
char
tfname
[]
=
"/tmp/loadfile.dbs_XXXXXX"
;
*
sts
=
DBS__SUCCESS
;
if
((
ret
=
stat
(
filename
,
&
sb
))
!=
0
)
{
...
...
@@ -427,21 +430,35 @@ dbs_Map(pwr_tStatus *sts, const char *filename)
}
fd
=
open
(
filename
,
O_RDWR
);
tfd
=
mkstemp
(
tfname
);
printf
(
"dbs_Map:: %s -> %s
\n
"
,
filename
,
tfname
);
while
(
1
)
{
int
count
;
count
=
read
(
fd
,
buf
,
sizeof
(
buf
));
if
(
count
<=
0
)
break
;
write
(
tfd
,
buf
,
count
);
}
ret
=
close
(
fd
);
errno
=
0
;
ret
=
read
(
fd
,
&
file
,
sizeof
(
file
));
//
ret = read(fd, &file, sizeof(file));
// printf("st_size...: %ld\n", sb.st_size);
// printf("size......: %d\n", file.size);
base
=
mmap
(
NULL
,
sb
.
st_size
,
PROT_READ
,
MAP_SHARED
,
fd
,
0
);
base
=
mmap
(
NULL
,
sb
.
st_size
,
PROT_READ
,
MAP_SHARED
,
t
fd
,
0
);
if
(
base
==
NULL
)
{
*
sts
=
errno_GetStatus
();
perror
(
"mmap"
);
ret
=
close
(
fd
);
ret
=
close
(
t
fd
);
return
NULL
;
}
ret
=
close
(
fd
);
ret
=
close
(
tfd
);
unlink
(
tfname
);
sect
=
(
dbs_sSect
*
)(
base
+
dbs_dAlign
(
sizeof
(
dbs_sFile
)));
vrp
=
(
dbs_sVolRef
*
)(
base
+
sect
[
dbs_eSect_volref
].
offset
);
...
...
@@ -568,6 +585,8 @@ dbs_Unmap(pwr_tStatus *sts, dbs_sMenv *mep)
{
*
sts
=
DBS__SUCCESS
;
if
(
mep
->
flags
.
b
.
isMapped
)
{
munmap
(
mep
->
base
,
mep
->
size
);
mep
->
flags
.
b
.
isMapped
=
0
;
return
TRUE
;
}
else
if
(
mep
->
f
!=
NULL
)
{
printf
(
"ERROR, dbs_Unmap, trying to unmap a non mapped file
\n
"
);
...
...
wb/lib/wb/src/wb_vrepdbs.cpp
View file @
fcfd70dd
...
...
@@ -7,8 +7,15 @@
void
wb_vrepdbs
::
unref
()
{
if
(
--
m_nRef
==
0
)
printf
(
"wb_vrepdbs::unref
\n
"
);
if
(
--
m_nRef
==
0
)
{
pwr_tStatus
sts
;
printf
(
"wb_vrepdbs::unref::dbs_Unmap
\n
"
);
dbs_Unmap
(
&
sts
,
m_dbsmep
);
delete
this
;
}
}
wb_vrep
*
wb_vrepdbs
::
ref
()
...
...
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