/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Eduardo Krell <ekrell@adexus.cl> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* David Korn
* Eduardo Krell
*
* AT&T Research
*
* 3d file system implementation interface
*/
#ifndef _3D_H
#define _3D_H
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide fchown ftruncate mount readlink sbrk strmode truncate utimes __utimes
#else
#define fchown ______fchown
#define ftruncate ______ftruncate
#define mount ______mount
#define readlink ______readlink
#define sbrk ______sbrk
#define strmode ______strmode
#define truncate ______truncate
#define utimes ______utimes
#define __utimes ________utimes
#endif
#if defined(__STDPP__directive) && defined(__STDPP__note)
#endif
#include <ast_std.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
#else
#endif
#include "lib_3d.h"
#include <ls.h>
#include <sig.h>
#include <times.h>
#include <error.h>
#include <debug.h>
#include <hashkey.h>
#include <dlldefs.h>
#if _lib_strerror && defined(strerror)
extern char* strerror();
#endif
#include <fs3d.h>
#include "msg.h"
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide fchown ftruncate mount readlink sbrk strmode truncate utimes __utimes
#else
#endif
#endif
#if defined(__STDPP__directive) && defined(__STDPP__note)
#if _typ_int64_t
#else
#define off64_t long
#endif
#endif
#endif
struct stat64;
struct Fs;
typedef long (*Sysfunc_t)();
#ifndef _3D_LINK_MAX
#ifdef LINK_MAX
#else
#endif
#endif
typedef struct Fs
{
long flags;
short fd;
short retry;
short specialsize;
unsigned long key;
unsigned long ack;
unsigned long call;
unsigned long terse;
char* match;
char* service;
short matchsize;
short servicesize;
} Fs_t;
#if FS
typedef struct Mount
{
long channel;
char* logical;
char* physical;
short logicalsize;
short physicalsize;
short flags;
} Mount_t;
typedef struct
{
} Dir_t;
#endif
typedef struct
{
#if FS
#endif
short* reserved;
unsigned long open;
unsigned char flags;
unsigned char oflag;
} File_t;
#if VCS
#include "vcs_3d.h"
#endif
/*
* File_t flags
*/
/*
* map flags
*/
/*
* Mount_t flags
*/
/*
* pathreal() flags
*/
#ifndef ENOTEMPTY
#endif
#define FS_null 0
#define fsfd(p) ((((p)->flags&(FS_ERROR|FS_ON|FS_OPEN))==(FS_ON|FS_OPEN))?(p)->fd:((((p)->flags&(FS_BOUND|FS_ERROR|FS_INIT|FS_ON))==(FS_BOUND|FS_ON))?fsinit(p,-1):-1))
#define initialize() do { if (!state.pid) init(0,0,0); else if (state.control.note) control(); } while(0)
#if _hdr_alloca
#define reclaim()
#else
#endif
#define reserve(p) ((state.file[*(p)].flags|=FILE_LOCK,*(state.file[*(p)].reserved=(p)))<RESERVED_FD?close(*(p)):0)
#if FS
#define fsmonitored(p) ((state.path.monitor=getmount((p),NiL))&&(state.path.monitor->fs->flags&(FS_ERROR|FS_MONITOR|FS_ON))==(FS_MONITOR|FS_ON))
#define fssys(p,c) (fson((p)->fs)&&(((p)->fs->call&MSG_MASK(c))||((p)->fs->flags&FS_GLOBAL)&&(fsmount(p),0)))
#endif
typedef struct
{
char* key;
char* val;
unsigned short keysize;
unsigned short valsize;
} Map_t;
typedef struct
{
unsigned int size;
} Table_t;
typedef struct
{
int level;
int open_level;
int synthesize;
int nlinks;
char* linkname;
int linksize;
#if FS
#endif
char* mount;
#if VCS && defined(VCS_PATH_STATE)
#endif
} Path_t;
typedef struct
{
char* prefix;
int prelen;
} Visit_t;
struct Intercept_s
{
unsigned long mask;
};
#if _no_exit_exit
typedef void (*Exitfunc_t)(int);
#endif
typedef struct
{
/* the first elements are explicitly initialized */
const char* id;
char* cmd;
char* binsh;
int limit;
/* the rest are implicitly initialized */
struct
{
short monitor;
short name;
} call;
struct
{
short fd;
unsigned long internal;
} channel;
struct
{
int note;
int pathsize;
char* path;
} control;
#endif
int boundary;
struct
{
char* beg;
char* end;
} brk;
int cache;
char** env;
char* envpath;
void* freedirp;
int in_2d;
int kernel;
int level;
int open;
char* pwd;
int pwdsize;
long ret;
char* shell;
struct
{
char* value;
char* invert;
char* next;
int valsize;
int invertsize;
} key;
struct
{
short fd;
short version;
int size;
} table;
unsigned long test;
struct
{
unsigned long call;
short count;
} trace;
int real;
struct
{
int size;
} trap;
#if _no_exit_exit
#endif
#if FS
#endif
} State_t;
#include "std_3d.h"
extern int bprintf(char**, char*, const char*, ...);
extern void calldump(char**, char*);
extern void callinit(void);
extern void control(void);
extern int fs3d_dup(int, int);
extern int fs3d_mkdir(const char*, mode_t);
extern unsigned long getkey(const char*, const char*, int);
extern int init(int, const char*, int);
extern int mapinit(const char*, int);
extern int nosys(void);
extern int intercept(Intercept_f, unsigned long);
#if FS
extern int getattr(const char*, char*);
extern const char* setattr(char*, const char*, const char*);
#endif
/*
* non-standard standards
*/
#if ! _UWIN
#endif
/*
* backwards compatibility fixups
* these should go away in 94 (ha!)
*/
#if _int_st_spare1
#else
#if _ary_st_spare4
#else
#if _ary_st_pad4
#else
#define NIVIEW(p,v)
#endif
#endif
#endif
#define IVIEW(p,v) do{NIVIEW(p,(v)&(INSTANCE-1));if(!S_ISBLK((p)->st_mode)&&!S_ISCHR((p)->st_mode))(p)->st_rdev=(v)&(INSTANCE-1);}while(0)
#else
#endif
#endif