Subversion Repositories HelenOS

Rev

Rev 2404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2404 Rev 2435
Line 30... Line 30...
30
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 */
34
 */
35
 
35
 
-
 
36
/** @addtogroup FileSystemImpl
-
 
37
* @{
36
 
38
*/
37
/* This file contains the procedures that manipulate file descriptors. */
-
 
38
 
39
 
39
/*   
40
/**
40
 * Methods:
41
 * @file    filedesc.c
41
 * get_fd:    look for free file descriptor and free filp slots
-
 
42
 * get_filp:  look up the filp entry for a given file descriptor
42
 * @brief    This file contains the procedures that manipulate file descriptors.
43
 * find_filp: find a filp slot that points to a given inode
-
 
44
 */
43
 */
45
 
44
 
46
 
-
 
47
#include "fs.h"
45
#include "fs.h"
48
#include "file.h"
46
#include "file.h"
49
#include "fproc.h"
47
#include "fproc.h"
50
#include "inode.h"
48
#include "inode.h"
51
   
49
   
52
   
50
/**
-
 
51
 * Look for free file descriptor and free filp slots
-
 
52
 */    
53
int get_fd(int start, int *k, filp_t **fpt)
53
int get_fd(int start, int *k, filp_t **fpt)
54
{
54
{
55
    /* Look for a free file descriptor and a free filp slot. */
55
    /* Look for a free file descriptor and a free filp slot. */
56
   
56
   
57
    register filp_t *f;
57
    register filp_t *f;
Line 85... Line 85...
85
   
85
   
86
    /* If control passes here, the filp table must be full.  Report that back. */
86
    /* If control passes here, the filp table must be full.  Report that back. */
87
    return FS_ENFILE;
87
    return FS_ENFILE;
88
}
88
}
89
   
89
   
-
 
90
/**
-
 
91
 * Look up the filp entry for a given file descriptor
90
   
92
 */
91
filp_t *get_filp(int fild)
93
filp_t *get_filp(int fild)
92
{
94
{
93
   
95
   
94
    /* See if 'fild' refers to a valid file descr.  If so, return its filp ptr. */
96
    /* See if 'fild' refers to a valid file descr.  If so, return its filp ptr. */
95
   
97
   
Line 99... Line 101...
99
     
101
     
100
    return(fp->fp_filp[fild]);    /* may also be NIL_FILP */
102
    return(fp->fp_filp[fild]);    /* may also be NIL_FILP */
101
}
103
}
102
   
104
   
103
   
105
   
-
 
106
/**
-
 
107
 * Find a filp slot that points to a given inode
-
 
108
 */
104
filp_t *find_filp(register inode_t *rip)
109
filp_t *find_filp(register inode_t *rip)
105
{
110
{
106
   
111
   
107
    /* Find a filp slot that refers to the inode 'rip' in a way as described.
112
    /* Find a filp slot that refers to the inode 'rip' in a way as described.
108
     * Used for determining whether somebody is still interested in.
113
     * Used for determining whether somebody is still interested in.
Line 119... Line 124...
119
   
124
   
120
    /* If control passes here, the filp wasn't there.  Report that back. */
125
    /* If control passes here, the filp wasn't there.  Report that back. */
121
    return NIL_FILP;
126
    return NIL_FILP;
122
}
127
}
123
 
128
 
-
 
129
 
-
 
130
/**
-
 
131
 * }
-
 
132
 */
-
 
133