cfsd_logelem.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Methods of the cfsd_logelem* classes.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <synch.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <libintl.h>
#include <errno.h>
#include <locale.h>
#include "cfsd.h"
#include "cfsd_maptbl.h"
#include "cfsd_logfile.h"
#include "cfsd_kmod.h"
#include "cfsd_logelem.h"
#define TIMECHANGE(A, B) (memcmp(&A, &B, sizeof (A)) != 0)
#define X_OPTIMIZED -2
#define X_CONFLICT -3
/*
* -----------------------------------------------------------------
* cfsd_logelem_create
*
* Description:
* Constructor for the cfsd_logelem abstract base class.
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_create");
dbug_leave("cfsd_logelem_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_destroy
*
* Description:
* Destructor for the cfsd_logelem abstract base class.
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("cfsd_logelem_destroy");
dbug_leave("cfsd_logelem_destroy");
}
/*
* -----------------------------------------------------------------
* logelem_print_cred
*
* Description:
* Arguments:
* credp
* Returns:
* Preconditions:
* precond(credp)
*/
void
{
char format[10];
int xx;
dbug_enter("logelem_print_cred");
buf[0] = '\0';
}
dbug_leave("logelem_print_cred");
}
/*
* -----------------------------------------------------------------
* logelem_print_attr
*
* Description:
* Arguments:
* vattrp
* Returns:
* Preconditions:
* precond(vattrp)
*/
void
{
dbug_enter("logelem_print_attr");
dbug_leave("logelem_print_attr");
}
/*
* -----------------------------------------------------------------
* logelem_format_fid
*
* Description:
* Arguments:
* fidp
* Returns:
* Preconditions:
* precond(fidp)
*/
void
{
int index;
char format[10];
sizeof (logelem_object_p->i_fidbuf));
}
}
/*
* -----------------------------------------------------------------
* logelem_lostfound
*
* Description:
* Called when there is a conflict on a file.
* Arguments:
* cidp cid of file to move to lost+found
* pcidp parent cid if known, else null
* namep name of file if known, else null
* Returns:
* Returns 0 for success, EIO if file could not be moved.
* Preconditions:
* precond(cidp)
*/
int
const char *namep,
{
struct cfs_dlog_mapping_space map;
int xx;
char namebuf[MAXNAMELEN];
int gotdirfid = 0;
int wrotefile = 0;
char *np;
int foundname = 0;
int index;
char *machnamep;
int len;
char newname[MAXNAMELEN];
#define MAXTRIES 10
dbug_enter("logelem_lostfound");
/* make an alternate name for the file */
/* get info about the file from the cache */
if (xx) {
}
dbug_leave("logelem_lostfound");
return (0);
}
/* determine what we want to call this file */
else
}
/* if not a regular file or not modified */
dbug_leave("logelem_lostfound");
return (0);
}
/* get the fid of the parent directory from the passed in cid */
if (pcidp) {
/* see if we have a valid mapping for the parent cid */
if (xx == -1) {
dbug_leave("logelem_lostfound");
return (EIO);
}
xx = logfile_offset(
if (xx) {
dbug_leave("logelem_lostfound");
return (EIO);
}
gotdirfid = 1;
}
}
/* otherwise try to get the fid from the cache */
if (gotdirfid == 0) {
if (xx == 0)
gotdirfid = 1;
}
}
/* if not parent fid yet, try to get one from the dir in the cache */
/* see if we have a valid mapping for the cache parent cid */
if (xx == -1) {
dbug_leave("logelem_lostfound");
return (EIO);
}
xx = logfile_offset(
if (xx) {
dbug_leave("logelem_lostfound");
return (EIO);
}
gotdirfid = 1;
}
}
/* otherwise try to get the fid from the cache */
if (gotdirfid == 0) {
if (xx == 0)
gotdirfid = 1;
}
}
/* if we found a parent directory */
if (gotdirfid) {
/* get the host name */
if (xx == -1)
machnamep = "client";
else
/* find a name we can call this file */
/* construct the name */
if (len > MAXNAMELEN)
else
/* see if it exists */
/* timeout error, pass the error back up */
dbug_leave("logelem_lostfound");
return (ETIMEDOUT);
}
/* file does not exist, so try to use it */
foundname = 1;
break;
}
/* any other error on the directory, give up */
if (xx)
break;
}
/* if we found a name */
if (foundname) {
/* set up attributes for the file */
/* create the file */
if (xx == 0) {
/* write the file */
xx = kmod_pushback(
if (xx == 0) {
wrotefile = 1;
gettext("File %s renamed as %s on "
"server."),
mesgbuf);
}
}
}
}
/* if we could not write the file to the server, move to lost+found */
if (wrotefile == 0) {
/* move the file to lost+found */
dbug_assert(0);
dbug_leave("logelem_lostfound");
return (0);
} else if (xx) {
gettext("Cannot move %s to lost+found. "),
namep);
gettext("Run cachefs fsck on the file system."),
sizeof (mesgbuf));
return (EIO);
} else {
}
}
/* set the mapping to indicate conflict */
if (xx) {
dbug_leave("logelem_lostfound");
return (EIO);
}
dbug_leave("logelem_lostfound");
return (xx);
}
/*
* -----------------------------------------------------------------
* logelem_problem
*
* Description:
* Specifies the problem string.
* Pass a variable number of strings.
* They are concatinated together to form the message.
* Terminate the argument list with NULL.
* Arguments:
* strp
* Returns:
* Preconditions:
* precond(strp)
*/
void
{
dbug_enter("logelem_problem");
dbug_leave("logelem_problem");
}
/*
* -----------------------------------------------------------------
* logelem_resolution
*
* Description:
* Specifies the resolution string.
* Pass a variable number of strings.
* They are concatinated together to form the message.
* Terminate the argument list with NULL.
* Arguments:
* strp
* Returns:
* Preconditions:
* precond(strp)
*/
void
{
dbug_enter("logelem_resolution");
strp);
dbug_leave("logelem_resolution");
}
/*
* -----------------------------------------------------------------
* logelem_message_append
*
* Description:
* Arguments:
* Returns:
* Preconditions:
* precond(strp1)
* precond(strp1)
*/
void
{
dbug_enter("logelem_message_append");
else {
gettext("cachefsd: log element message truncated\n"));
}
dbug_leave("logelem_message_append");
}
/*
* -----------------------------------------------------------------
* logelem_message
*
* Description:
* Arguments:
* prefix
* strp
* Returns:
* Preconditions:
* precond(prefix)
* precond(strp)
*/
void
char *prefix,
char *strp)
{
dbug_enter("logelem_message");
dbug_leave("logelem_message");
}
/*
* -----------------------------------------------------------------
* logelem_log_opfailed
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
char mesgbuf[CFSDStrMax];
char errorbuf[CFSDStrMax];
/*
* XXX need to change this so we don't assemble the message,
* this violates localization.
*/
if (namep) {
}
if (info) {
}
if (xx) {
}
}
/*
* -----------------------------------------------------------------
* logelem_log_opskipped
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
const char *namep)
{
char mesgbuf[CFSDStrMax];
}
/*
* -----------------------------------------------------------------
* logelem_log_timelogmesg
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
char mesgbuf[CFSDStrMax];
/*
* XXX need to change this so we don't assemble the message,
* this violates localization.
*/
if (namep) {
}
if (mesgp) {
}
switch (time_log) {
case 0:
sizeof (mesgbuf));
break;
case 1:
sizeof (mesgbuf));
break;
default:
sizeof (mesgbuf));
break;
}
}
/*
* cfsd_logelem_setattr_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_setattr_create");
dbug_leave("cfsd_logelem_setattr_create");
return (logelem_object_p);
}
/*
* cfsd_logelem_setsecattr_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_setsecattr_create");
(const aclent_t *)
dbug_leave("cfsd_logelem_setsecattr_create");
return (logelem_object_p);
}
/*
* cfsd_logelem_create_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_create_create");
sizeof (gid_t));
dbug_leave("cfsd_logelem_create_create");
return (logelem_object_p);
}
/*
* cfsd_logelem_remove_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_remove_create");
sizeof (gid_t));
dbug_leave("cfsd_logelem_remove_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_rmdir_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_rmdir_create");
* sizeof (gid_t));
dbug_leave("cfsd_logelem_rmdir_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_mkdir_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_mkdir_create");
sizeof (gid_t));
dbug_leave("cfsd_logelem_mkdir_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_link_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_link_create");
* sizeof (gid_t));
dbug_leave("cfsd_logelem_link_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_symlink_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_symlink_create");
sizeof (gid_t));
dbug_leave("cfsd_logelem_symlink_create");
return (logelem_object_p);
}
/*
* -----------------------------------------------------------------
* cfsd_logelem_rename_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_rename_create");
sizeof (gid_t));
dbug_leave("cfsd_logelem_rename_create");
return (logelem_object_p);
}
/*
* cfsd_logelem_modified_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_modified_create");
dbug_leave("cfsd_logelem_modified_create");
return (logelem_object_p);
}
/*
* cfsd_logelem_mapfid
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
{
dbug_enter("cfsd_logelem_mapfid_create");
dbug_leave("cfsd_logelem_mapfid_create");
return (logelem_object_p);
}
/*
* logelem_roll
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int retval = 0;
dbug_enter("logelem_roll");
switch (logelem_object_p->i_type) {
case NO_OBJECT_TYPE:
dbug_assert(0);
break;
case SETATTR_OBJECT_TYPE:
break;
case SETSECATTR_OBJECT_TYPE:
break;
case CREATE_OBJECT_TYPE:
break;
case REMOVE_OBJECT_TYPE:
break;
case RMDIR_OBJECT_TYPE:
break;
case MKDIR_OBJECT_TYPE:
break;
case LINK_OBJECT_TYPE:
break;
case SYMLINK_OBJECT_TYPE:
break;
case RENAME_OBJECT_TYPE:
break;
case MODIFIED_OBJECT_TYPE:
break;
case MAPFID_OBJECT_TYPE:
break;
default:
dbug_assert(0);
}
dbug_leave("logelem_roll");
return (retval);
}
/*
* logelem_roll_setattr
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
int time_log;
int conflict = 0;
dbug_enter("logelem_roll_setattr");
/* get the mapping for this cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_setattr");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_setattr");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_setattr");
return (0);
}
/* if we have a fid in the mapping */
/* get the fid */
if (xx) {
dbug_leave("logelem_roll_setattr");
return (EIO);
}
}
/* else get the fid from the cache */
else {
dbug_leave("logelem_roll_setattr");
return (0);
}
if (xx) {
gettext("File is no longer in the cache"),
dbug_leave("logelem_roll_setattr");
return (xx);
}
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_setattr");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the attributes of the file from the back fs */
dbug_leave("logelem_roll_setattr");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_setattr");
return (xx);
}
/* conflict if mtime changed */
conflict = 1;
}
/* conflict if ctime changed */
conflict = 1;
}
/* if a conflict was detected */
if (conflict) {
dbug_leave("logelem_roll_setattr");
return (xx);
}
/* now do the setattr, get the new times */
dbug_leave("logelem_roll_setattr");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_setattr");
return (xx);
}
/* update the mapping to point to the new times */
if (xx) {
dbug_leave("logelem_roll_setattr");
return (EIO);
}
dbug_leave("logelem_roll_setattr");
return (0);
}
/*
* logelem_roll_setsecattr
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
int time_log;
int conflict = 0;
dbug_enter("logelem_roll_setsecattr");
/* get the mapping for this cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_setsecattr");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_setsecattr");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_setsecattr");
return (0);
}
/* if we have a fid in the mapping */
/* get the fid */
if (xx) {
dbug_leave("logelem_roll_setsecattr");
return (EIO);
}
}
/* else get the fid from the cache */
else {
&filefid);
dbug_leave("logelem_roll_setsecattr");
return (0);
}
if (xx) {
gettext("File is no longer in the cache"),
dbug_leave("logelem_roll_setsecattr");
return (xx);
}
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_setsecattr");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the attributes of the file from the back fs */
dbug_leave("logelem_roll_setsecattr");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_setsecattr");
return (xx);
}
/* conflict if mtime changed */
conflict = 1;
}
/* conflict if ctime changed */
conflict = 1;
}
/* if a conflict was detected */
if (conflict) {
dbug_leave("logelem_roll_setsecattr");
return (xx);
}
/* now do the setsecattr, get the new times */
dbug_leave("logelem_roll_setsecattr");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_setsecattr");
return (xx);
}
/* update the mapping to point to the new times */
if (xx) {
dbug_leave("logelem_roll_setsecattr");
return (EIO);
}
dbug_leave("logelem_roll_setsecattr");
return (0);
}
/*
* logelem_roll_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
dbug_enter("logelem_roll_create");
/* if the file existed at the time of this operation */
/* see if the file no longer exists in the cache */
#if 0
if (xx) {
/* indicate ignore future operations on file */
dbug_leave("logelem_roll_create");
if (xx) {
dbug_leave("logelem_roll_create");
return (EIO);
}
dbug_leave("logelem_roll_create");
return (0);
}
#endif
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_create");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
gettext("Parent directory no longer exists"),
&
dbug_leave("logelem_roll_create");
return (xx);
}
} else {
if (xx) {
dbug_leave("logelem_roll_create");
return (EIO);
}
}
/* if the file exists on the back fs */
dbug_leave("logelem_roll_create");
return (ETIMEDOUT);
}
/* if the file exists on the back file system */
if (xx == 0) {
gettext("File created while disconnected"),
dbug_leave("logelem_roll_create");
return (xx);
}
/* do the create */
if (xx) {
dbug_leave("logelem_roll_create");
return (ETIMEDOUT);
}
/* create failed move to lost and found */
dbug_leave("logelem_roll_create");
return (xx);
}
/* update the mapping to point to the new fid and times */
if (xx) {
dbug_leave("logelem_roll_create");
return (EIO);
}
dbug_leave("logelem_roll_create");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_remove
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
int time_log;
dbug_enter("logelem_roll_remove");
/* get the mapping for this cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_remove");
return (EIO);
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_remove");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_remove");
return (0);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_remove");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_remove");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
gettext("Parent directory no longer exists"),
dbug_leave("logelem_roll_remove");
return (0);
}
} else {
if (xx) {
dbug_leave("logelem_roll_remove");
return (EIO);
}
}
/* get file attributes */
dbug_leave("logelem_roll_remove");
return (ETIMEDOUT);
}
/* if the file no longer exists on the back fs */
gettext("File no longer exists."),
dbug_leave("logelem_roll_remove");
return (0);
} else if (xx) {
gettext("Cannot get file attributes from server"),
dbug_leave("logelem_roll_remove");
return (0);
}
/* conflict if mtime changed */
dbug_leave("logelem_roll_remove");
return (0);
}
/* conflict if ctime changed */
dbug_leave("logelem_roll_remove");
return (0);
}
/* do the remove */
if (xx) {
dbug_leave("logelem_roll_remove");
return (ETIMEDOUT);
}
/* remove failed */
dbug_leave("logelem_roll_remove");
return (0);
}
/* record new ctime if multiple links to file */
if (ctimep) {
if (xx) {
dbug_leave("logelem_roll_remove");
return (EIO);
}
}
dbug_leave("logelem_roll_remove");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_rmdir
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
dbug_enter("logelem_roll_rmdir");
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_rmdir");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
gettext("Remove Directory"),
gettext("Parent directory no longer exists"),
dbug_leave("logelem_roll_rmdir");
return (0);
}
} else {
if (xx) {
"Remove Directory",
dbug_leave("logelem_roll_rmdir");
return (EIO);
}
}
/* perform the rmdir */
if (xx) {
dbug_leave("logelem_roll_rmdir");
return (ETIMEDOUT);
}
dbug_leave("logelem_roll_rmdir");
return (0);
}
dbug_leave("logelem_roll_rmdir");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_mkdir
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
dbug_enter("logelem_roll_mkdir");
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_mkdir");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
"Create Directory",
gettext("Parent directory no longer exists"),
dbug_leave("logelem_roll_mkdir");
return (0);
}
} else {
if (xx) {
"Create Directory",
dbug_leave("logelem_roll_mkdir");
return (EIO);
}
}
/* perform the mkdir */
if (xx) {
dbug_leave("logelem_roll_mkdir");
return (ETIMEDOUT);
}
dbug_leave("logelem_roll_mkdir");
return (0);
}
/* update the mapping to point to the new fid */
if (xx) {
dbug_leave("logelem_roll_mkdir");
return (EIO);
}
dbug_leave("logelem_roll_mkdir");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_link
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
int time_log;
dbug_enter("logelem_roll_link");
/* get the mapping for the child cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_link");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_link");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_link");
return (0);
}
/* if we have a fid in the mapping */
/* get the fid */
if (xx) {
dbug_leave("logelem_roll_link");
return (EIO);
}
}
/* else get the fid from the cache */
else {
&linkfid);
dbug_leave("logelem_roll_link");
return (0);
}
if (xx) {
gettext("File is no longer in the cache"),
dbug_leave("logelem_roll_link");
return (0);
}
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_link");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the attributes of the file from the back fs */
dbug_leave("logelem_roll_link");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_link");
return (0);
}
/* conflict if mtime changed */
dbug_leave("logelem_roll_link");
return (0);
}
/* conflict if ctime changed */
dbug_leave("logelem_roll_link");
return (0);
}
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_link");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
gettext("Parent directory no longer exists"),
dbug_leave("logelem_roll_link");
return (0);
}
} else {
if (xx) {
dbug_leave("logelem_roll_link");
return (EIO);
}
}
/* do the link */
if (xx) {
dbug_leave("logelem_roll_link");
return (ETIMEDOUT);
}
dbug_leave("logelem_roll_link");
return (0);
}
/* update the mapping with the new time */
if (xx) {
dbug_leave("logelem_roll_link");
return (EIO);
}
dbug_leave("logelem_roll_link");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_symlink
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
dbug_enter("logelem_roll_symlink");
/* see if the symlink no longer exists in the cache */
#if 0
if (xx) {
/* indicate ignore future operations on symlink */
if (xx) {
dbug_leave("logelem_roll_symlink");
return (EIO);
}
dbug_leave("logelem_roll_symlink");
return (0);
}
#endif
/* get the fid of the parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_symlink");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&dirfid);
if (xx) {
gettext("Parent directory no longer exists"),
dbug_leave("logelem_roll_symlink");
return (0);
}
} else {
if (xx) {
dbug_leave("logelem_roll_symlink");
return (EIO);
}
}
/* if the file exists on the back fs */
dbug_leave("logelem_roll_symlink");
return (ETIMEDOUT);
}
/* if the file exists on the back file system */
if (xx == 0) {
gettext("File created while disconnected"),
dbug_leave("logelem_roll_symlink");
return (0);
}
/* do the symlink */
if (xx) {
dbug_leave("logelem_roll_symlink");
return (ETIMEDOUT);
}
dbug_leave("logelem_roll_symlink");
return (0);
}
/* update the mapping to point to the new fid and times */
if (xx) {
dbug_leave("logelem_roll_symlink");
return (EIO);
}
dbug_leave("logelem_roll_symlink");
return (0);
}
/*
* -----------------------------------------------------------------
* logelem_roll_rename
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
int time_log;
dbug_enter("logelem_roll_rename");
/* get the mapping for the child cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_rename");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_rename");
return (0);
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the fid of the old parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&odirfid);
if (xx) {
gettext("Original directory no longer exists"),
dbug_leave("logelem_roll_rename");
return (0);
}
} else {
if (xx) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
}
/* get the fid of the new parent directory */
if (xx == -1) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
/* if error from getting map or no fid in map (ms_fid == 0) */
&ndirfid);
if (xx) {
gettext("Target directory no longer exists"),
dbug_leave("logelem_roll_rename");
return (0);
}
} else {
if (xx) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
}
/* get the attributes of the file from the back fs */
dbug_leave("logelem_roll_rename");
return (ETIMEDOUT);
}
if (xx) {
gettext("Cannot get attributes on file"),
dbug_leave("logelem_roll_rename");
return (0);
}
/* conflict if mtime changed */
dbug_leave("logelem_roll_rename");
return (0);
}
/* conflict if ctime changed */
dbug_leave("logelem_roll_rename");
return (0);
}
/* if we are also deleting a file */
/* get the mapping for the deleted cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* if we have timestamps in the mapping */
/* get the times */
xx = logfile_offset(
if (xx) {
gettext("error getting logfile offset"),
NULL, 0);
dbug_leave("logelem_roll_rename");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the attributes of the target file from the back fs */
&ndirfid,
dbug_leave("logelem_roll_rename");
return (ETIMEDOUT);
}
if (xx) {
gettext("Cannot get attributes on file"),
dbug_leave("logelem_roll_rename");
return (0);
}
/* conflict if mtime changed */
dbug_leave("logelem_roll_rename");
return (0);
}
/* conflict if ctime changed */
dbug_leave("logelem_roll_rename");
return (0);
}
}
/* perform the rename */
if (xx) {
dbug_leave("logelem_roll_rename");
return (ETIMEDOUT);
}
dbug_leave("logelem_roll_rename");
return (0);
}
/* update the mapping to point to the new times for the file */
if (xx) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
/* if we deleted a file with links left */
if (delctimep) {
/* update the mapping to the new times for the deleted file */
&delmap, 1);
if (xx) {
dbug_leave("logelem_roll_rename");
return (EIO);
}
}
dbug_leave("logelem_roll_rename");
return (0);
}
/*
* logelem_roll_modified
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
int time_log;
int conflict = 0;
dbug_enter("logelem_roll_modified");
/* get the mapping for this cid if it exists */
if (xx == -1) {
dbug_leave("logelem_roll_modified");
return (EIO);
}
/* if a mapping was not found */
if (xx) {
/* dummy up mapping so we get values from the cache */
}
/* done if there was a conflict on the file */
dbug_leave("logelem_roll_modified");
return (0);
}
/* done if the file is optimized out */
dbug_leave("logelem_roll_modified");
return (0);
}
/* if we have a fid in the mapping */
/* get the fid */
if (xx) {
dbug_leave("logelem_roll_modified");
return (EIO);
}
}
/* else get the fid from the cache */
else {
dbug_leave("logelem_roll_modified");
return (0);
}
if (xx) {
gettext("File is no longer in the cache"),
dbug_leave("logelem_roll_modified");
return (xx);
}
}
/* get info about the file from the cache */
if (xx) {
dbug_leave("logelem_roll_modified");
return (xx);
}
/* if we are not ready to process this write yet */
"current seq %d, metadata seq %d",
dbug_leave("logelem_roll_modified");
return (EAGAIN);
} else {
"current seq %d, metadata seq %d",
}
/* if we have timestamps in the mapping */
/* get the times */
if (xx) {
dbug_leave("logelem_roll_modified");
return (EIO);
}
time_log = 0;
}
/* else get the timestamps from the log entry */
else {
time_log = 1;
}
/* get the attributes of the file from the back fs */
dbug_leave("logelem_roll_modified");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_modified");
return (xx);
}
/* conflict if mtime changed */
conflict = 1;
}
/* conflict if ctime changed */
conflict = 1;
}
/* if a conflict was detected */
if (conflict) {
dbug_leave("logelem_roll_modified");
return (xx);
}
/* now do the write, get the new times */
dbug_leave("logelem_roll_modified");
return (ETIMEDOUT);
}
if (xx) {
dbug_leave("logelem_roll_modified");
return (xx);
}
/* update the mapping to point to the new times */
if (xx) {
dbug_leave("logelem_roll_modified");
return (EIO);
}
dbug_leave("logelem_roll_modified");
return (0);
}
/*
* logelem_roll_mapfid
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
int
{
int xx;
struct cfs_dlog_mapping_space map;
dbug_enter("logelem_roll_mapfid");
/* map the cid to the fid */
if (xx) {
dbug_leave("logelem_roll_mapfid");
return (EIO);
}
dbug_leave("logelem_roll_mapfid");
return (0);
}
/*
* logelem_dump
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump");
switch (logelem_object_p->i_type) {
case NO_OBJECT_TYPE:
dbug_assert(0);
break;
case SETATTR_OBJECT_TYPE:
break;
case SETSECATTR_OBJECT_TYPE:
break;
case CREATE_OBJECT_TYPE:
break;
case REMOVE_OBJECT_TYPE:
break;
case RMDIR_OBJECT_TYPE:
break;
case MKDIR_OBJECT_TYPE:
break;
case LINK_OBJECT_TYPE:
break;
case SYMLINK_OBJECT_TYPE:
break;
case RENAME_OBJECT_TYPE:
break;
case MODIFIED_OBJECT_TYPE:
break;
case MAPFID_OBJECT_TYPE:
break;
default:
dbug_assert(0);
}
dbug_leave("logelem_dump");
}
/*
* logelem_dump_setattr
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_setattr");
dbug_leave("logelem_dump_setattr");
}
/*
* logelem_dump_setsecattr
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_setsecattr");
dbug_leave("logelem_dump_setsecattr");
}
/*
* logelem_dump_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_create");
dbug_leave("logelem_dump_create");
}
/*
* -----------------------------------------------------------------
* logelem_dump_remove
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_remove");
dbug_leave("logelem_dump_remove");
}
/*
* -----------------------------------------------------------------
* logelem_dump_rmdir
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_rmdir");
dbug_leave("logelem_dump_rmdir");
}
/*
* -----------------------------------------------------------------
* logelem_dump_mkdir
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_mkdir");
dbug_leave("logelem_dump_mkdir");
}
/*
* -----------------------------------------------------------------
* logelem_dump_link
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_link");
dbug_leave("logelem_dump_link");
}
/*
* -----------------------------------------------------------------
* logelem_dump_symlink
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_symlink");
dbug_leave("logelem_dump_symlink");
}
/*
* -----------------------------------------------------------------
* logelem_dump_rename
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_rename");
tv_nsec));
dbug_leave("logelem_dump_rename");
}
/*
* logelem_dump_modified
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_modified");
dbug_leave("logelem_dump_modified");
}
/*
* logelem_dump_mapfid
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("logelem_dump_mapfid");
dbug_enter("logelem_dump_mapfid");
}