Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
b9efb0c9
Commit
b9efb0c9
authored
Jul 19, 2015
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #581 from Blub/master
Use /dev/loop-control if it exists
parents
f71e8f41
edd7414a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
bdev.c
src/lxc/bdev.c
+21
-1
No files found.
src/lxc/bdev.c
View file @
b9efb0c9
...
...
@@ -1868,7 +1868,7 @@ static int loop_detect(const char *path)
return
0
;
}
static
int
find_free_loopdev
(
int
*
retfd
,
char
*
namep
)
static
int
find_free_loopdev
_no_control
(
int
*
retfd
,
char
*
namep
)
{
struct
dirent
dirent
,
*
direntp
;
struct
loop_info64
lo
;
...
...
@@ -1908,6 +1908,26 @@ static int find_free_loopdev(int *retfd, char *namep)
return
0
;
}
static
int
find_free_loopdev
(
int
*
retfd
,
char
*
namep
)
{
int
rc
,
fd
=
-
1
;
int
ctl
=
open
(
"/dev/loop-control"
,
O_RDWR
);
if
(
ctl
<
0
)
return
find_free_loopdev_no_control
(
retfd
,
namep
);
rc
=
ioctl
(
ctl
,
LOOP_CTL_GET_FREE
);
if
(
rc
>=
0
)
{
snprintf
(
namep
,
100
,
"/dev/loop%d"
,
rc
);
fd
=
open
(
namep
,
O_RDWR
);
}
close
(
ctl
);
if
(
fd
==
-
1
)
{
ERROR
(
"No loop device found"
);
return
-
1
;
}
*
retfd
=
fd
;
return
0
;
}
static
int
loop_mount
(
struct
bdev
*
bdev
)
{
int
lfd
,
ffd
=
-
1
,
ret
=
-
1
;
...
...
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