On Thu, 2008-08-07 at 10:38 -0700, Jim Carter wrote:
> On Thu, 7 Aug 2008, Ian Kent wrote:
>
> > Patch to add documentation for the miscellaneous device module of
> > autofs4.
>
> > +AUTOFS_DEV_IOCTL_SETPIPEFD_CMD
> > +------------------------------
> > +
> > +Set the pipe file descriptor used for kernel communication to the daemon.
> > +...In order to protect mounts against
> > +incorrectly setting the pipe descriptor we also require that the autofs
> > +mount be catatonic (see next call).
> > +
> > +The call requires an initialized struct autofs_dev_ioctl with the
> > +ioctlfd field set to the descriptor obtained from the open call...
>
> > +AUTOFS_DEV_IOCTL_CATATONIC_CMD
> > +------------------------------
> > +
> > +Make the autofs mount point catatonic...
> > +
> > +The call requires an initialized struct autofs_dev_ioctl with the
> > +ioctlfd field set to the descriptor obtained from the open call.
>
> I probably have it mixed up, which file descriptor is involved. Suppose
> the former incarnation of the userspace daemon just dies (kill -9, etc.)
> It will not set any mount points catatonic, so the new incarnation needs
> to do it, like this:
>
> const char* mtpt = "/net/whatever";
> int len = strlen(mtpt);
> if (len >= PATH_MAX) len = PATH_MAX - 1;
> int fdlist[2];
> int autoFD = open("/dev/autofs", flags);
> struct autofs_dev_ioctl* parms =
> calloc(1, sizeof(struct autofs_dev_ioctl) + PATH_MAX);
> parms->size = sizeof(struct autofs_dev_ioctl) + len + 1;
> memcpy(parms->path, mtpt, len+1);
> parms->ioctlfd = ?????;
> ioctl(autoFD, AUTOFS_DEV_IOCTL_CATATONIC_CMD, parms);
> socketpair(AF_UNIX, SOCK_DGRAM, 0, fdlist);
> parms>ioctlfd = fdlist[1];
> ioctl(autoFD, AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, parms);
This isn't quite how the interface is used.
>
> I don't see how userspace can unilaterally set the mount point catatonic,
> because it needs to set the mount point's file descriptor first, which can
> only be done if the mount point is already catatonic.
>
> Perhaps the documentation could be changed to head off the kind of
> misunderstanding(s) I think I have here.
It's probably better to wait for the user space patches that check for
and use this interface before we decide what changes are needed to the
documentation. There is a library of routines that demonstrate how the
interface is used. Give me a change to deal with the feedback on the
kernel patches before I post the daemon patches.
>
> James F. Carter Voice 310 825 2897 FAX 310 206 6673
> UCLA-Mathnet; 6115 MSA; 520 Portola Plaza; Los Angeles, CA, USA 90095-1555
> Email: [EMAIL PROTECTED] http://www.math.ucla.edu/~jimc (q.v. for PGP key)
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs