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
dc815306
Unverified
Commit
dc815306
authored
Oct 07, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: s/MAXPATHLEN/PATH_MAX/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
3e2f74b7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
44 deletions
+44
-44
btrfs.c
src/lxc/storage/btrfs.c
+1
-1
loop.c
src/lxc/storage/loop.c
+2
-2
lvm.c
src/lxc/storage/lvm.c
+8
-8
overlay.c
src/lxc/storage/overlay.c
+14
-14
rbd.c
src/lxc/storage/rbd.c
+2
-2
storage.c
src/lxc/storage/storage.c
+1
-1
storage_utils.c
src/lxc/storage/storage_utils.c
+3
-3
zfs.c
src/lxc/storage/zfs.c
+13
-13
No files found.
src/lxc/storage/btrfs.c
View file @
dc815306
...
...
@@ -462,7 +462,7 @@ bool btrfs_create_clone(struct lxc_conf *conf, struct lxc_storage *orig,
{
int
ret
;
struct
rsync_data
data
=
{
0
,
0
};
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
ret
=
rmdir
(
new
->
dest
);
if
(
ret
<
0
&&
errno
!=
ENOENT
)
...
...
src/lxc/storage/loop.c
View file @
dc815306
...
...
@@ -237,7 +237,7 @@ bool loop_detect(const char *path)
int
loop_mount
(
struct
lxc_storage
*
bdev
)
{
int
ret
,
loopfd
;
char
loname
[
MAXPATHLEN
];
char
loname
[
PATH_MAX
];
const
char
*
src
;
if
(
strcmp
(
bdev
->
type
,
"loop"
))
...
...
@@ -301,7 +301,7 @@ static int do_loop_create(const char *path, uint64_t size, const char *fstype)
{
int
fd
,
ret
;
off_t
ret_size
;
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
const
char
*
cmd_args
[
2
]
=
{
fstype
,
path
};
/* create the new loopback file */
...
...
src/lxc/storage/lvm.c
View file @
dc815306
...
...
@@ -111,7 +111,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool)
{
int
len
,
ret
;
char
*
pathdup
,
*
vg
,
*
lv
;
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
char
sz
[
24
];
char
*
tp
=
NULL
;
struct
lvcreate_args
cmd_args
=
{
0
};
...
...
@@ -201,7 +201,7 @@ bool lvm_detect(const char *path)
int
fd
;
ssize_t
ret
;
struct
stat
statbuf
;
char
devp
[
MAXPATHLEN
],
buf
[
4
];
char
devp
[
PATH_MAX
],
buf
[
4
];
if
(
!
strncmp
(
path
,
"lvm:"
,
4
))
return
true
;
...
...
@@ -213,9 +213,9 @@ bool lvm_detect(const char *path)
if
(
!
S_ISBLK
(
statbuf
.
st_mode
))
return
false
;
ret
=
snprintf
(
devp
,
MAXPATHLEN
,
"/sys/dev/block/%d:%d/dm/uuid"
,
ret
=
snprintf
(
devp
,
PATH_MAX
,
"/sys/dev/block/%d:%d/dm/uuid"
,
major
(
statbuf
.
st_rdev
),
minor
(
statbuf
.
st_rdev
));
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Failed to create string"
);
return
false
;
}
...
...
@@ -335,7 +335,7 @@ static int lvm_snapshot(struct lxc_storage *orig, const char *path, uint64_t siz
char
*
lv
,
*
pathdup
;
char
sz
[
24
];
char
fstype
[
100
];
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
char
repairchar
;
const
char
*
origsrc
;
struct
lvcreate_args
cmd_args
=
{
0
};
...
...
@@ -506,7 +506,7 @@ bool lvm_create_clone(struct lxc_conf *conf, struct lxc_storage *orig,
const
char
*
thinpool
;
struct
rsync_data
data
;
const
char
*
cmd_args
[
2
];
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
char
fstype
[
100
]
=
"ext4"
;
uint64_t
size
=
newsize
;
...
...
@@ -593,7 +593,7 @@ bool lvm_create_snapshot(struct lxc_conf *conf, struct lxc_storage *orig,
int
lvm_destroy
(
struct
lxc_storage
*
orig
)
{
int
ret
;
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
struct
lvcreate_args
cmd_args
=
{
0
};
cmd_args
.
lv
=
lxc_storage_get_path
(
orig
->
src
,
"lvm"
);
...
...
@@ -616,7 +616,7 @@ int lvm_create(struct lxc_storage *bdev, const char *dest, const char *n,
uint64_t
sz
;
int
ret
,
len
;
const
char
*
cmd_args
[
2
];
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
if
(
!
specs
)
return
-
1
;
...
...
src/lxc/storage/overlay.c
View file @
dc815306
...
...
@@ -737,7 +737,7 @@ char *ovl_get_rootfs(const char *rootfs_path, size_t *rootfslen)
int
ovl_mkdir
(
const
struct
mntent
*
mntent
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxc_name
,
const
char
*
lxc_path
)
{
char
lxcpath
[
MAXPATHLEN
];
char
lxcpath
[
PATH_MAX
];
char
**
opts
;
int
ret
;
size_t
arrlen
,
i
,
len
,
rootfslen
;
...
...
@@ -766,8 +766,8 @@ int ovl_mkdir(const struct mntent *mntent, const struct lxc_rootfs *rootfs,
}
if
(
rootfs_path
)
{
ret
=
snprintf
(
lxcpath
,
MAXPATHLEN
,
"%s/%s"
,
lxc_path
,
lxc_name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
ret
=
snprintf
(
lxcpath
,
PATH_MAX
,
"%s/%s"
,
lxc_path
,
lxc_name
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
goto
err
;
rootfs_dir
=
ovl_get_rootfs
(
rootfs_path
,
&
rootfslen
);
...
...
@@ -825,8 +825,8 @@ int ovl_update_abs_paths(struct lxc_conf *lxc_conf, const char *lxc_path,
const
char
*
lxc_name
,
const
char
*
newpath
,
const
char
*
newname
)
{
char
new_upper
[
MAXPATHLEN
],
new_work
[
MAXPATHLEN
],
old_upper
[
MAXPATHLEN
],
old_work
[
MAXPATHLEN
];
char
new_upper
[
PATH_MAX
],
new_work
[
PATH_MAX
],
old_upper
[
PATH_MAX
],
old_work
[
PATH_MAX
];
size_t
i
;
struct
lxc_list
*
iterator
;
char
*
cleanpath
=
NULL
;
...
...
@@ -852,13 +852,13 @@ int ovl_update_abs_paths(struct lxc_conf *lxc_conf, const char *lxc_path,
}
ret
=
snprintf
(
old_work
,
MAXPATHLEN
,
"workdir=%s/%s"
,
lxc_path
,
lxc_name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
snprintf
(
old_work
,
PATH_MAX
,
"workdir=%s/%s"
,
lxc_path
,
lxc_name
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
goto
err
;
ret
=
snprintf
(
new_work
,
MAXPATHLEN
,
"workdir=%s/%s"
,
cleanpath
,
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
snprintf
(
new_work
,
PATH_MAX
,
"workdir=%s/%s"
,
cleanpath
,
newname
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
goto
err
;
lxc_list_for_each
(
iterator
,
&
lxc_conf
->
mount_list
)
{
...
...
@@ -872,14 +872,14 @@ int ovl_update_abs_paths(struct lxc_conf *lxc_conf, const char *lxc_path,
if
(
!
tmp
)
continue
;
ret
=
snprintf
(
old_upper
,
MAXPATHLEN
,
"%s=%s/%s"
,
tmp
,
lxc_path
,
ret
=
snprintf
(
old_upper
,
PATH_MAX
,
"%s=%s/%s"
,
tmp
,
lxc_path
,
lxc_name
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
goto
err
;
ret
=
snprintf
(
new_upper
,
MAXPATHLEN
,
"%s=%s/%s"
,
tmp
,
ret
=
snprintf
(
new_upper
,
PATH_MAX
,
"%s=%s/%s"
,
tmp
,
cleanpath
,
newname
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
goto
err
;
if
(
strstr
(
mnt_entry
,
old_upper
))
{
...
...
@@ -956,7 +956,7 @@ static int ovl_do_rsync(const char *src, const char *dest,
{
int
ret
=
-
1
;
struct
rsync_data_char
rdata
=
{
0
};
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
rdata
.
src
=
(
char
*
)
src
;
rdata
.
dest
=
(
char
*
)
dest
;
...
...
src/lxc/storage/rbd.c
View file @
dc815306
...
...
@@ -104,7 +104,7 @@ int rbd_create(struct lxc_storage *bdev, const char *dest, const char *n,
int
ret
,
len
;
char
sz
[
24
];
const
char
*
cmd_args
[
2
];
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
const
char
*
rbdname
=
n
;
struct
rbd_args
args
=
{
0
};
...
...
@@ -198,7 +198,7 @@ int rbd_destroy(struct lxc_storage *orig)
int
ret
;
const
char
*
src
;
char
*
rbdfullname
;
char
cmd_output
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
];
struct
rbd_args
args
=
{
0
};
size_t
len
;
...
...
src/lxc/storage/storage.c
View file @
dc815306
...
...
@@ -331,7 +331,7 @@ struct lxc_storage *storage_copy(struct lxc_container *c, const char *cname,
const
char
*
src
=
c
->
lxc_conf
->
rootfs
.
path
;
const
char
*
oldname
=
c
->
name
;
const
char
*
oldpath
=
c
->
config_path
;
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
struct
rsync_data
data
=
{
0
};
if
(
!
src
)
{
...
...
src/lxc/storage/storage_utils.c
View file @
dc815306
...
...
@@ -186,7 +186,7 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
FILE
*
f
;
char
*
sp1
,
*
sp2
,
*
sp3
;
const
char
*
l
,
*
srcdev
;
char
devpath
[
MAXPATHLEN
];
char
devpath
[
PATH_MAX
];
char
*
line
=
NULL
;
if
(
!
bdev
||
!
bdev
->
src
||
!
bdev
->
dest
)
...
...
@@ -415,11 +415,11 @@ const char *linkderef(const char *path, char *dest)
if
(
!
S_ISLNK
(
sbuf
.
st_mode
))
return
path
;
ret
=
readlink
(
path
,
dest
,
MAXPATHLEN
);
ret
=
readlink
(
path
,
dest
,
PATH_MAX
);
if
(
ret
<
0
)
{
SYSERROR
(
"error reading link %s"
,
path
);
return
NULL
;
}
else
if
(
ret
>=
MAXPATHLEN
)
{
}
else
if
(
ret
>=
PATH_MAX
)
{
ERROR
(
"link in %s too long"
,
path
);
return
NULL
;
}
...
...
src/lxc/storage/zfs.c
View file @
dc815306
...
...
@@ -134,7 +134,7 @@ bool zfs_detect(const char *path)
int
ret
;
char
*
dataset
;
struct
zfs_args
cmd_args
=
{
0
};
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
if
(
!
strncmp
(
path
,
"zfs:"
,
4
))
return
true
;
...
...
@@ -185,7 +185,7 @@ int zfs_mount(struct lxc_storage *bdev)
char
*
mntdata
,
*
tmp
;
const
char
*
src
;
unsigned
long
mntflags
;
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
if
(
strcmp
(
bdev
->
type
,
"zfs"
))
return
-
22
;
...
...
@@ -287,7 +287,7 @@ bool zfs_copy(struct lxc_conf *conf, struct lxc_storage *orig,
struct
lxc_storage
*
new
,
uint64_t
newsize
)
{
int
ret
;
char
cmd_output
[
MAXPATHLEN
],
option
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
],
option
[
PATH_MAX
];
struct
rsync_data
data
=
{
0
,
0
};
struct
zfs_args
cmd_args
=
{
0
};
const
char
*
argv
[]
=
{
"zfs"
,
/* 0 */
...
...
@@ -299,8 +299,8 @@ bool zfs_copy(struct lxc_conf *conf, struct lxc_storage *orig,
NULL
};
/* mountpoint */
ret
=
snprintf
(
option
,
MAXPATHLEN
,
"mountpoint=%s"
,
new
->
dest
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
ret
=
snprintf
(
option
,
PATH_MAX
,
"mountpoint=%s"
,
new
->
dest
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Failed to create string"
);
return
false
;
}
...
...
@@ -348,7 +348,7 @@ bool zfs_snapshot(struct lxc_conf *conf, struct lxc_storage *orig,
char
*
tmp
,
*
snap_name
,
*
snapshot
;
const
char
*
orig_src
;
struct
zfs_args
cmd_args
=
{
0
};
char
cmd_output
[
MAXPATHLEN
]
=
{
0
},
option
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
]
=
{
0
},
option
[
PATH_MAX
];
orig_src
=
lxc_storage_get_path
(
orig
->
src
,
orig
->
type
);
if
(
*
orig_src
==
'/'
)
{
...
...
@@ -423,8 +423,8 @@ bool zfs_snapshot(struct lxc_conf *conf, struct lxc_storage *orig,
TRACE
(
"Created zfs snapshot
\"
%s
\"
"
,
snapshot
);
}
ret
=
snprintf
(
option
,
MAXPATHLEN
,
"mountpoint=%s"
,
new
->
dest
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
ret
=
snprintf
(
option
,
PATH_MAX
,
"mountpoint=%s"
,
new
->
dest
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Failed to create string"
);
free
(
snapshot
);
return
-
1
;
...
...
@@ -455,7 +455,7 @@ int zfs_clonepaths(struct lxc_storage *orig, struct lxc_storage *new,
char
*
dataset
,
*
tmp
;
const
char
*
orig_src
;
size_t
dataset_len
,
len
;
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
if
(
!
orig
->
src
||
!
orig
->
dest
)
return
-
1
;
...
...
@@ -586,7 +586,7 @@ int zfs_destroy(struct lxc_storage *orig)
bool
found
;
char
*
parent_snapshot
=
NULL
;
struct
zfs_args
cmd_args
=
{
0
};
char
cmd_output
[
MAXPATHLEN
]
=
{
0
};
char
cmd_output
[
PATH_MAX
]
=
{
0
};
src
=
lxc_storage_get_path
(
orig
->
src
,
orig
->
type
);
...
...
@@ -714,7 +714,7 @@ int zfs_create(struct lxc_storage *bdev, const char *dest, const char *n,
int
ret
;
size_t
len
;
struct
zfs_args
cmd_args
=
{
0
};
char
cmd_output
[
MAXPATHLEN
],
option
[
MAXPATHLEN
];
char
cmd_output
[
PATH_MAX
],
option
[
PATH_MAX
];
const
char
*
argv
[]
=
{
"zfs"
,
/* 0 */
"create"
,
/* 1 */
"-o"
,
""
,
/* 2, 3 */
...
...
@@ -750,8 +750,8 @@ int zfs_create(struct lxc_storage *bdev, const char *dest, const char *n,
}
argv
[
7
]
=
lxc_storage_get_path
(
bdev
->
src
,
bdev
->
type
);
ret
=
snprintf
(
option
,
MAXPATHLEN
,
"mountpoint=%s"
,
bdev
->
dest
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
{
ret
=
snprintf
(
option
,
PATH_MAX
,
"mountpoint=%s"
,
bdev
->
dest
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Failed to create string"
);
return
-
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