source: branches/2.0x/libtransmission/fdlimit.h @ 10905

Last change on this file since 10905 was 10905, checked in by charles, 12 years ago

(2.0x) remove dead code

  • Property svn:keywords set to Date Rev Author Id
File size: 3.6 KB
Line 
1/*
2 * This file Copyright (C) 2007-2010 Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: fdlimit.h 10905 2010-06-29 01:21:38Z charles $
11 */
12
13#ifndef __TRANSMISSION__
14 #error only libtransmission should #include this header.
15#endif
16
17#include "transmission.h"
18#include "net.h"
19
20/**
21 * @addtogroup file_io File IO
22 * @{
23 */
24
25void tr_fdSetFileLimit( tr_session * session, int limit );
26
27int tr_fdGetFileLimit( const tr_session * session );
28
29void tr_fdSetGlobalPeerLimit( tr_session * session, int limit );
30
31/***
32****
33***/
34
35int tr_open_file_for_scanning( const char * filename );
36
37int tr_open_file_for_writing( const char * filename );
38
39void tr_close_file( int fd );
40
41ssize_t tr_pread(int fd, void *buf, size_t count, off_t offset);
42ssize_t tr_pwrite(int fd, const void *buf, size_t count, off_t offset);
43int tr_prefetch(int fd, off_t offset, size_t count);
44
45
46/**
47 * Returns an fd to the specified filename.
48 *
49 * A small pool of open files is kept to avoid the overhead of
50 * continually opening and closing the same files when downloading
51 * piece data.
52 *
53 * - if doWrite is true, subfolders in torrentFile are created if necessary.
54 * - if doWrite is true, the target file is created if necessary.
55 *
56 * on success, a file descriptor >= 0 is returned.
57 * on failure, a -1 is returned and errno is set.
58 *
59 * @see tr_fdFileClose
60 */
61int  tr_fdFileCheckout( tr_session             * session,
62                        int                      torrentId,
63                        tr_file_index_t          fileNum,
64                        const char             * fileName,
65                        tr_bool                  doWrite,
66                        tr_preallocation_mode    preallocationMode,
67                        uint64_t                 desiredFileSize );
68
69int tr_fdFileGetCached( tr_session             * session,
70                        int                      torrentId,
71                        tr_file_index_t          fileNum,
72                        tr_bool                  doWrite );
73
74/**
75 * Closes a file that's being held by our file repository.
76 *
77 * If the file isn't checked out, it's closed immediately.
78 * If the file is currently checked out, it will be closed upon its return.
79 *
80 * @see tr_fdFileCheckout
81 */
82void tr_fdFileClose( tr_session        * session,
83                     const tr_torrent  * tor,
84                     tr_file_index_t     fileNo );
85
86
87/**
88 * Closes all the files associated with a given torrent id
89 */
90void tr_fdTorrentClose( tr_session * session, int torrentId );
91
92
93/***********************************************************************
94 * Sockets
95 **********************************************************************/
96int      tr_fdSocketCreate( tr_session * session, int domain, int type );
97
98int      tr_fdSocketAccept( tr_session  * session,
99                            int           b,
100                            tr_address  * addr,
101                            tr_port     * port );
102
103void     tr_fdSocketClose( tr_session * session, int s );
104
105/***********************************************************************
106 * tr_fdClose
107 ***********************************************************************
108 * Frees resources allocated by tr_fdInit.
109 **********************************************************************/
110void     tr_fdClose( tr_session * session );
111
112
113void     tr_fdSetPeerLimit( tr_session * session, int n );
114
115int      tr_fdGetPeerLimit( const tr_session * );
116
117/* @} */
Note: See TracBrowser for help on using the repository browser.