]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: remove mnt_open_device()
authorKarel Zak <kzak@redhat.com>
Thu, 3 Jun 2010 14:37:21 +0000 (16:37 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Jun 2010 14:37:21 +0000 (16:37 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/docs/libmount-sections.txt
shlibs/mount/src/cache.c
shlibs/mount/src/mount.h.in
shlibs/mount/src/mount.sym
shlibs/mount/src/utils.c

index 3c4a9f776632834fd2010b80d7f853f10144feeb..b791c9aaa25f40c71d0a4cc349fbf6c1c8b3f4f9 100644 (file)
@@ -13,7 +13,6 @@ mnt_get_library_version
 <FILE>utils</FILE>
 mnt_fstype_is_netfs
 mnt_fstype_is_pseudofs
-mnt_open_device
 mnt_match_fstype
 mnt_match_options
 </SECTION>
index bd6ea3a02798041caca40570ae75184292b7a95d..027fda44fd767693d859ff017b788edd0b81ea0d 100644 (file)
@@ -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;
 }
 
index e9ef49d6553e888e0dc2963823eceb65830891d9..276213b6cdfa782437d2b26abb5603d9f7ea6c5f 100644 (file)
@@ -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);
 
index a1524eb1e54a54e9d277ed2cfaaee338e33b27af..819be0f1d8107049d69705dbc3a53e1e39289af2 100644 (file)
@@ -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;
index ae2945c0470a2b08ab9ea9027b1152a7085615dd..f487383a819d2efbd097b4dcc7854cb411dbc39a 100644 (file)
@@ -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.
  */