benv_sync.c revision ae115bc77f6fcde83175c75b4206dc2e50747966
/*
* 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"
#include "benv.h"
#include <unistd.h>
#include <sys/ddi_impldefs.h>
extern int verbose;
/*
* Delayed-write descriptor.
*/
typedef struct dw_des {
char *path; /* file path */
} dw_des_t;
/*
* Delayed-write request.
*/
typedef struct dw_req {
int num; /* write number */
} dw_req_t;
static dw_des_t *
{
return (dwd);
}
/*
* Parse a delayed-write property into a delayed-write request.
* The property name is of the form 'writeN' where N represents
* the Nth write request to the pathname encoded in the property's value.
*/
static void
{
int plen;
tok += 4;
tok += 4;
}
/*
* Sync a delayed-write out request to a file.
*/
static void
{
int fd;
char *p, *path;
*p = NULL;
}
*p = '/';
if (verbose)
printf("sync \"%s\" size %d data <%s>\n",
}
/*
* Sync all delayed-write requests from the boot.
*/
void
sync_benv(void)
{
if (verbose)
printf("no delayed writes.\n");
return;
}
/*
* Parse each property into a delayed-write request for
* for a given file.
*/
char *path;
if (verbose)
/*
* Get a delayed-write descriptor for each
* new file. Add all delayed-write requests
* for a given file to the descriptor's request
* list.
*/
break;
}
}
}
}
/*
* Process the last request for each path. We only need to
* do the last request since the writes are destructive and
* overwrite all previous file contents.
*/
}
}
}