summaryrefslogtreecommitdiff
path: root/linux/blkdev.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 /linux/blkdev.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 'linux/blkdev.c')
-rw-r--r--linux/blkdev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/linux/blkdev.c b/linux/blkdev.c
index d073ed6a..3569594f 100644
--- a/linux/blkdev.c
+++ b/linux/blkdev.c
@@ -190,7 +190,10 @@ struct file *bdev_file_open_by_path(const char *path, blk_mode_t mode,
if (mode & BLK_OPEN_EXCL)
flags |= O_EXCL;
- fd = open(path, flags);
+ if (mode & BLK_OPEN_CREAT)
+ flags |= O_CREAT;
+
+ fd = open(path, flags, 0600);
if (fd < 0)
return ERR_PTR(-errno);