Skip to content

Commit

Permalink
Remove ublio support.
Browse files Browse the repository at this point in the history
It was required for FreeBSD. Nowadays nobody is interested in FreeBSD
support. Also, ublio has not been updated since 2007 and looks dead.
  • Loading branch information
relan committed Jun 3, 2016
1 parent b37d4d4 commit 3959f7d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 71 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -7,7 +7,6 @@ Supported operating systems:

* GNU/Linux
* Mac OS X 10.5 or later
* FreeBSD
* OpenBSD

Most GNU/Linux distributions already have fuse-exfat and exfat-utils in their repositories, so you can just install and use them. The next chapter describes how to compile them from source.
Expand Down
70 changes: 0 additions & 70 deletions libexfat/io.c
Expand Up @@ -37,20 +37,12 @@
#include <sys/ioctl.h>
#endif
#include <sys/mount.h>
#ifdef USE_UBLIO
#include <sys/uio.h>
#include <ublio.h>
#endif

struct exfat_dev
{
int fd;
enum exfat_mode mode;
off_t size; /* in bytes */
#ifdef USE_UBLIO
off_t pos;
ublio_filehandle_t ufh;
#endif
};

static int open_ro(const char* spec)
Expand Down Expand Up @@ -82,9 +74,6 @@ struct exfat_dev* exfat_open(const char* spec, enum exfat_mode mode)
{
struct exfat_dev* dev;
struct stat stbuf;
#ifdef USE_UBLIO
struct ublio_param up;
#endif

dev = malloc(sizeof(struct exfat_dev));
if (dev == NULL)
Expand Down Expand Up @@ -222,38 +211,13 @@ struct exfat_dev* exfat_open(const char* spec, enum exfat_mode mode)
}
}

#ifdef USE_UBLIO
memset(&up, 0, sizeof(struct ublio_param));
up.up_blocksize = 256 * 1024;
up.up_items = 64;
up.up_grace = 32;
up.up_priv = &dev->fd;

dev->pos = 0;
dev->ufh = ublio_open(&up);
if (dev->ufh == NULL)
{
close(dev->fd);
free(dev);
exfat_error("failed to initialize ublio");
return NULL;
}
#endif

return dev;
}

int exfat_close(struct exfat_dev* dev)
{
int rc = 0;

#ifdef USE_UBLIO
if (ublio_close(dev->ufh) != 0)
{
exfat_error("failed to close ublio");
rc = -EIO;
}
#endif
if (close(dev->fd) != 0)
{
exfat_error("failed to close device: %s", strerror(errno));
Expand All @@ -267,13 +231,6 @@ int exfat_fsync(struct exfat_dev* dev)
{
int rc = 0;

#ifdef USE_UBLIO
if (ublio_fsync(dev->ufh) != 0)
{
exfat_error("ublio fsync failed");
rc = -EIO;
}
#endif
if (fsync(dev->fd) != 0)
{
exfat_error("fsync failed: %s", strerror(errno));
Expand All @@ -294,56 +251,29 @@ off_t exfat_get_size(const struct exfat_dev* dev)

off_t exfat_seek(struct exfat_dev* dev, off_t offset, int whence)
{
#ifdef USE_UBLIO
/* XXX SEEK_CUR will be handled incorrectly */
return dev->pos = lseek(dev->fd, offset, whence);
#else
return lseek(dev->fd, offset, whence);
#endif
}

ssize_t exfat_read(struct exfat_dev* dev, void* buffer, size_t size)
{
#ifdef USE_UBLIO
ssize_t result = ublio_pread(dev->ufh, buffer, size, dev->pos);
if (result >= 0)
dev->pos += size;
return result;
#else
return read(dev->fd, buffer, size);
#endif
}

ssize_t exfat_write(struct exfat_dev* dev, const void* buffer, size_t size)
{
#ifdef USE_UBLIO
ssize_t result = ublio_pwrite(dev->ufh, buffer, size, dev->pos);
if (result >= 0)
dev->pos += size;
return result;
#else
return write(dev->fd, buffer, size);
#endif
}

ssize_t exfat_pread(struct exfat_dev* dev, void* buffer, size_t size,
off_t offset)
{
#ifdef USE_UBLIO
return ublio_pread(dev->ufh, buffer, size, offset);
#else
return pread(dev->fd, buffer, size, offset);
#endif
}

ssize_t exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
off_t offset)
{
#ifdef USE_UBLIO
return ublio_pwrite(dev->ufh, buffer, size, offset);
#else
return pwrite(dev->fd, buffer, size, offset);
#endif
}

ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
Expand Down

1 comment on commit 3959f7d

@fhajji
Copy link

@fhajji fhajji commented on 3959f7d Jun 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD still uses ublio as of 11.2-BETA2. To compile exfat, the maintainer of the port sysutils/fusefs-exfat added files/patch-ublio, which reverts this commit:

https://svnweb.freebsd.org/ports/head/sysutils/fusefs-exfat/files/patch-ublio?revision=465414&view=markup

Please sign in to comment.