#include <stdlib.h>
/* #include <sys/dir.h> included via androidcompat.h */
#include <fcntl.h>
+#include <limits.h>
#include <unistd.h>
#include <getopt.h>
#include <uuid/uuid.h>
*/
ret = btrfs_make_block_group(trans, fs_info, bytes_used,
BTRFS_BLOCK_GROUP_SYSTEM,
- BTRFS_FIRST_CHUNK_TREE_OBJECTID,
BTRFS_BLOCK_RESERVED_1M_FOR_SUPER,
BTRFS_MKFS_SYSTEM_GROUP_SIZE);
allocation->system += BTRFS_MKFS_SYSTEM_GROUP_SIZE;
ret = btrfs_make_block_group(trans, fs_info, 0,
BTRFS_BLOCK_GROUP_METADATA |
BTRFS_BLOCK_GROUP_DATA,
- BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
if (ret)
return ret;
return ret;
ret = btrfs_make_block_group(trans, fs_info, 0,
BTRFS_BLOCK_GROUP_METADATA,
- BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
allocation->metadata += chunk_size;
if (ret)
return ret;
ret = btrfs_make_block_group(trans, fs_info, 0,
BTRFS_BLOCK_GROUP_DATA,
- BTRFS_FIRST_CHUNK_TREE_OBJECTID,
chunk_start, chunk_size);
allocation->data += chunk_size;
if (ret)
return ret;
ret = btrfs_make_block_group(trans, fs_info, 0,
- type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
- chunk_start, chunk_size);
+ type, chunk_start, chunk_size);
type &= BTRFS_BLOCK_GROUP_TYPE_MASK;
if (type == BTRFS_BLOCK_GROUP_DATA) {
fd = open(file, oflags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
S_IROTH);
if (fd < 0) {
- error("unable to open %s: %s", file, strerror(errno));
+ error("unable to open %s: %m", file);
goto error;
}
+
ret = fstat(fd, &statbuf);
if (ret < 0) {
- error("unable to stat %s: %s", file, strerror(errno));
+ error("unable to stat %s: %m", file);
ret = -errno;
goto error;
}
path = argv[i];
ret = test_minimum_size(path, min_dev_size);
if (ret < 0) {
- error("failed to check size for %s: %s",
- path, strerror(-ret));
+ error("failed to check size for %s: %m", path);
goto error;
}
if (ret > 0) {
*/
fd = open(file, O_RDWR);
if (fd < 0) {
- error("unable to open %s: %s", file, strerror(errno));
+ error("unable to open %s: %m", file);
goto error;
}
ret = btrfs_prepare_device(fd, file, &dev_block_count, block_count,
*/
fd = open(file, O_RDWR);
if (fd < 0) {
- error("unable to open %s: %s", file, strerror(errno));
+ error("unable to open %s: %m", file);
goto error;
}
ret = btrfs_device_already_in_root(root, fd,