Version 1.02.138 -
=====================================
+ Add dm_stats_bind_from_fd() to bind a stats handle from a file descriptor.
Do not try call callback when reverting activation on error path.
Fix file mapping for extents with physically adjacent extents.
Validation vsnprintf result in runtime translate of dm_log (1.02.136).
dm_bit_get_last
dm_bit_get_prev
dm_bitset_parse_list
+dm_stats_bind_from_fd
*/
int dm_stats_bind_uuid(struct dm_stats *dms, const char *uuid);
+/*
+ * Bind a dm_stats handle to the device backing the file referenced
+ * by the specified file descriptor.
+ *
+ * File descriptor fd must reference a regular file, open for reading,
+ * in a local file system, backed by a device-mapper device, that
+ * supports the FIEMAP ioctl, and that returns data describing the
+ * physical location of extents.
+ */
+int dm_stats_bind_from_fd(struct dm_stats *dms, int fd);
/*
* Test whether the running kernel supports the precise_timestamps
* feature. Presence of this feature also implies histogram support.
*/
#include "dmlib.h"
+#include "kdev_t.h"
#include "math.h" /* log10() */
return 1;
}
+int dm_stats_bind_from_fd(struct dm_stats *dms, int fd)
+{
+ int major, minor;
+ struct stat buf;
+
+ if (fstat(fd, &buf)) {
+ log_error("fstat failed for fd %d.", fd);
+ return 0;
+ }
+
+ major = (int) MAJOR(buf.st_dev);
+ minor = (int) MINOR(buf.st_dev);
+
+ if (!dm_stats_bind_devno(dms, major, minor))
+ return_0;
+ return 1;
+}
+
static int _stats_check_precise_timestamps(const struct dm_stats *dms)
{
/* Already checked? */
return 1;
}
-static int _bind_stats_from_fd(struct dm_stats *dms, int fd)
-{
- int major, minor;
- struct stat buf;
-
- if (fstat(fd, &buf)) {
- log_error("fstat failed for fd %d.", fd);
- return 0;
- }
-
- major = (int) MAJOR(buf.st_dev);
- minor = (int) MINOR(buf.st_dev);
-
- if (!dm_stats_bind_devno(dms, major, minor))
- return_0;
- return 1;
-}
-
static int _stats_clear_one_region(struct dm_stats *dms, uint64_t region_id)
{
goto bad;
}
- if (!_bind_stats_from_fd(dms, fd))
+ if (!dm_stats_bind_from_fd(dms, fd))
goto_bad;
if (!strlen(program_id))