]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: move fdisk_reread_partition_table() to another file
authorKarel Zak <kzak@redhat.com>
Fri, 30 Jun 2017 09:24:36 +0000 (11:24 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 14 Jul 2017 09:33:30 +0000 (11:33 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/docs/libfdisk-sections.txt
libfdisk/src/alignment.c
libfdisk/src/context.c

index 767089a71cc7a968ae76bac58448cf28e1561402..7f9b5e51b81e5897285d5f761f7e4fce6fbedaee 100644 (file)
@@ -66,7 +66,6 @@ fdisk_align_lba_in_range
 fdisk_has_user_device_properties
 fdisk_lba_is_phy_aligned
 fdisk_override_geometry
-fdisk_reread_partition_table
 fdisk_reset_alignment
 fdisk_reset_device_properties
 fdisk_save_user_geometry
@@ -325,6 +324,7 @@ fdisk_new_context
 fdisk_new_nested_context
 FDISK_PLURAL
 fdisk_ref_context
+fdisk_reread_partition_table
 fdisk_set_first_lba
 fdisk_set_last_lba
 fdisk_set_size_unit
index e8393d9f28d55621d82850d96e32223bc8f3f3db..6b395b48cd6ce1f3a2e13d005d408f9158042903 100644 (file)
@@ -674,43 +674,3 @@ fdisk_sector_t fdisk_cround(struct fdisk_context *cxt, fdisk_sector_t num)
                        (num / fdisk_get_units_per_sector(cxt)) + 1 : num;
 }
 
-/**
- * fdisk_reread_partition_table:
- * @cxt: context
- *
- * Force *kernel* to re-read partition table on block devices.
- *
- * Returns: 0 on success, < 0 in case of error.
- */
-int fdisk_reread_partition_table(struct fdisk_context *cxt)
-{
-       int i;
-       struct stat statbuf;
-
-       assert(cxt);
-       assert(cxt->dev_fd >= 0);
-
-       i = fstat(cxt->dev_fd, &statbuf);
-       if (i == 0 && S_ISBLK(statbuf.st_mode)) {
-               DBG(CXT, ul_debugobj(cxt, "calling re-read ioctl"));
-               sync();
-#ifdef BLKRRPART
-               fdisk_info(cxt, _("Calling ioctl() to re-read partition table."));
-               i = ioctl(cxt->dev_fd, BLKRRPART);
-#else
-               errno = ENOSYS;
-               i = 1;
-#endif
-       }
-
-       if (i) {
-               fdisk_warn(cxt, _("Re-reading the partition table failed."));
-               fdisk_info(cxt, _(
-                       "The kernel still uses the old table. The "
-                       "new table will be used at the next reboot "
-                       "or after you run partprobe(8) or kpartx(8)."));
-               return -errno;
-       }
-
-       return 0;
-}
index 666ebbba058bc0463480609b7cf4b0ffdefc4acc..9d5492be73878d6422bc92996ae5e4d289b48b9b 100644 (file)
@@ -691,6 +691,47 @@ int fdisk_reassign_device(struct fdisk_context *cxt)
        return rc;
 }
 
+/**
+ * fdisk_reread_partition_table:
+ * @cxt: context
+ *
+ * Force *kernel* to re-read partition table on block devices.
+ *
+ * Returns: 0 on success, < 0 in case of error.
+ */
+int fdisk_reread_partition_table(struct fdisk_context *cxt)
+{
+       int i;
+       struct stat statbuf;
+
+       assert(cxt);
+       assert(cxt->dev_fd >= 0);
+
+       i = fstat(cxt->dev_fd, &statbuf);
+       if (i == 0 && S_ISBLK(statbuf.st_mode)) {
+               DBG(CXT, ul_debugobj(cxt, "calling re-read ioctl"));
+               sync();
+#ifdef BLKRRPART
+               fdisk_info(cxt, _("Calling ioctl() to re-read partition table."));
+               i = ioctl(cxt->dev_fd, BLKRRPART);
+#else
+               errno = ENOSYS;
+               i = 1;
+#endif
+       }
+
+       if (i) {
+               fdisk_warn(cxt, _("Re-reading the partition table failed."));
+               fdisk_info(cxt, _(
+                       "The kernel still uses the old table. The "
+                       "new table will be used at the next reboot "
+                       "or after you run partprobe(8) or kpartx(8)."));
+               return -errno;
+       }
+
+       return 0;
+}
+
 /**
  * fdisk_is_readonly:
  * @cxt: context