4 * DEBUG: section 79 Squid-side DISKD I/O functions.
5 * AUTHOR: Duane Wessels
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
36 #ifndef __STORE_DISKDIOSTRATEGY_H__
37 #define __STORE_DISKDIOSTRATEGY_H__
50 void init(int ikey
, int magic2
);
61 #include "DiskIO/DiskIOStrategy.h"
62 #include "StoreIOState.h"
71 class DiskdIOStrategy
: public DiskIOStrategy
76 virtual bool shedLoad();
78 virtual RefCount
<DiskFile
> newFile(char const *path
);
79 virtual void unlinkFile (char const *);
80 virtual ConfigOption
*getOptionTree() const;
83 virtual int callback();
84 virtual void statfs(StoreEntry
& sentry
)const;
85 int send(int mtype
, int id
, DiskdFile
*theFile
, size_t size
, off_t offset
, ssize_t shm_offset
, RefCountable_
*requestor
);
87 /** public for accessing return address's */
91 static size_t newInstance();
92 static size_t nextInstanceID
;
94 bool optionQ1Parse(char const *option
, const char *value
, int reconfiguring
);
95 void optionQ1Dump(StoreEntry
* e
) const;
96 bool optionQ2Parse(char const *option
, const char *value
, int reconfiguring
);
97 void optionQ2Dump(StoreEntry
* e
) const;
98 int send(int mtype
, int id
, RefCount
<StoreIOState
> sio
, size_t size
, off_t offset
, ssize_t shm_offset
);
99 int SEND(diomsg
* M
, int mtype
, int id
, size_t size
, off_t offset
, ssize_t shm_offset
);
100 void handle(diomsg
* M
);
101 void unlinkDone(diomsg
* M
);
104 * magic1 is the number of messages away which we
105 * stop allowing open/create for.
110 * magic2 is the point at which we start blocking on msgsnd/msgrcv.
111 * If a queue has magic2 (or more) messages away, then we read the
112 * queue until the level falls below magic2. Recommended value
125 #define SHMBUF_BLKSZ SM_PAGE_SIZE
128 struct diskd_stats_t
{
129 int open_fail_queue_len
;
144 open
, create
, close
, unlink
, read
, write
;
148 extern diskd_stats_t diskd_stats
;