2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 79 Squid-side DISKD I/O functions. */
11 #ifndef __STORE_DISKDIOSTRATEGY_H__
12 #define __STORE_DISKDIOSTRATEGY_H__
23 void init(int ikey
, int magic2
);
24 SharedMemory() : nbufs(0), buf(nullptr), inuse_map(nullptr), id(0) {}
32 #include "DiskIO/DiskIOStrategy.h"
33 #include "StoreIOState.h"
42 class DiskdIOStrategy
: public DiskIOStrategy
47 virtual bool shedLoad();
49 virtual RefCount
<DiskFile
> newFile(char const *path
);
50 virtual bool unlinkdUseful() const;
51 virtual void unlinkFile (char const *);
52 virtual ConfigOption
*getOptionTree() const;
55 virtual int callback();
56 virtual void statfs(StoreEntry
& sentry
) const;
57 int send(int mtype
, int id
, DiskdFile
*theFile
, size_t size
, off_t offset
, ssize_t shm_offset
, Lock
*requestor
);
59 /** public for accessing return address's */
63 static size_t newInstance();
64 static size_t nextInstanceID
;
66 bool optionQ1Parse(char const *option
, const char *value
, int reconfiguring
);
67 void optionQ1Dump(StoreEntry
* e
) const;
68 bool optionQ2Parse(char const *option
, const char *value
, int reconfiguring
);
69 void optionQ2Dump(StoreEntry
* e
) const;
70 int send(int mtype
, int id
, RefCount
<StoreIOState
> sio
, size_t size
, off_t offset
, ssize_t shm_offset
);
71 int SEND(diomsg
* M
, int mtype
, int id
, size_t size
, off_t offset
, ssize_t shm_offset
);
72 void handle(diomsg
* M
);
73 void unlinkDone(diomsg
* M
);
76 * magic1 is the number of messages away which we
77 * stop allowing open/create for.
82 * magic2 is the point at which we start blocking on msgsnd/msgrcv.
83 * If a queue has magic2 (or more) messages away, then we read the
84 * queue until the level falls below magic2. Recommended value
97 #define SHMBUF_BLKSZ SM_PAGE_SIZE
100 struct diskd_stats_t
{
101 int open_fail_queue_len
;
116 open
, create
, close
, unlink
, read
, write
;
120 extern diskd_stats_t diskd_stats
;