remove_fd() is now static.

Added some comments.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-09-30 03:31:42 +00:00
parent 03874b549f
commit 79f4cb3e2c

View File

@ -5,13 +5,15 @@
*/
//#include <ktypes.h>
#include <OS.h>
#include <fd.h>
#include <vfs.h>
#include <OS.h>
#include <Errors.h>
#include <vfs.h>
#include <debug.h>
#include <memheap.h>
#include <string.h>
#define CHECK_USER_ADDR(x) \
@ -92,13 +94,16 @@ err:
}
/** Reduces the descriptor's reference counter, and frees all resources
* if necessary.
*/
void
put_fd(struct file_descriptor *descriptor)
{
/* Run a cleanup (fd_free) routine if there is one and free structure, but only
* if we've just removed the final reference to it :)
*/
// free the descriptor if we don't need it anymore
if (atomic_add(&descriptor->ref_count, -1) == 1) {
// close the underlying object (and free any resources allocated there)=
if (descriptor->ops->fd_close)
descriptor->ops->fd_close(descriptor);
if (descriptor->ops->fd_free)
@ -131,7 +136,11 @@ get_fd(struct io_context *context, int fd)
}
void
/** Removes the file descriptor in the specified slot, and
* reduces its reference counter.
*/
static void
remove_fd(struct io_context *context, int fd)
{
struct file_descriptor *descriptor = NULL;