aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-02-02 11:14:04 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2005-02-02 11:14:04 +0000
commite5183747da2b268f53a9464fda5fd6b4856c62a4 (patch)
tree7c20708b5d28200464b31860da8f54eb2b989759 /lib
parentff30a6cd43535ec318a26c1d3ec9c7edc268e9c9 (diff)
downloadlibfuse-e5183747da2b268f53a9464fda5fd6b4856c62a4.tar.gz
whitespace fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/fuse.c108
-rw-r--r--lib/fuse_mt.c6
-rw-r--r--lib/helper.c26
-rw-r--r--lib/mount.c6
4 files changed, 73 insertions, 73 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index 004095c..0980388 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -77,11 +77,11 @@ struct fuse_getdir_out {
__u32 fd;
};
-#define FUSE_GETDIR 7
+#define FUSE_GETDIR 7
static const char *opname(enum fuse_opcode opcode)
{
- switch (opcode) {
+ switch (opcode) {
case FUSE_LOOKUP: return "LOOKUP";
case FUSE_FORGET: return "FORGET";
case FUSE_GETATTR: return "GETATTR";
@@ -136,7 +136,7 @@ static struct node *get_node_nocheck(struct fuse *f, nodeid_t nodeid)
for (node = f->id_table[hash]; node != NULL; node = node->id_next)
if (node->nodeid == nodeid)
return node;
-
+
return NULL;
}
@@ -162,7 +162,7 @@ static void unhash_id(struct fuse *f, struct node *node)
size_t hash = node->nodeid % f->id_table_size;
struct node **nodep = &f->id_table[hash];
- for (; *nodep != NULL; nodep = &(*nodep)->id_next)
+ for (; *nodep != NULL; nodep = &(*nodep)->id_next)
if (*nodep == node) {
*nodep = node->id_next;
return;
@@ -173,7 +173,7 @@ static void hash_id(struct fuse *f, struct node *node)
{
size_t hash = node->nodeid % f->id_table_size;
node->id_next = f->id_table[hash];
- f->id_table[hash] = node;
+ f->id_table[hash] = node;
}
static unsigned int name_hash(struct fuse *f, nodeid_t parent, const char *name)
@@ -194,7 +194,7 @@ static void unhash_name(struct fuse *f, struct node *node)
if (node->name) {
size_t hash = name_hash(f, node->parent, node->name);
struct node **nodep = &f->name_table[hash];
-
+
for (; *nodep != NULL; nodep = &(*nodep)->name_next)
if (*nodep == node) {
*nodep = node->name_next;
@@ -270,7 +270,7 @@ static struct node *find_node(struct fuse *f, nodeid_t parent, char *name,
struct node *node;
int mode = attr->mode & S_IFMT;
int rdev = 0;
-
+
if (S_ISCHR(mode) || S_ISBLK(mode))
rdev = attr->rdev;
@@ -278,12 +278,12 @@ static struct node *find_node(struct fuse *f, nodeid_t parent, char *name,
node = lookup_node(f, parent, name);
if (node != NULL) {
if (!(f->flags & FUSE_USE_INO))
- attr->ino = node->nodeid;
+ attr->ino = node->nodeid;
} else {
node = (struct node *) calloc(1, sizeof(struct node));
if (node == NULL)
goto out_err;
-
+
node->refctr = 1;
node->nodeid = next_id(f);
if (!(f->flags & FUSE_USE_INO))
@@ -324,7 +324,7 @@ static char *get_path_name(struct fuse *f, nodeid_t nodeid, const char *name)
char buf[FUSE_MAX_PATH];
char *s = buf + FUSE_MAX_PATH - 1;
struct node *node;
-
+
*s = '\0';
if (name != NULL) {
@@ -340,7 +340,7 @@ static char *get_path_name(struct fuse *f, nodeid_t nodeid, const char *name)
s = NULL;
break;
}
-
+
s = add_name(buf, s, node->name);
if (s == NULL)
break;
@@ -392,7 +392,7 @@ static int rename_node(struct fuse *f, nodeid_t olddir, const char *oldname,
struct node *node;
struct node *newnode;
int err = 0;
-
+
pthread_mutex_lock(&f->lock);
node = lookup_node(f, olddir, oldname);
newnode = lookup_node(f, newdir, newname);
@@ -407,13 +407,13 @@ static int rename_node(struct fuse *f, nodeid_t olddir, const char *oldname,
}
unhash_name(f, newnode);
}
-
+
unhash_name(f, node);
if (hash_name(f, node, newdir, newname) == -1) {
err = -ENOMEM;
goto out;
}
-
+
if (hide)
node->is_hidden = 1;
@@ -485,7 +485,7 @@ static int send_reply_raw(struct fuse *f, char *outbuf, size_t outsize)
out->unique, out->error, strerror(-out->error), outsize);
fflush(stdout);
}
-
+
/* This needs to be done before the reply, otherwise the scheduler
could play tricks with us, and only let the counter be
increased long after the operation is done */
@@ -529,7 +529,7 @@ static int send_reply(struct fuse *f, struct fuse_in_header *in, int error,
out->error = error;
if (argsize != 0)
memcpy(outbuf + sizeof(struct fuse_out_header), arg, argsize);
-
+
res = send_reply_raw(f, outbuf, outsize);
free(outbuf);
}
@@ -576,11 +576,11 @@ static char *hidden_name(struct fuse *f, nodeid_t dir, const char *oldname,
newnode = lookup_node(f, dir, newname);
} while(newnode);
pthread_mutex_unlock(&f->lock);
-
+
newpath = get_path_name(f, dir, newname);
if (!newpath)
break;
-
+
res = f->op.getattr(newpath, &buf);
if (res != 0)
break;
@@ -714,7 +714,7 @@ static int do_chmod(struct fuse *f, const char *path, struct fuse_attr *attr)
res = f->op.chmod(path, attr->mode);
return res;
-}
+}
static int do_chown(struct fuse *f, const char *path, struct fuse_attr *attr,
int valid)
@@ -722,7 +722,7 @@ static int do_chown(struct fuse *f, const char *path, struct fuse_attr *attr,
int res;
uid_t uid = (valid & FATTR_UID) ? attr->uid : (uid_t) -1;
gid_t gid = (valid & FATTR_GID) ? attr->gid : (gid_t) -1;
-
+
res = -ENOSYS;
if (f->op.chown)
res = f->op.chown(path, uid, gid);
@@ -776,7 +776,7 @@ static void do_setattr(struct fuse *f, struct fuse_in_header *in,
res = do_chown(f, path, attr, valid);
if (!res && (valid & FATTR_SIZE))
res = do_truncate(f, path, attr);
- if (!res && (valid & (FATTR_ATIME | FATTR_MTIME)) ==
+ if (!res && (valid & (FATTR_ATIME | FATTR_MTIME)) ==
(FATTR_ATIME | FATTR_MTIME))
res = do_utime(f, path, attr);
if (!res) {
@@ -1017,7 +1017,7 @@ static void do_rename(struct fuse *f, struct fuse_in_header *in,
res = -ENOSYS;
if (f->op.rename) {
res = 0;
- if (!(f->flags & FUSE_HARD_REMOVE) &&
+ if (!(f->flags & FUSE_HARD_REMOVE) &&
is_open(f, newdir, newname))
res = hide_node(f, newpath, newdir, newname);
if (res == 0) {
@@ -1030,7 +1030,7 @@ static void do_rename(struct fuse *f, struct fuse_in_header *in,
}
free(oldpath);
}
- send_reply(f, in, res, NULL, 0);
+ send_reply(f, in, res, NULL, 0);
}
static void do_link(struct fuse *f, struct fuse_in_header *in,
@@ -1096,7 +1096,7 @@ static void do_open(struct fuse *f, struct fuse_in_header *in,
printf("OPEN[%lu] flags: 0x%x\n", fi.fh, arg->flags);
fflush(stdout);
}
-
+
pthread_mutex_lock(&f->lock);
res2 = send_reply(f, in, res, &outarg, sizeof(outarg));
if(res2 == -ENOENT) {
@@ -1173,10 +1173,10 @@ static void do_release(struct fuse *f, struct fuse_in_header *in,
else if (path)
((struct fuse_operations_compat2 *) &f->op)->release(path, fi.flags);
}
-
+
if(unlink_hidden && path)
f->op.unlink(path);
-
+
if (path)
free(path);
@@ -1197,7 +1197,7 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
size_t size;
size_t outsize;
struct fuse_file_info fi;
-
+
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
@@ -1209,13 +1209,13 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
(unsigned long) arg->fh, arg->size, arg->offset);
fflush(stdout);
}
-
+
res = -ENOSYS;
if (f->op.read)
res = f->op.read(path, buf, arg->size, arg->offset, &fi);
free(path);
}
-
+
size = 0;
if (res >= 0) {
size = res;
@@ -1230,7 +1230,7 @@ static void do_read(struct fuse *f, struct fuse_in_header *in,
out->unique = in->unique;
out->error = res;
outsize = sizeof(struct fuse_out_header) + size;
-
+
send_reply_raw(f, outbuf, outsize);
free(outbuf);
}
@@ -1263,8 +1263,8 @@ static void do_write(struct fuse *f, struct fuse_in_header *in,
res = f->op.write(path, PARAM(arg), arg->size, arg->offset, &fi);
free(path);
}
-
- if (res >= 0) {
+
+ if (res >= 0) {
outarg.size = res;
res = 0;
}
@@ -1369,7 +1369,7 @@ static void do_setxattr(struct fuse *f, struct fuse_in_header *in,
if (f->op.setxattr)
res = f->op.setxattr(path, name, value, arg->size, arg->flags);
free(path);
- }
+ }
send_reply(f, in, res, NULL, 0);
}
@@ -1386,7 +1386,7 @@ static int common_getxattr(struct fuse *f, struct fuse_in_header *in,
if (f->op.getxattr)
res = f->op.getxattr(path, name, value, size);
free(path);
- }
+ }
return res;
}
@@ -1400,7 +1400,7 @@ static void do_getxattr_read(struct fuse *f, struct fuse_in_header *in,
else {
struct fuse_out_header *out = (struct fuse_out_header *) outbuf;
char *value = outbuf + sizeof(struct fuse_out_header);
-
+
res = common_getxattr(f, in, name, value, size);
size = 0;
if (res > 0) {
@@ -1410,7 +1410,7 @@ static void do_getxattr_read(struct fuse *f, struct fuse_in_header *in,
memset(out, 0, sizeof(struct fuse_out_header));
out->unique = in->unique;
out->error = res;
-
+
send_reply_raw(f, outbuf, sizeof(struct fuse_out_header) + size);
free(outbuf);
}
@@ -1434,7 +1434,7 @@ static void do_getxattr(struct fuse *f, struct fuse_in_header *in,
struct fuse_getxattr_in *arg)
{
char *name = PARAM(arg);
-
+
if (arg->size)
do_getxattr_read(f, in, name, arg->size);
else
@@ -1454,7 +1454,7 @@ static int common_listxattr(struct fuse *f, struct fuse_in_header *in,
if (f->op.listxattr)
res = f->op.listxattr(path, list, size);
free(path);
- }
+ }
return res;
}
@@ -1468,7 +1468,7 @@ static void do_listxattr_read(struct fuse *f, struct fuse_in_header *in,
else {
struct fuse_out_header *out = (struct fuse_out_header *) outbuf;
char *list = outbuf + sizeof(struct fuse_out_header);
-
+
res = common_listxattr(f, in, list, size);
size = 0;
if (res > 0) {
@@ -1478,7 +1478,7 @@ static void do_listxattr_read(struct fuse *f, struct fuse_in_header *in,
memset(out, 0, sizeof(struct fuse_out_header));
out->unique = in->unique;
out->error = res;
-
+
send_reply_raw(f, outbuf, sizeof(struct fuse_out_header) + size);
free(outbuf);
}
@@ -1519,7 +1519,7 @@ static void do_removexattr(struct fuse *f, struct fuse_in_header *in,
if (f->op.removexattr)
res = f->op.removexattr(path, name);
free(path);
- }
+ }
send_reply(f, in, res, NULL, 0);
}
@@ -1558,7 +1558,7 @@ static void do_opendir(struct fuse *f, struct fuse_in_header *in,
dh->fuse = f;
dh->fp = tmpfile();
dh->filled = 0;
-
+
res = -EIO;
if (dh->fp == NULL) {
perror("fuse: failed to create temporary file");
@@ -1606,7 +1606,7 @@ static void do_readdir(struct fuse *f, struct fuse_in_header *in,
out->unique = in->unique;
out->error = res;
outsize = sizeof(struct fuse_out_header) + size;
-
+
send_reply_raw(f, outbuf, outsize);
free(outbuf);
}
@@ -1654,9 +1654,9 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
ctx->uid = in->uid;
ctx->gid = in->gid;
ctx->pid = in->pid;
-
+
argsize = cmd->buflen - sizeof(struct fuse_in_header);
-
+
switch (in->opcode) {
case FUSE_LOOKUP:
do_lookup(f, in, (char *) inarg);
@@ -1681,11 +1681,11 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
case FUSE_MKNOD:
do_mknod(f, in, (struct fuse_mknod_in *) inarg);
break;
-
+
case FUSE_MKDIR:
do_mkdir(f, in, (struct fuse_mkdir_in *) inarg);
break;
-
+
case FUSE_UNLINK:
do_unlink(f, in, (char *) inarg);
break;
@@ -1695,14 +1695,14 @@ void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd)
break;
case FUSE_SYMLINK:
- do_symlink(f, in, (char *) inarg,
+ do_symlink(f, in, (char *) inarg,
((char *) inarg) + strlen((char *) inarg) + 1);
break;
case FUSE_RENAME:
do_rename(f, in, (struct fuse_rename_in *) inarg);
break;
-
+
case FUSE_LINK:
do_link(f, in, (struct fuse_link_in *) inarg);
break;
@@ -1806,13 +1806,13 @@ struct fuse_cmd *fuse_read_cmd(struct fuse *f)
free_cmd(cmd);
if (fuse_exited(f) || errno == EINTR || errno == ENOENT)
return NULL;
-
+
/* ENODEV means we got unmounted, so we silenty return failure */
if (errno != ENODEV) {
/* BAD... This will happen again */
perror("fuse: reading device");
}
-
+
fuse_exit(f);
return NULL;
}
@@ -1824,7 +1824,7 @@ struct fuse_cmd *fuse_read_cmd(struct fuse *f)
return NULL;
}
cmd->buflen = res;
-
+
/* Forget is special, it can be done without messing with threads. */
if (in->opcode == FUSE_FORGET) {
do_forget(f, in, (struct fuse_forget_in *) inarg);
@@ -1903,7 +1903,7 @@ static int parse_lib_opts(struct fuse *f, const char *opts)
fprintf(stderr, "fuse: memory allocation failed\n");
return -1;
}
-
+
while((opt = strsep(&s, ","))) {
if (strcmp(opt, "debug") == 0)
f->flags |= FUSE_DEBUG;
@@ -1911,7 +1911,7 @@ static int parse_lib_opts(struct fuse *f, const char *opts)
f->flags |= FUSE_HARD_REMOVE;
else if (strcmp(opt, "use_ino") == 0)
f->flags |= FUSE_USE_INO;
- else
+ else
fprintf(stderr, "fuse: warning: unknown option `%s'\n", opt);
}
free(xopts);
diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c
index 131bae3..2e43671 100644
--- a/lib/fuse_mt.c
+++ b/lib/fuse_mt.c
@@ -101,7 +101,7 @@ static int start_thread(struct fuse_worker *w, pthread_t *thread_id)
fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
return -1;
}
-
+
pthread_detach(*thread_id);
return 0;
}
@@ -130,7 +130,7 @@ static int mt_create_context_key()
if (err)
fprintf(stderr, "fuse: failed to create thread specific key: %s\n",
strerror(err));
- else
+ else
fuse_set_getcontext_func(mt_getcontext);
}
if (!err)
@@ -155,7 +155,7 @@ int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data)
struct fuse_worker *w;
int i;
- w = malloc(sizeof(struct fuse_worker));
+ w = malloc(sizeof(struct fuse_worker));
if (w == NULL) {
fprintf(stderr, "fuse: failed to allocate worker structure\n");
return -1;
diff --git a/lib/helper.c b/lib/helper.c
index 365b813..879a694 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -24,7 +24,7 @@ static void usage(const char *progname)
fprintf(stderr,
"usage: %s mountpoint [FUSE options]\n\n", progname);
- fprintf(stderr,
+ fprintf(stderr,
"FUSE options:\n"
" -d enable debug output (implies -f)\n"
" -f foreground operation\n"
@@ -72,7 +72,7 @@ static int set_one_signal_handler(int signal, void (*handler)(int))
perror("FUSE: cannot get old signal handler");
return -1;
}
-
+
if (old_sa.sa_handler == SIG_DFL &&
sigaction(signal, &sa, NULL) == -1) {
perror("Cannot set signal handler");
@@ -158,7 +158,7 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
int argctr;
const char *basename;
char *fsname_opt;
-
+
*kernel_opts = NULL;
*lib_opts = NULL;
*mountpoint = NULL;
@@ -181,7 +181,7 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
free(fsname_opt);
if (res == -1)
goto err;
-
+
for (argctr = 1; argctr < argc; argctr ++) {
if (argv[argctr][0] == '-') {
if (strlen(argv[argctr]) == 2)
@@ -197,13 +197,13 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
if (res == -1)
goto err;
break;
-
+
case 'd':
res = add_options(lib_opts, kernel_opts, "debug");
if (res == -1)
goto err;
break;
-
+
case 'r':
res = add_options(lib_opts, kernel_opts, "ro");
if (res == -1)
@@ -217,11 +217,11 @@ static int fuse_parse_cmdline(int argc, const char *argv[], char **kernel_opts,
case 's':
*multithreaded = 0;
break;
-
+
case 'h':
usage(argv[0]);
goto err;
-
+
default:
invalid_option(argv, argctr);
goto err;
@@ -341,7 +341,7 @@ struct fuse *fuse_setup_compat2(int argc, char *argv[],
char **mountpoint, int *multithreaded,
int *fd)
{
- return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
+ return fuse_setup_common(argc, argv, (struct fuse_operations *) op,
sizeof(struct fuse_operations_compat2),
mountpoint, multithreaded, fd, 21);
}
@@ -373,16 +373,16 @@ static int fuse_main_common(int argc, char *argv[],
&multithreaded, &fd, compat);
if (fuse == NULL)
return 1;
-
+
if (multithreaded)
res = fuse_loop_mt(fuse);
else
res = fuse_loop(fuse);
-
+
fuse_teardown(fuse, fd, mountpoint);
if (res == -1)
return 1;
-
+
return 0;
}
@@ -402,7 +402,7 @@ int fuse_main()
void fuse_main_compat1(int argc, char *argv[],
const struct fuse_operations_compat1 *op)
{
- fuse_main_common(argc, argv, (struct fuse_operations *) op,
+ fuse_main_common(argc, argv, (struct fuse_operations *) op,
sizeof(struct fuse_operations_compat1), 11);
}
diff --git a/lib/mount.c b/lib/mount.c
index fb29f57..86ad2be 100644
--- a/lib/mount.c
+++ b/lib/mount.c
@@ -57,7 +57,7 @@ static int receive_fd(int fd)
/* EOF */
return -1;
}
-
+
cmsg = CMSG_FIRSTHDR(&msg);
if (!cmsg->cmsg_type == SCM_RIGHTS) {
fprintf(stderr, "got control message of unknown type %d\n",
@@ -71,10 +71,10 @@ void fuse_unmount(const char *mountpoint)
{
const char *mountprog = FUSERMOUNT_PROG;
char umount_cmd[1024];
-
+
snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u -q -z %s", mountprog,
mountpoint);
-
+
umount_cmd[sizeof(umount_cmd) - 1] = '\0';
system(umount_cmd);
}