extern "C" {
#endif
+/* BlueSky status and error codes. Various frontends should translate these to
+ * the appropriate error code for whatever protocol they implement. */
+typedef enum {
+ BSTATUS_OK = 0, /* No error */
+ BSTATUS_IOERR, /* I/O error of some form */
+ BSTATUS_NOENT, /* File does not exist */
+} BlueSkyStatus;
+
void bluesky_init(void);
gchar *bluesky_lowercase(const gchar *s);
#include <stdint.h>
#include <glib.h>
#include <string.h>
+#include <inttypes.h>
#include "bluesky-private.h"
if (size == inode->size)
return;
+ g_print("Truncating file to %"PRIi64" bytes\n", size);
+
uint64_t blocks = (size + BLUESKY_BLOCK_SIZE - 1) / BLUESKY_BLOCK_SIZE;
if (blocks > inode->blocks->len) {
void bluesky_file_write(BlueSkyInode *inode, uint64_t offset,
const char *data, gint len)
{
+ g_print("Write %d bytes at offset %"PRIi64"\n", len, offset);
+
g_return_if_fail(inode->type == BLUESKY_REGULAR);
g_return_if_fail(offset < inode->size);
g_return_if_fail(len <= inode->size - offset);
void bluesky_file_read(BlueSkyInode *inode, uint64_t offset,
char *buf, gint len)
{
+ g_print("Read %d bytes at offset %"PRIi64"\n", len, offset);
+
+ if (len == 0 && offset <= inode->size)
+ return;
+
g_return_if_fail(inode->type == BLUESKY_REGULAR);
g_return_if_fail(offset < inode->size);
g_return_if_fail(len <= inode->size - offset);