dssfile.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu/***********************************************************************
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* This software is part of the ast package *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* Copyright (c) 2002-2011 AT&T Intellectual Property *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* and is licensed under the *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* Eclipse Public License, Version 1.0 *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* by AT&T Intellectual Property *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* A copy of the License is available at *
c038fcf2030a6cfac7a261dee48a9eb29edb78eaFelix Gabriel Mance* http://www.eclipse.org/org/documents/epl-v10.html *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
c038fcf2030a6cfac7a261dee48a9eb29edb78eaFelix Gabriel Mance* Information and Software Systems Research *
c038fcf2030a6cfac7a261dee48a9eb29edb78eaFelix Gabriel Mance* AT&T Research *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* Florham Park NJ *
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiu* Glenn Fowler <gsf@research.att.com> *
ed1b8e97e72b2e3e92edaf2eb22a4b5373d705f1Felix Gabriel Mance***********************************************************************/
c038fcf2030a6cfac7a261dee48a9eb29edb78eaFelix Gabriel Mance * dss file support
8d246de26958f1e8c35714b260b9d85c933c060aFrancisc Nicolae Bungiu * AT&T Research
c4076ff1721f8901a30e4b7aa004479ecb2631e0Felix Gabriel Mance * not open for read
ccb84c1cb43fb0ed70c5bf2d364e671820473ed5Francisc Nicolae Bungiunoreadf(Dssfile_t* file, Dssrecord_t* record, Dssdisc_t* disc)
e5ea4eeaeefd3521ae3475719e18c96cf91637d5Felix Gabriel Mance (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "%s: not open for read", file->path);
ed1b8e97e72b2e3e92edaf2eb22a4b5373d705f1Felix Gabriel Mancenullreadf(Dssfile_t* file, Dssrecord_t* record, Dssdisc_t* disc)
size_t n;
if (io)
if (io)
else if (io)
else if (io)
#ifdef S_ISSOCK
for (file->format = (Dssformat_t*)dtfirst(dss->meth->formats); file->format && !(i = (*file->format->identf)(file, s, n, dss->disc)); file->format = (Dssformat_t*)dtnext(dss->meth->formats, file->format));
(*dss->disc->errorf)(NiL, dss->disc, 2, "%s: %s file format %s incompatible with %s", file->path, dss->meth->name, file->format->name, format->name);
(*dss->disc->errorf)(dss, dss->disc, 1, "%s: %s method %s format", file->path, dss->meth->name, file->format->name);
file->format = format ? format : dss->format ? dss->format : (Dssformat_t*)dtfirst(dss->meth->formats);
(*dss->disc->errorf)(NiL, dss->disc, 2, "%s: %s method did not set file format", file->path, dss->meth->name);
return file;
if (!file)
return (file->seekf ? (*file->seekf)(file, offset, file->dss->disc) : sfseek(file->io, offset, SEEK_SET)) == offset ? 0 : -1;
return record->file->format->savef ? (*record->file->format->savef)(record->file, record, record->file->dss->disc) : (Dssrecord_t*)0;
return record->file->format->dropf ? (*record->file->format->dropf)(record->file, record, record->file->dss->disc) : -1;
(*disc->errorf)(NiL, disc, 2, "%s: %s file format %s read not implemented", file->path, file->dss->meth->name, file->format->name);
(*disc->errorf)(NiL, disc, 2, "%s: %s file format %s write not implemented", file->path, file->dss->meth->name, file->format->name);