/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
/* Copyright (C) 1994 Cazamar Systems, Inc. */
-#ifndef _BUF_H__ENV_
-#define _BUF_H__ENV_ 1
+#ifndef OPENAFS_WINNT_AFSD_BUF_H
+#define OPENAFS_WINNT_AFSD_BUF_H 1
#include <osi.h>
#ifdef DISKCACHE95
/* represents a single buffer */
typedef struct cm_buf {
osi_queue_t q; /* queue of all zero-refcount buffers */
+ afs_uint32 qFlags; /* queue/hash state flags - buf_globalLock */
afs_uint32 magic;
struct cm_buf *allp; /* next in all list */
struct cm_buf *hashp; /* hash bucket pointer */
afs_uint32 dirtyCounter; /* bumped at each dirty->clean transition */
osi_hyper_t offset; /* offset */
cm_fid_t fid; /* file ID */
- afs_uint32 flags; /* flags we're using */
char *datap; /* data in this buffer */
+ afs_uint32 flags; /* flags we're using - mx */
afs_uint32 error; /* last error code, if CM_BUF_ERROR is set */
cm_user_t *userp; /* user who wrote to the buffer last */
-
+
/* fields added for the CM; locked by scp->mx */
afs_uint64 dataVersion; /* data version of this page */
afs_uint32 cmFlags; /* flags for cm */
/* waiting is done based on scp->flags. Removing bits from cmFlags
should be followed by waking the scp. */
+/* values for qFlags */
+#define CM_BUF_QINHASH 1 /* in the hash table */
+#define CM_BUF_QINLRU 2 /* in lru queue (aka free list) */
+#define CM_BUF_QINDL 4 /* in the dirty list */
+#define CM_BUF_QREDIR 8 /* buffer held by the redirector */
+
+/* values for flags */
#define CM_BUF_READING 1 /* now reading buffer from the disk */
#define CM_BUF_WRITING 2 /* now writing buffer to the disk */
-#define CM_BUF_INHASH 4 /* in the hash table */
#define CM_BUF_DIRTY 8 /* buffer is dirty */
-#define CM_BUF_INLRU 0x10 /* in lru queue (aka free list) */
#define CM_BUF_ERROR 0x20 /* something went wrong on delayed write */
#define CM_BUF_WAITING 0x40 /* someone's waiting for a flag to change */
-#define CM_BUF_INDL 0x80 /* in the dirty list */
-#define CM_BUF_EOF 0x100 /* read 0 bytes; used for detecting EOF */
-#define CM_BUF_REDIR 0x200 /* buffer held by the redirector */
+#define CM_BUF_EOF 0x80 /* read 0 bytes; used for detecting EOF */
typedef struct cm_buf_ops {
- long (*Writep)(void *, osi_hyper_t *, long, long, struct cm_user *,
- struct cm_req *);
- long (*Readp)(cm_buf_t *, long, long *, struct cm_user *);
- long (*Stabilizep)(void *, struct cm_user *, struct cm_req *);
- long (*Unstabilizep)(void *, struct cm_user *);
+ long (*Writep)(void *vscp, osi_hyper_t *offsetp,
+ long length, long flags,
+ struct cm_user *userp,
+ struct cm_req *reqp);
+ long (*Readp)(cm_buf_t *bufp, long length,
+ long *bytesReadp, struct cm_user *userp);
+ long (*Stabilizep)(void *vscp, struct cm_user *userp, struct cm_req *reqp);
+ long (*Unstabilizep)(void *vscp, struct cm_user *userp);
} cm_buf_ops_t;
+#define CM_BUF_WRITE_SCP_LOCKED 0x1
+
/* global locks */
extern osi_rwlock_t buf_globalLock;
extern void buf_WaitIO(cm_scache_t *, cm_buf_t *);
-extern cm_buf_t *buf_FindLocked(struct cm_scache *, osi_hyper_t *);
+extern cm_buf_t *buf_FindLocked(struct cm_fid *, osi_hyper_t *);
-extern cm_buf_t *buf_Find(struct cm_scache *, osi_hyper_t *);
+extern cm_buf_t *buf_Find(struct cm_fid *, osi_hyper_t *);
+
+extern cm_buf_t *buf_FindAllLocked(struct cm_fid *, osi_hyper_t *, afs_uint32 flags);
+
+extern cm_buf_t *buf_FindAll(struct cm_fid *, osi_hyper_t *, afs_uint32 flags);
-extern cm_buf_t *buf_FindAllLocked(struct cm_scache *, osi_hyper_t *, afs_uint32 flags);
-
-extern cm_buf_t *buf_FindAll(struct cm_scache *, osi_hyper_t *, afs_uint32 flags);
-
extern long buf_GetNewLocked(struct cm_scache *, osi_hyper_t *, cm_req_t *, cm_buf_t **);
extern long buf_Get(struct cm_scache *, osi_hyper_t *, cm_req_t *, cm_buf_t **);
-extern long buf_GetNew(struct cm_scache *, osi_hyper_t *, cm_req_t *, cm_buf_t **);
-
-extern afs_uint32 buf_CleanAsyncLocked(cm_buf_t *, cm_req_t *, afs_uint32 *);
+extern afs_uint32 buf_CleanAsyncLocked(cm_scache_t *, cm_buf_t *, cm_req_t *, afs_uint32 flags, afs_uint32 *);
-extern afs_uint32 buf_CleanAsync(cm_buf_t *, cm_req_t *, afs_uint32 *);
+extern afs_uint32 buf_CleanAsync(cm_scache_t *, cm_buf_t *, cm_req_t *, afs_uint32 flags, afs_uint32 *);
extern void buf_CleanWait(cm_scache_t *, cm_buf_t *, afs_uint32 locked);
/* error codes */
#define CM_BUF_EXISTS 1 /* buffer exists, and shouldn't */
-#endif /* _BUF_H__ENV_ */
+#endif /* OPENAFS_WINNT_AFSD_BUF_H */