summaryrefslogtreecommitdiff
path: root/c_src/tools-util.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-13 08:33:40 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-04-21 18:46:30 -0400
commitfee67d807bc36ff2cacb77286156798fd70e3f0c (patch)
tree3c05bd1237a6cdd731e651f8a9635b880e7bdfa7 /c_src/tools-util.c
parent8fae948d60dbdc53278013c8103651578aee8c12 (diff)
linux shim: implement BLK_OPEN_CREAT
this allows O_CREAT to be passed through, for the new image creation tool. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/tools-util.c')
-rw-r--r--c_src/tools-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/c_src/tools-util.c b/c_src/tools-util.c
index 496c875c..ea12946c 100644
--- a/c_src/tools-util.c
+++ b/c_src/tools-util.c
@@ -183,7 +183,7 @@ unsigned get_blocksize(int fd)
}
/* Open a block device, do magic blkid stuff to probe for existing filesystems: */
-int open_for_format(struct dev_opts *dev, bool force)
+int open_for_format(struct dev_opts *dev, blk_mode_t mode, bool force)
{
int blkid_version_code = blkid_get_library_version(NULL, NULL);
if (blkid_version_code < 2401) {
@@ -208,7 +208,7 @@ int open_for_format(struct dev_opts *dev, bool force)
size_t fs_type_len, fs_label_len;
dev->file = bdev_file_open_by_path(dev->path,
- BLK_OPEN_READ|BLK_OPEN_WRITE|BLK_OPEN_EXCL|BLK_OPEN_BUFFERED,
+ BLK_OPEN_READ|BLK_OPEN_WRITE|BLK_OPEN_EXCL|BLK_OPEN_BUFFERED|mode,
dev, NULL);
int ret = PTR_ERR_OR_ZERO(dev->file);
if (ret < 0)