FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Flashalloc-Cosmos/host/libflashalloc.cc at master · FlashSQL/Flashalloc-Cosmos · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
FlashSQL
/
Flashalloc-Cosmos
Public
forked from
JonghyeokPark/Flashalloc-Cosmos
Notifications
You must be signed in to change notification settings
Fork
0
Star
8
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Flashalloc-Cosmos
/
host
/
libflashalloc.cc
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (31 loc) · 886 Bytes
Breadcrumbs
Flashalloc-Cosmos
/
host
/
libflashalloc.cc
Copy path
File metadata and controls
37 lines (31 loc) · 886 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
include
"
libflashalloc.h
"
#
include
<
inttypes.h
>
#
include
<
stdint.h
>
#
include
<
stdio.h
>
#
include
<
stdlib.h
>
#
include
<
string.h
>
#
include
<
unistd.h
>
int
flashalloc_cmd
(
int
fd,
uint32_t
lba,
uint32_t
len) {
int
err;
struct
nvme_passthru_cmd
cmd;
memset
(&cmd,
0
,
sizeof
(cmd));
cmd.
opcode
=
IO_NVM_ALLOCATE
;
cmd.
nsid
=
0
;
cmd.
cdw10
= lba;
cmd.
cdw14
= len;
err =
ioctl
(fd,
NVME_IOCTL_IO_CMD
, &cmd);
return
err;
}
void
call_flashalloc
(
struct
fiemap
* blockmap,
uint64_t
offset,
uint64_t
len) {
//
open cosmos+ board
int
fd =
open
(
"
/dev/nvme1n1
"
,
O_RDWR
|
O_DIRECT
);
if
(fd <
0
) {
fprintf
(stderr,
"
Cosmos+ Board Open Error!
\n
"
);
}
//
call flashalloc
for
(__u32 i=
0
; i< blockmap->
fm_mapped_extents
; i++) {
flashalloc_cmd
(fd, blockmap->
fm_extents
[i].
fe_physical
/
4096
, blockmap->
fm_extents
[i].
fe_length
/
4096
);
}
return
;
}
Back
|
FazBrowse Home
|
New Git URL