libmount: fix compiler warnings [-Wunused-parameter -Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
85d7a416f1
commit
7fc6d2b8f8
|
@ -79,7 +79,7 @@ static void __attribute__((__noreturn__)) print_version(void)
|
||||||
exit(EX_SUCCESS);
|
exit(EX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int table_parser_errcb(struct libmnt_table *tb,
|
static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)),
|
||||||
const char *filename, int line)
|
const char *filename, int line)
|
||||||
{
|
{
|
||||||
if (filename)
|
if (filename)
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct libmnt_cache *mnt_new_cache(void)
|
||||||
*/
|
*/
|
||||||
void mnt_free_cache(struct libmnt_cache *cache)
|
void mnt_free_cache(struct libmnt_cache *cache)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return;
|
return;
|
||||||
|
@ -181,7 +181,7 @@ static int cache_add_tag(struct libmnt_cache *cache, const char *tagname,
|
||||||
*/
|
*/
|
||||||
static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
|
static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
assert(path);
|
assert(path);
|
||||||
|
@ -205,7 +205,7 @@ static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
|
||||||
static const char *cache_find_tag(struct libmnt_cache *cache,
|
static const char *cache_find_tag(struct libmnt_cache *cache,
|
||||||
const char *token, const char *value)
|
const char *token, const char *value)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
size_t tksz;
|
size_t tksz;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
|
@ -231,7 +231,7 @@ static const char *cache_find_tag(struct libmnt_cache *cache,
|
||||||
static char *cache_find_tag_value(struct libmnt_cache *cache,
|
static char *cache_find_tag_value(struct libmnt_cache *cache,
|
||||||
const char *devname, const char *token)
|
const char *devname, const char *token)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
assert(devname);
|
assert(devname);
|
||||||
|
@ -297,7 +297,8 @@ static int cache_get_probe(struct libmnt_cache *cache, const char *devname,
|
||||||
*/
|
*/
|
||||||
int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
|
int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
|
||||||
{
|
{
|
||||||
int i, ntags = 0, rc;
|
size_t i, ntags = 0;
|
||||||
|
int rc;
|
||||||
const char *tags[] = { "LABEL", "UUID", "TYPE" };
|
const char *tags[] = { "LABEL", "UUID", "TYPE" };
|
||||||
|
|
||||||
assert(cache);
|
assert(cache);
|
||||||
|
@ -355,7 +356,7 @@ int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
|
||||||
ntags++;
|
ntags++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(CACHE, mnt_debug_h(cache, "\tread %d tags", ntags));
|
DBG(CACHE, mnt_debug_h(cache, "\tread %zd tags", ntags));
|
||||||
return ntags ? 0 : 1;
|
return ntags ? 0 : 1;
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1244,7 +1244,7 @@ int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name,
|
||||||
path, name, type);
|
path, name, type);
|
||||||
path = strtok_r(NULL, ":", &p);
|
path = strtok_r(NULL, ":", &p);
|
||||||
|
|
||||||
if (rc >= sizeof(helper) || rc < 0)
|
if (rc < 0 || (size_t) rc >= sizeof(helper))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rc = stat(helper, &st);
|
rc = stat(helper, &st);
|
||||||
|
@ -1595,7 +1595,9 @@ int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status)
|
||||||
*
|
*
|
||||||
* Returns: 0 or negative number in case of error.
|
* Returns: 0 or negative number in case of error.
|
||||||
*/
|
*/
|
||||||
int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
|
int mnt_context_strerror(struct libmnt_context *cxt __attribute__((__unused__)),
|
||||||
|
char *buf __attribute__((__unused__)),
|
||||||
|
size_t bufsiz __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
/* TODO: based on cxt->syscall_errno or cxt->helper_status */
|
/* TODO: based on cxt->syscall_errno or cxt->helper_status */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1605,7 +1607,7 @@ int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
|
||||||
* mnt_context_init_helper
|
* mnt_context_init_helper
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @action: MNT_ACT_{UMOUNT,MOUNT}
|
* @action: MNT_ACT_{UMOUNT,MOUNT}
|
||||||
* @flags: not used
|
* @flags: not used now
|
||||||
*
|
*
|
||||||
* This function infors libmount that used from [u]mount.type helper.
|
* This function infors libmount that used from [u]mount.type helper.
|
||||||
*
|
*
|
||||||
|
@ -1618,7 +1620,8 @@ int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, negative number in case of error.
|
* Returns: 0 on success, negative number in case of error.
|
||||||
*/
|
*/
|
||||||
int mnt_context_init_helper(struct libmnt_context *cxt, int action, int flags)
|
int mnt_context_init_helper(struct libmnt_context *cxt, int action,
|
||||||
|
int flags __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
int rc = mnt_context_disable_helpers(cxt, TRUE);
|
int rc = mnt_context_disable_helpers(cxt, TRUE);
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ err:
|
||||||
* traditional mtab locking
|
* traditional mtab locking
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void mnt_lockalrm_handler(int sig)
|
static void mnt_lockalrm_handler(int sig __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
/* do nothing, say nothing, be nothing */
|
/* do nothing, say nothing, be nothing */
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,8 @@ static int check_option(const char *haystack, size_t len,
|
||||||
|
|
||||||
for (p = haystack; p && p < haystack + len; p++) {
|
for (p = haystack; p && p < haystack + len; p++) {
|
||||||
char *sep = strchr(p, ',');
|
char *sep = strchr(p, ',');
|
||||||
size_t plen = sep ? sep - p : len - (p - haystack);
|
size_t plen = sep ? (size_t) (sep - p) :
|
||||||
|
len - (p - haystack);
|
||||||
|
|
||||||
if (plen == needle_len) {
|
if (plen == needle_len) {
|
||||||
if (!strncmp(p, needle, plen))
|
if (!strncmp(p, needle, plen))
|
||||||
|
@ -309,7 +310,8 @@ int mnt_match_options(const char *optstr, const char *pattern)
|
||||||
|
|
||||||
for (p = pattern; p < pattern + len; p++) {
|
for (p = pattern; p < pattern + len; p++) {
|
||||||
char *sep = strchr(p, ',');
|
char *sep = strchr(p, ',');
|
||||||
size_t plen = sep ? sep - p : len - (p - pattern);
|
size_t plen = sep ? (size_t) (sep - p) :
|
||||||
|
len - (p - pattern);
|
||||||
|
|
||||||
if (!plen)
|
if (!plen)
|
||||||
continue; /* if two ',' appear in a row */
|
continue; /* if two ',' appear in a row */
|
||||||
|
|
Loading…
Reference in New Issue