/*
- $Id: dircache.c,v 1.1.2.5 2010-02-05 12:56:13 franklahm Exp $
+ $Id: dircache.c,v 1.1.2.6 2010-02-09 14:56:30 franklahm Exp $
Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
This program is free software; you can redistribute it and/or modify
/*!
* @brief Remove an entry from the dircache
*
- * FIXME what about opened forks with refs to it?
- * it's an afp specs violation because you can't delete
- * an opened forks. Now afpd doesn't care about forks opened by other
- * process. It's fixable within afpd if fnctl_lock, doable with smb and
- * next to impossible for nfs and local filesystem access.
+ * Callers outside of dircache.c should call this with
+ * flags = QUEUE_INDEX | DIDNAME_INDEX | DIRCACHE.
*/
void dircache_remove(const struct vol *vol _U_, struct dir *dir, int flags)
{
/*
- * $Id: directory.c,v 1.131.2.11 2010-02-05 12:56:13 franklahm Exp $
+ * $Id: directory.c,v 1.131.2.12 2010-02-09 14:56:30 franklahm Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
* FIXMEs, loose ends after the dircache rewrite:
* o merge dircache_search_by_name and dir_add ??
* o case-insensitivity is gone from cname
- * o directory offspring count calculation probably broken
- * o doesn't work with CNID backend last and the like,
- * CNID backend must support persistent CNIDs.
*/
/*
- * $Id: ofork.c,v 1.30.4.3 2010-02-05 10:38:53 franklahm Exp $
+ * $Id: ofork.c,v 1.30.4.4 2010-02-09 14:56:30 franklahm Exp $
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
path->st_valid = 1;
if ((ret = stat(path->u_name, &path->st)) < 0) {
LOG(log_debug, logtype_afpd, "of_stat: {'%s/%s': %s}",
- getcwdpath(), path->u_name, strerror(errno));
+ cfrombstring(curdir->d_fullpath), path->u_name, strerror(errno));
path->st_errno = errno;
}
return ret;
/*
- * $Id: volume.c,v 1.115.2.1 2010-02-01 10:56:08 franklahm Exp $
+ * $Id: volume.c,v 1.115.2.2 2010-02-09 14:56:30 franklahm Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
options[VOLOPT_FLAGS].i_value &= ~AFPVOL_CACHE;
else if (strcasecmp(p, "tm") == 0)
options[VOLOPT_FLAGS].i_value |= AFPVOL_TM;
+ else if (strcasecmp(p, "eject") == 0)
+ options[VOLOPT_FLAGS].i_value |= AFPVOL_EJECT | AFPVOL_RO;
p = strtok(NULL, ",");
}
volume->v_cnidscheme = strdup(DEFAULT_CNID_SCHEME);
LOG(log_info, logtype_afpd, "Volume %s use CNID scheme %s.", volume->v_path, volume->v_cnidscheme);
}
+
+ /* Legacy pre 2.1 way of sharing eg CD-ROM */
+ if (strcmp(volume->v_cnidscheme, "last") == 0) {
+ /* "last" is gone. We support it by switching to in-memory "tdb" */
+ volume->v_cnidscheme = strdup("tdb");
+ flags |= CNID_FLAG_MEMORY;
+ }
+
+ /* New way of sharing CD-ROM */
+ if (volume->v_flags & AFPVOL_EJECT) {
+ flags |= CNID_FLAG_MEMORY;
+ if (strcmp(volume->v_cnidscheme, "tdb") != 0) {
+ free(volume->v_cnidscheme);
+ volume->v_cnidscheme = strdup("tdb");
+ LOG(log_info, logtype_afpd, "Volume %s is ejectable, switching to scheme %s.",
+ volume->v_path, volume->v_cnidscheme);
+ }
+ }
+
if (volume->v_dbpath)
volume->v_cdb = cnid_open (volume->v_dbpath, volume->v_umask, volume->v_cnidscheme, flags);
else
volume->v_cdb = cnid_open (volume->v_path, volume->v_umask, volume->v_cnidscheme, flags);
- if (!volume->v_cdb) {
+ if ( ! volume->v_cdb && ! (flags & CNID_FLAG_MEMORY)) {
+ /* The first attempt failed and it wasn't yet an attempt to open in-memory */
flags |= CNID_FLAG_MEMORY;
LOG(log_error, logtype_afpd, "Reopen volume %s using in memory temporary CNID DB.", volume->v_path);
volume->v_cdb = cnid_open (volume->v_path, volume->v_umask, "tdb", flags);
/*
- * $Id: volume.h,v 1.11.2.1 2010-02-01 10:56:08 franklahm Exp $
+ * $Id: volume.h,v 1.11.2.2 2010-02-09 14:56:30 franklahm Exp $
*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
/*
Flags that alter volume behaviour.
- Keep in sync with include/atalk/volinfo.h and libatalk/util/volinfo.c
+ Keep in sync with libatalk/util/volinfo.c
*/
#define AFPVOL_A2VOL (1 << 5) /* prodos volume */
#define AFPVOL_CRLF (1 << 6) /* cr/lf translation */
#define AFPVOL_INV_DOTS (1 << 22) /* dots files are invisible */
#define AFPVOL_TM (1 << 24) /* Supports TimeMachine */
#define AFPVOL_ACLS (1 << 25) /* Volume supports ACLS */
+#define AFPVOL_EJECT (1 << 25) /* Ejectable media eg CD -> in memory CNID db */
/* Extended Attributes vfs indirection */
#define AFPVOL_EA_NONE 0 /* No EAs */
{AFPVOL_INV_DOTS, "INVISIBLEDOTS"},
{AFPVOL_ACLS, "ACLS"}, /* Vol supports ACLs */
{AFPVOL_TM, "TM"}, /* Set "kSupportsTMLockSteal" is volume attributes */
+ {AFPVOL_EJECT, "EJECT"}, /* Ejectable media eg CD -> in memory CNID db */
{0, NULL}
};