aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pfuse
diff options
context:
space:
mode:
authorDan Cross <cross@gajendra.net>2020-01-10 14:44:21 +0000
committerDan Cross <cross@gajendra.net>2020-01-10 14:54:30 +0000
commitfa325e9b42b0bdfb48857d1958d9fb7ceac55151 (patch)
tree81d26256d152435135bcb1ae43121979a49f5f2b /src/cmd/9pfuse
parent77a0a5b5194d4441c86de097f2aae297cb75e2c2 (diff)
downloadplan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.gz
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.bz2
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.zip
Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r--src/cmd/9pfuse/errstr.c3
-rw-r--r--src/cmd/9pfuse/fuse.c44
-rw-r--r--src/cmd/9pfuse/main.c74
3 files changed, 60 insertions, 61 deletions
diff --git a/src/cmd/9pfuse/errstr.c b/src/cmd/9pfuse/errstr.c
index e03d9589..e3a122e4 100644
--- a/src/cmd/9pfuse/errstr.c
+++ b/src/cmd/9pfuse/errstr.c
@@ -55,7 +55,7 @@ errstr2errno(void)
{
char e[ERRMAX];
int i, len;
-
+
if(errno != EPLAN9)
return errno;
@@ -70,4 +70,3 @@ errstr2errno(void)
return errortab[i].err;
return ERANGE; /* who knows - be blatantly wrong */
}
-
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
index 66f66065..4c9aac9b 100644
--- a/src/cmd/9pfuse/fuse.c
+++ b/src/cmd/9pfuse/fuse.c
@@ -15,7 +15,7 @@ allocfusemsg(void)
{
FuseMsg *m;
void *vbuf;
-
+
lock(&fusemsglock);
if((m = fusemsglist) != nil){
fusemsglist = m->next;
@@ -46,7 +46,7 @@ readfusemsg(void)
{
FuseMsg *m;
int n, nn;
-
+
m = allocfusemsg();
/*
* The FUSE kernel device apparently guarantees
@@ -84,7 +84,7 @@ readfusemsg(void)
sysfatal("readfusemsg: got %d wanted %d",
n, m->hdr->len);
m->hdr->len -= sizeof(*m->hdr);
-
+
/*
* Paranoia.
* Make sure lengths are long enough.
@@ -125,7 +125,7 @@ readfusemsg(void)
if(((char*)m->tx)[m->hdr->len-1] != 0
|| memchr(m->tx, 0, m->hdr->len-1) == 0)
goto bad;
- break;
+ break;
case FUSE_MKNOD:
if(m->hdr->len <= sizeof(struct fuse_mknod_in)
|| ((char*)m->tx)[m->hdr->len-1] != 0)
@@ -219,7 +219,7 @@ readfusemsg(void)
}
/*
- * Reply to FUSE request m using additonal
+ * Reply to FUSE request m using additonal
* argument buffer arg of size narg bytes.
* Perhaps should free the FuseMsg here?
*/
@@ -229,7 +229,7 @@ replyfuse(FuseMsg *m, void *arg, int narg)
struct iovec vec[2];
struct fuse_out_header hdr;
int nvec;
-
+
hdr.len = sizeof hdr + narg;
hdr.error = 0;
hdr.unique = m->hdr->unique;
@@ -255,7 +255,7 @@ void
replyfuseerrno(FuseMsg *m, int e)
{
struct fuse_out_header hdr;
-
+
hdr.len = sizeof hdr;
hdr.error = -e; /* FUSE sends negative errnos. */
hdr.unique = m->hdr->unique;
@@ -307,12 +307,12 @@ initfuse(char *mtpt)
/*
* Complain if the kernel is too new.
* We could forge ahead, but at least the one time I tried,
- * the kernel rejected the newer version by making the
+ * the kernel rejected the newer version by making the
* writev fail in replyfuse, which is a much more confusing
- * error message. In the future, might be nice to try to
+ * error message. In the future, might be nice to try to
* support older versions that differ only slightly.
*/
- if(tx->major < FUSE_KERNEL_VERSION
+ if(tx->major < FUSE_KERNEL_VERSION
|| (tx->major == FUSE_KERNEL_VERSION && tx->minor < FUSE_KERNEL_MINOR_VERSION))
sysfatal("fuse: too kernel version %d.%d older than program version %d.%d",
tx->major, tx->minor, FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);
@@ -386,7 +386,7 @@ fusefmt(Fmt *fmt)
}
case FUSE_SYMLINK: {
char *old, *new;
-
+
old = a;
new = a + strlen(a) + 1;
fmtprint(fmt, "Symlink nodeid %#llux old %#q new %#q",
@@ -455,7 +455,7 @@ fusefmt(Fmt *fmt)
case FUSE_RELEASE: {
struct fuse_release_in *tx = a;
fmtprint(fmt, "Release nodeid %#llux fh %#llux flags %#ux",
- hdr->nodeid, tx->fh, tx->flags);
+ hdr->nodeid, tx->fh, tx->flags);
break;
}
case FUSE_FSYNC: {
@@ -516,7 +516,7 @@ fusefmt(Fmt *fmt)
case FUSE_RELEASEDIR: {
struct fuse_release_in *tx = a;
fmtprint(fmt, "Releasedir nodeid %#llux fh %#llux flags %#ux",
- hdr->nodeid, tx->fh, tx->flags);
+ hdr->nodeid, tx->fh, tx->flags);
break;
}
case FUSE_FSYNCDIR: {
@@ -554,7 +554,7 @@ fusefmt(Fmt *fmt)
case FUSE_LOOKUP: {
/*
* For a negative entry, can send back ENOENT
- * or rx->ino == 0.
+ * or rx->ino == 0.
* In protocol version 7.4 and before, can only use
* the ENOENT method.
* Presumably the benefit of sending rx->ino == 0
@@ -571,7 +571,7 @@ fusefmt(Fmt *fmt)
rx->attr_valid+rx->attr_valid_nsec*1e-9);
fmtprint(fmt, " ino %#llux size %lld blocks %lld atime %.20g mtime %.20g ctime %.20g mode %#uo nlink %d uid %d gid %d rdev %#ux",
rx->attr.ino, rx->attr.size, rx->attr.blocks,
- rx->attr.atime+rx->attr.atimensec*1e-9,
+ rx->attr.atime+rx->attr.atimensec*1e-9,
rx->attr.mtime+rx->attr.mtimensec*1e-9,
rx->attr.ctime+rx->attr.ctimensec*1e-9,
rx->attr.mode, rx->attr.nlink, rx->attr.uid,
@@ -592,7 +592,7 @@ fusefmt(Fmt *fmt)
rx->attr_valid+rx->attr_valid_nsec*1e-9);
fmtprint(fmt, " ino %#llux size %lld blocks %lld atime %.20g mtime %.20g ctime %.20g mode %#uo nlink %d uid %d gid %d rdev %#ux",
rx->attr.ino, rx->attr.size, rx->attr.blocks,
- rx->attr.atime+rx->attr.atimensec*1e-9,
+ rx->attr.atime+rx->attr.atimensec*1e-9,
rx->attr.mtime+rx->attr.mtimensec*1e-9,
rx->attr.ctime+rx->attr.ctimensec*1e-9,
rx->attr.mode, rx->attr.nlink, rx->attr.uid,
@@ -733,7 +733,7 @@ fusefmt(Fmt *fmt)
rx->e.attr_valid+rx->e.attr_valid_nsec*1e-9);
fmtprint(fmt, " ino %#llux size %lld blocks %lld atime %.20g mtime %.20g ctime %.20g mode %#uo nlink %d uid %d gid %d rdev %#ux",
rx->e.attr.ino, rx->e.attr.size, rx->e.attr.blocks,
- rx->e.attr.atime+rx->e.attr.atimensec*1e-9,
+ rx->e.attr.atime+rx->e.attr.atimensec*1e-9,
rx->e.attr.mtime+rx->e.attr.mtimensec*1e-9,
rx->e.attr.ctime+rx->e.attr.ctimensec*1e-9,
rx->e.attr.mode, rx->e.attr.nlink, rx->e.attr.uid,
@@ -753,7 +753,7 @@ fusefmt(Fmt *fmt)
/*
* Mounts a fuse file system on mtpt and returns
- * a file descriptor for the corresponding fuse
+ * a file descriptor for the corresponding fuse
* message conversation.
*/
int
@@ -762,7 +762,7 @@ mountfuse(char *mtpt)
#if defined(__linux__)
int p[2], pid, fd;
char buf[20];
-
+
if(socketpair(AF_UNIX, SOCK_STREAM, 0, p) < 0)
return -1;
pid = fork();
@@ -783,11 +783,11 @@ mountfuse(char *mtpt)
#elif defined(__FreeBSD__) && !defined(__APPLE__)
int pid, fd;
char buf[20];
-
+
if((fd = open("/dev/fuse", ORDWR)) < 0)
return -1;
snprint(buf, sizeof buf, "%d", fd);
-
+
pid = fork();
if(pid < 0)
return -1;
@@ -903,7 +903,7 @@ mountfuse(char *mtpt)
_exit(1);
}
return fd;
-
+
#else
werrstr("cannot mount fuse on this system");
return -1;
diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
index a3662898..0d4adb08 100644
--- a/src/cmd/9pfuse/main.c
+++ b/src/cmd/9pfuse/main.c
@@ -14,7 +14,7 @@
* writing the 9P connection. Thus the many threads in the
* request proc can do 9P interactions without blocking.
*/
-
+
#define _GNU_SOURCE 1 /* for O_DIRECTORY on Linux */
#include "a.h"
@@ -165,16 +165,16 @@ init9p(char *addr, char *spec)
/*
* FUSE uses nodeids to refer to active "struct inodes"
* (9P's unopened fids). FUSE uses fhs to refer to active
- * "struct fuse_files" (9P's opened fids). The choice of
+ * "struct fuse_files" (9P's opened fids). The choice of
* numbers is up to us except that nodeid 1 is the root directory.
- * We use the same number space for both and call the
+ * We use the same number space for both and call the
* bookkeeping structure a FuseFid.
*
- * FUSE requires nodeids to have associated generation
- * numbers. If we reuse a nodeid, we have to bump the
+ * FUSE requires nodeids to have associated generation
+ * numbers. If we reuse a nodeid, we have to bump the
* generation number to guarantee that the nodeid,gen
* combination is never reused.
- *
+ *
* There are also inode numbers returned in directory reads
* and file attributes, but these do NOT need to match the nodeids.
* We use a combination of qid.path and qid.type as the inode
@@ -192,7 +192,7 @@ struct Fusefid
int id;
int gen;
int isnodeid;
-
+
/* directory read state */
Dir *d0;
Dir *d;
@@ -208,7 +208,7 @@ Fusefid*
allocfusefid(void)
{
Fusefid *f;
-
+
if((f = freefusefidlist) == nil){
f = emalloc(sizeof *f);
fusefid = erealloc(fusefid, (nfusefid+1)*sizeof *fusefid);
@@ -247,7 +247,7 @@ uvlong
_alloc(CFid *fid, int isnodeid)
{
Fusefid *ff;
-
+
ff = allocfusefid();
ff->fid = fid;
ff->isnodeid = isnodeid;
@@ -283,7 +283,7 @@ CFid*
_lookupcfid(uvlong id, int isnodeid)
{
Fusefid *ff;
-
+
if((ff = lookupfusefid(id, isnodeid)) == nil)
return nil;
return ff->fid;
@@ -360,7 +360,7 @@ fuselookup(FuseMsg *m)
CFid *fid, *newfid;
Dir *d;
struct fuse_entry_out out;
-
+
name = m->tx;
if((fid = nodeid2fid(m->hdr->nodeid)) == nil){
replyfuseerrno(m, ESTALE);
@@ -392,7 +392,7 @@ fuselookup(FuseMsg *m)
/*
* Forget. Reference-counted clunk for nodeids.
* Does not send a reply.
- * Each lookup response gives the kernel an additional reference
+ * Each lookup response gives the kernel an additional reference
* to the returned nodeid. Forget says "drop this many references
* to this nodeid". Our fuselookup, when presented with the same query,
* does not return the same results (it allocates a new nodeid for each
@@ -423,7 +423,7 @@ fuseforget(FuseMsg *m)
* Getattr.
* Replies with a fuse_attr_out structure giving the
* attr for the requested nodeid in out.attr.
- * Out.attr_valid and out.attr_valid_nsec give
+ * Out.attr_valid and out.attr_valid_nsec give
* the amount of time that the attributes can
* be cached.
*
@@ -479,7 +479,7 @@ fusesetattr(FuseMsg *m)
/*
* Special case: Linux issues a size change to
* truncate a file before opening it OTRUNC.
- * Synthetic file servers (e.g., plumber) honor
+ * Synthetic file servers (e.g., plumber) honor
* open(OTRUNC) but not wstat.
*/
if(in->valid == FATTR_SIZE && in->size == 0){
@@ -554,7 +554,7 @@ _fuseopenfid(uvlong nodeid, int isdir, int openmode, int *err)
*err = errstr2errno();
return nil;
}
-
+
if(fsfopen(newfid, openmode) < 0){
*err = errstr2errno();
fsclose(newfid);
@@ -617,7 +617,7 @@ _fuseopen(FuseMsg *m, int isdir)
return;
}
out.fh = allocfh(fid);
- out.open_flags = FOPEN_DIRECT_IO; /* no page cache */
+ out.open_flags = FOPEN_DIRECT_IO; /* no page cache */
replyfuse(m, &out, sizeof out);
}
@@ -696,7 +696,7 @@ fusemkdir(FuseMsg *m)
CFid *fid;
int err;
char *name;
-
+
in = m->tx;
name = (char*)(in+1);
if((fid = _fusecreate(m->hdr->nodeid, name, in->mode, 1, OREAD, &out, &err)) == nil){
@@ -716,7 +716,7 @@ fusecreate(FuseMsg *m)
CFid *fid;
int err, openmode, flags;
char *name;
-
+
in = m->tx;
flags = in->flags;
openmode = in->flags&3;
@@ -740,7 +740,7 @@ fusecreate(FuseMsg *m)
}
/*
- * Access.
+ * Access.
* Lib9pclient implements this just as Plan 9 does,
* by opening the file (or not) and then closing it.
*/
@@ -760,7 +760,7 @@ fuseaccess(FuseMsg *m)
ORDWR,
ORDWR
};
-
+
in = m->tx;
if(in->mask >= nelem(a2o)){
replyfuseerrno(m, EINVAL);
@@ -791,7 +791,7 @@ fuserelease(FuseMsg *m)
{
struct fuse_release_in *in;
Fusefid *ff;
-
+
in = m->tx;
if((ff = lookupfusefid(in->fh, 0)) != nil)
freefusefid(ff);
@@ -864,7 +864,7 @@ fusereadlink(FuseMsg *m)
return;
}
-/*
+/*
* Readdir.
* Read from file handle in->fh at offset in->offset for size in->size.
* We truncate size to maxwrite just to keep the buffer reasonable.
@@ -884,12 +884,12 @@ fusereaddir(FuseMsg *m)
uchar *buf, *p, *ep;
int n;
Fusefid *ff;
-
+
in = m->tx;
if((ff = lookupfusefid(in->fh, 0)) == nil){
replyfuseerrno(m, ESTALE);
return;
- }
+ }
if(in->offset == 0){
fsseek(ff->fid, 0, 0);
free(ff->d0);
@@ -922,7 +922,7 @@ fusereaddir(FuseMsg *m)
break;
ff->d = ff->d0;
}
-out:
+out:
replyfuse(m, buf, p - buf);
free(buf);
}
@@ -958,7 +958,7 @@ canpack(Dir *d, uvlong off, uchar **pp, uchar *ep)
uchar *p;
struct fuse_dirent *de;
int pad, size;
-
+
p = *pp;
size = FUSE_NAME_OFFSET + strlen(d->name);
pad = 0;
@@ -981,7 +981,7 @@ canpack(Dir *d, uvlong off, uchar **pp, uchar *ep)
* Write.
* Write from file handle in->fh at offset in->offset for size in->size.
* Don't know what in->write_flags means.
- *
+ *
* Apparently implementations are allowed to buffer these writes
* and wait until Flush is sent, but FUSE docs say flush may be
* called zero, one, or even more times per close. So better do the
@@ -996,7 +996,7 @@ fusewrite(FuseMsg *m)
void *a;
CFid *fid;
int n;
-
+
in = m->tx;
a = in+1;
if((fid = fh2fid(in->fh)) == nil){
@@ -1018,7 +1018,7 @@ fusewrite(FuseMsg *m)
/*
* Flush. Supposed to flush any buffered writes. Don't use this.
- *
+ *
* Flush is a total crock. It gets called on close() of a file descriptor
* associated with this open file. Some open files have multiple file
* descriptors and thus multiple closes of those file descriptors.
@@ -1027,7 +1027,7 @@ fusewrite(FuseMsg *m)
* closed explicitly. For those files, Flush is never called.
* Even more amusing, Flush gets called before close() of read-only
* file descriptors too!
- *
+ *
* This is just a bad idea.
*/
void
@@ -1044,7 +1044,7 @@ _fuseremove(FuseMsg *m, int isdir)
{
char *name;
CFid *fid, *newfid;
-
+
name = m->tx;
if((fid = nodeid2fid(m->hdr->nodeid)) == nil){
replyfuseerrno(m, ESTALE);
@@ -1105,7 +1105,7 @@ fuserename(FuseMsg *m)
char *before, *after;
CFid *fid, *newfid;
Dir d;
-
+
in = m->tx;
if(in->newdir != m->hdr->nodeid){
replyfuseerrno(m, EXDEV);
@@ -1146,7 +1146,7 @@ fusefsync(FuseMsg *m)
struct fuse_fsync_in *in;
CFid *fid;
Dir d;
-
+
in = m->tx;
if((fid = fh2fid(in->fh)) == nil){
replyfuseerrno(m, ESTALE);
@@ -1181,7 +1181,7 @@ void
fusestatfs(FuseMsg *m)
{
struct fuse_statfs_out out;
-
+
memset(&out, 0, sizeof out);
replyfuse(m, &out, sizeof out);
}
@@ -1215,7 +1215,7 @@ struct {
{ FUSE_FSYNC, fusefsync },
/*
* FUSE_SETXATTR, FUSE_GETXATTR, FUSE_LISTXATTR, and
- * FUSE_REMOVEXATTR are unimplemented.
+ * FUSE_REMOVEXATTR are unimplemented.
* FUSE will stop sending these requests after getting
* an -ENOSYS reply (see dispatch below).
*/
@@ -1237,7 +1237,7 @@ fusethread(void *v)
FuseMsg *m;
m = v;
- if((uint)m->hdr->opcode >= nelem(fusehandlers)
+ if((uint)m->hdr->opcode >= nelem(fusehandlers)
|| !fusehandlers[m->hdr->opcode]){
replyfuseerrno(m, ENOSYS);
return;
@@ -1267,7 +1267,7 @@ fusedispatch(void *v)
case FUSE_FORGET:
fusehandlers[m->hdr->opcode](m);
break;
- default:
+ default:
threadcreate(fusethread, m, STACK);
}
}