]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/test_get_blkdev_size.cc
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / test / test_get_blkdev_size.cc
CommitLineData
7c673cae
FG
1#include <stdio.h>
2#include <errno.h>
3#include <string.h>
4#include <fcntl.h>
5#include <inttypes.h>
6#include <sys/types.h>
7#include <sys/stat.h>
8#include "include/uuid.h"
9#include "common/blkdev.h"
10
11int main(int argc, char **argv)
12{
13 int fd, ret;
14 int64_t size;
15
16 if (argc != 2) {
17 fprintf(stderr, "usage: %s <blkdev>\n", argv[0]);
18 return -1;
19 }
20
21 fd = open(argv[1], O_RDONLY);
22 if (fd < 0) {
23 perror("open");
24 return -1;
25 }
26
27 ret = get_block_device_size(fd, &size);
28 if (ret < 0) {
29 fprintf(stderr, "get_block_device_size: %s\n", strerror(-ret));
30 return -1;
31 }
32
33 fprintf(stdout, "%" PRId64, size);
34
35 return 0;
36}