home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: sfs_ops.c,v 5.1.1.1 90/01/11 17:20:21 jsp Exp Locker: jsp $
- *
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Imperial College of Science, Technology and Medicine, London, UK.
- * The names of the College and University may not be used to endorse
- * or promote products derived from this software without specific
- * prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * %W% (Berkeley) %G%
- */
-
- #include "am.h"
-
- #ifdef HAS_SFS
-
- /*
- * Symbol-link file system
- */
-
- /*
- * SFS needs a link.
- */
- static int sfs_match(fo)
- am_opts *fo;
- {
- if (!fo->opt_fs) {
- plog(XLOG_USER, "link: no fs specified");
- return 0;
- }
-
- /*
- * Bug report (14/12/89) from Jay Plett <jay@princeton.edu>
- * If an automount point has the same name as an existing
- * link type mount Amd hits a race condition and either hangs
- * or causes a symlink loop.
- *
- * If fs begins with a '/' change the opt_fs & opt_sublink
- * fields so that the fs option doesn't end up pointing at
- * an existing symlink.
- *
- * If sublink is nil then set sublink to fs
- * else set sublink to fs / sublink
- *
- * Finally set fs to ".".
- */
- if (*fo->opt_fs == '/') {
- char *fullpath;
- char *link = fo->opt_sublink;
- if (link) {
- if (*link == '/')
- fullpath = strdup(link);
- else
- fullpath = str3cat((char *)0, fo->opt_fs, "/", link);
- } else {
- fullpath = strdup(fo->opt_fs);
- }
-
- if (fo->opt_sublink)
- free(fo->opt_sublink);
- fo->opt_sublink = fullpath;
- free(fo->opt_fs);
- fo->opt_fs = strdup(".");
- }
-
- fo->fs_mtab = strealloc(fo->fs_mtab, fo->opt_fs);
-
- return 1;
- }
-
- /*ARGUSED*/
- static int sfs_mount(mp)
- am_node *mp;
- {
- /*
- * Wow - this is hard to implement!
- */
-
- return 0;
- }
-
- /*ARGUSED*/
- static int sfs_umount(mp)
- am_node *mp;
- {
- return 0;
- }
-
- /*
- * Ops structure
- */
- am_ops sfs_ops = {
- "link",
- sfs_match,
- 0, /* sfs_init */
- sfs_mount,
- sfs_umount,
- efs_lookuppn,
- efs_readdir,
- 0, /* sfs_readlink */
- 0, /* sfs_mounted */
- 0, /* sfs_umounted */
- find_afs_srvr,
- FS_UBACKGROUND,
- &afs_srvr_list
- };
-
- #endif
-