diff --git a/include/lib/util_proc.h b/include/lib/util_proc.h index d843b07d..706f800b 100644 --- a/include/lib/util_proc.h +++ b/include/lib/util_proc.h @@ -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 */ diff --git a/libutil/util_proc.c b/libutil/util_proc.c index 9ac4381c..6ec12217 100644 --- a/libutil/util_proc.c +++ b/libutil/util_proc.c @@ -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; -}