libutil: Remove /proc/mount related functions

The only user of util_proc_mnt_get_entry() so far was util_path_sysfs().
With the simplified version there is no user left. Remove
util_proc_mnt_get_entry() and related code.

Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2021-06-18 11:20:39 +02:00
parent 5e5d49264f
commit 802e5f6607
2 changed files with 0 additions and 94 deletions

View File

@@ -27,25 +27,10 @@ struct util_proc_dev_entry {
char *name;
};
/**
* Container for the fields of the output of /proc/mounts (man fstab)
*/
struct util_proc_mnt_entry {
char *spec;
char *file;
char *vfstype;
char *mntOpts;
char *dump;
char *passno;
};
int util_proc_part_get_entry(dev_t device, struct util_proc_part_entry *entry);
void util_proc_part_free_entry(struct util_proc_part_entry *entry);
int util_proc_dev_get_entry(dev_t dev, int blockdev,
struct util_proc_dev_entry *entry);
void util_proc_dev_free_entry(struct util_proc_dev_entry *entry);
int util_proc_mnt_get_entry(const char *file_name, const char *spec,
struct util_proc_mnt_entry *entry);
void util_proc_mnt_free_entry(struct util_proc_mnt_entry *entry);
#endif /* LIB_UTIL_PROC_H */

View File

@@ -332,53 +332,6 @@ util_proc_dev_free_entry(struct util_proc_dev_entry *entry)
}
}
/* Parse one record. */
static int
scan_mnt_entry(struct file_buffer *file, struct util_proc_mnt_entry *entry)
{
int rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->spec);
if (rc)
return rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->file);
if (rc)
return rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->vfstype);
if (rc)
return rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->mntOpts);
if (rc)
return rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->dump);
if (rc)
return rc;
skip_whitespaces(file);
rc = scan_name(file, &entry->passno);
if (rc)
return rc;
skip_line(file);
return 0;
}
/* Free the memory allocated for one record. */
void
util_proc_mnt_free_entry(struct util_proc_mnt_entry *entry)
{
free(entry->spec);
free(entry->file);
free(entry->vfstype);
free(entry->mntOpts);
free(entry->dump);
free(entry->passno);
memset(entry, 0, sizeof(*entry));
}
/* Scan /proc/partitions for an entry matching DEVICE. When there is a match,
* store entry data in ENTRY and return 0. Return non-zero otherwise. */
int
@@ -439,35 +392,3 @@ util_proc_dev_get_entry(dev_t device, int blockdev,
free_file_buffer(&file);
return rc;
}
/*
* Provide one record from a /proc/mounts like file
*
* The parameter file_name distinguishes the file from procfs which
* is read, the parameter spec is the selector for the record.
*/
int util_proc_mnt_get_entry(const char *file_name, const char *spec,
struct util_proc_mnt_entry *entry)
{
struct file_buffer file;
int rc;
rc = get_file_buffer(&file, file_name);
if (rc)
return rc;
while (!eof(&file)) {
rc = scan_mnt_entry(&file, entry);
if (rc)
goto out_free;
if (!strcmp(entry->vfstype, spec)) {
rc = 0;
goto out_free;
}
util_proc_mnt_free_entry(entry);
}
rc = -1;
out_free:
free_file_buffer(&file);
return rc;
}