Skip to content

Commit

Permalink
Fix argument passed to ioctl() function call
Browse files Browse the repository at this point in the history
The `BLKGETSIZE64` is not defined for FreeBSD and causes compilation
error. This should fix compilation error for FreeBSD.

Fixes #72

Signed-off-by: Adam Wojasinski <[email protected]>
  • Loading branch information
awojasinski committed Aug 19, 2024
1 parent c66b931 commit 43198c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lfs_fuse_bd.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ int lfs_fuse_bd_create(struct lfs_config *cfg, const char *path) {
// get size in sectors
if (!cfg->block_count) {
uint64_t size;
int err = ioctl(fd, BLKGETSIZE64, &size);
int err = ioctl(fd,
#if defined(__FreeBSD__)
BLKGETSIZE,
#else
BLKGETSIZE64,
#endif
&size);
if (err) {
return -errno;
}
Expand Down

0 comments on commit 43198c5

Please sign in to comment.