9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David du Colombier <0intro@gmail.com>
To: 9fans@9fans.net
Subject: Re: [9fans] p9p vac/vacfs compatibility: uid/gid, ctime, 9P2000.L, 9pserve
Date: Mon,  2 Jan 2012 20:14:11 +0100	[thread overview]
Message-ID: <20120102201411.5c524a65@gmail.com> (raw)
In-Reply-To: <864nwet1z8.fsf@cmarib.ramside>

> Would you care to share?

Sure. But beware it's just a quick hack.

diff -r 92a579c6549c src/cmd/9pfuse/main.c
--- a/src/cmd/9pfuse/main.c     Mon Dec 12 16:44:50 2011 -0500
+++ b/src/cmd/9pfuse/main.c     Mon Jan 02 19:00:00 2012 +0100
@@ -837,6 +837,8 @@
 void
 fusereadlink(FuseMsg *m)
 {
+       int n;
+       uchar *buf;
        Dir *d;
        CFid *fid;

@@ -852,9 +854,19 @@
                replyfuseerrno(m, EINVAL);
                return;
        }
-       replyfuse(m, d->ext, strlen(d->ext));
+       n = d->length;
        free(d);
-       return;
+       if(n > fusemaxwrite)
+               n = fusemaxwrite;
+       buf = emalloc(n);
+       n = fsread(fid, buf, n);
+       if(n < 0){
+               free(buf);
+               replyfuseerrstr(m);
+               return;
+       }
+       replyfuse(m, buf, n);
+       free(buf);
 }

 /*
diff -r 92a579c6549c src/cmd/vac/vacfs.c
--- a/src/cmd/vac/vacfs.c       Mon Dec 12 16:44:50 2011 -0500
+++ b/src/cmd/vac/vacfs.c       Mon Jan 02 19:00:00 2012 +0100
@@ -548,8 +548,6 @@
                n = vacdirread(f, buf, off, cnt);
        else if(vacfilegetmode(f->file)&ModeDevice)
                return vtstrdup("device");
-       else if(vacfilegetmode(f->file)&ModeLink)
-               return vtstrdup("symbolic link");
        else if(vacfilegetmode(f->file)&ModeNamedPipe)
                return vtstrdup("named pipe");
        else

Then symlinks are working. Now you need to fix the uid/gid
problem and handle devices, named pipes and sockets in 9pserve.

Also, you should apply this patch:

http://codereview.appspot.com/download/issue5500097_1.diff

It fixes two problems:

 - fix segfault when the first file is DMSYMLINK or DMDEVICE,
 - set the buffer to zero before calling readlink.

Symlinks will not work without this patch.

--
David du Colombier



      reply	other threads:[~2012-01-02 19:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 21:48 smiley
2011-12-28 23:48 ` David du Colombier
2011-12-29 16:20   ` smiley
2011-12-29 17:34     ` David du Colombier
2011-12-30 16:59   ` Latchesar Ionkov
2011-12-30 17:15     ` David du Colombier
2012-01-02  6:50       ` smiley
2012-01-02 12:31         ` David du Colombier
2012-01-02 13:50         ` David du Colombier
2012-01-02 18:04           ` smiley
2012-01-02 19:14             ` David du Colombier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120102201411.5c524a65@gmail.com \
    --to=0intro@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).