From 54423a2569c564b10986e1d4eedfa8161f7cf721 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Jun 2010 16:37:21 +0200 Subject: [PATCH] libmount: remove mnt_open_device() Signed-off-by: Karel Zak --- shlibs/mount/docs/libmount-sections.txt | 1 - shlibs/mount/src/cache.c | 11 ++-------- shlibs/mount/src/mount.h.in | 1 - shlibs/mount/src/mount.sym | 1 - shlibs/mount/src/utils.c | 28 ------------------------- 5 files changed, 2 insertions(+), 40 deletions(-) diff --git a/shlibs/mount/docs/libmount-sections.txt b/shlibs/mount/docs/libmount-sections.txt index 3c4a9f77..b791c9aa 100644 --- a/shlibs/mount/docs/libmount-sections.txt +++ b/shlibs/mount/docs/libmount-sections.txt @@ -13,7 +13,6 @@ mnt_get_library_version utils mnt_fstype_is_netfs mnt_fstype_is_pseudofs -mnt_open_device mnt_match_fstype mnt_match_options diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index bd6ea3a0..027fda44 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -239,7 +239,6 @@ const char *mnt_cache_find_tag(mnt_cache *cache, int mnt_cache_read_tags(mnt_cache *cache, const char *devname) { int i, ntags = 0; - int fd; static blkid_probe pr; const char *tags[] = { "LABEL", "UUID" }; @@ -264,14 +263,9 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) DBG(DEBUG_CACHE, printf("cache: reading tags for: %s\n", devname)); - fd = mnt_open_device(devname, O_RDONLY); - if (fd < 0) - return -1; - pr = blkid_new_probe(); + pr = blkid_new_probe_from_filename(devname); if (!pr) - goto error; - if (blkid_probe_set_device(pr, fd, 0, 0)) - goto error; + return -1; blkid_probe_enable_superblocks(pr, 1); @@ -304,7 +298,6 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) return ntags ? 0 : 1; error: blkid_free_probe(pr); - close(fd); return -1; } diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index e9ef49d6..276213b6 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -109,7 +109,6 @@ extern int mnt_get_library_version(const char **ver_string); /* utils.c */ extern int mnt_fstype_is_netfs(const char *type); extern int mnt_fstype_is_pseudofs(const char *type); -extern int mnt_open_device(const char *devname, int flags); extern int mnt_match_fstype(const char *type, const char *pattern); extern int mnt_match_options(const char *optstr, const char *pattern); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index a1524eb1..819be0f1 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -62,7 +62,6 @@ global: mnt_new_optls; mnt_new_tab; mnt_new_tab_from_file; - mnt_open_device; mnt_optent_dup_value; mnt_optent_get_flag; mnt_optent_get_id; diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index ae2945c0..f487383a 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -291,34 +291,6 @@ char *mnt_strconcat3(char *s, const char *t, const char *u) return s; } -/** - * mnt_open_device: - * @devname: device path - * @flags: open(2) flags - * - * Opens device like open(2), but waits for cdrom medium (if errno=ENOMEDIUM). - * - * Returns: file descriptor or -1 in case of error. - */ -int mnt_open_device(const char *devname, int flags) -{ - int retries = 0; - - do { - int fd = open(devname, flags); - if (fd >= 0) - return fd; - if (errno != ENOMEDIUM) - break; - if (retries >= CONFIG_CDROM_NOMEDIUM_RETRIES) - break; - ++retries; - sleep(3); - } while(1); - - return -1; -} - /* * Returns allocated string with username or NULL. */ -- 2.39.5