Minor header cleanup: moved some headers to better matching directories,
removed unused headers. Adapted sources to still compile with the new header locations. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11913 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _DEVFS_H
|
||||
#define _DEVFS_H
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t devfs_unpublish_file_device(const char *path);
|
||||
status_t devfs_publish_file_device(const char *path, const char *filePath);
|
||||
|
||||
status_t devfs_unpublish_partition(const char *path);
|
||||
status_t devfs_publish_partition(const char *path, const partition_info *info);
|
||||
|
||||
status_t devfs_publish_device(const char *path, void *ident, device_hooks *calls);
|
||||
status_t devfs_publish_directory(const char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DEVFS_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2002-2005, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FD_H
|
||||
#define _FD_H
|
||||
|
||||
|
||||
#include <vfs.h>
|
||||
#include <team.h>
|
||||
#include <thread.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct file_descriptor;
|
||||
struct select_sync;
|
||||
|
||||
struct fd_ops {
|
||||
status_t (*fd_read)(struct file_descriptor *, off_t pos, void *buffer, size_t *length);
|
||||
status_t (*fd_write)(struct file_descriptor *, off_t pos, const void *buffer, size_t *length);
|
||||
off_t (*fd_seek)(struct file_descriptor *, off_t pos, int seekType);
|
||||
status_t (*fd_ioctl)(struct file_descriptor *, ulong op, void *buffer, size_t length);
|
||||
status_t (*fd_select)(struct file_descriptor *, uint8 event, uint32 ref, struct select_sync *sync);
|
||||
status_t (*fd_deselect)(struct file_descriptor *, uint8 event, struct select_sync *sync);
|
||||
status_t (*fd_read_dir)(struct file_descriptor *, struct dirent *buffer, size_t bufferSize, uint32 *_count);
|
||||
status_t (*fd_rewind_dir)(struct file_descriptor *);
|
||||
status_t (*fd_read_stat)(struct file_descriptor *, struct stat *);
|
||||
status_t (*fd_write_stat)(struct file_descriptor *, const struct stat *, int statMask);
|
||||
status_t (*fd_close)(struct file_descriptor *);
|
||||
void (*fd_free)(struct file_descriptor *);
|
||||
};
|
||||
|
||||
struct file_descriptor {
|
||||
int32 type; /* descriptor type */
|
||||
int32 ref_count;
|
||||
int32 open_count;
|
||||
struct fd_ops *ops;
|
||||
union {
|
||||
struct vnode *vnode;
|
||||
struct fs_mount *mount;
|
||||
} u;
|
||||
void *cookie;
|
||||
int32 open_mode;
|
||||
off_t pos;
|
||||
};
|
||||
|
||||
|
||||
/* Types of file descriptors we can create */
|
||||
|
||||
enum fd_types {
|
||||
FDTYPE_FILE = 1,
|
||||
FDTYPE_ATTR,
|
||||
FDTYPE_DIR,
|
||||
FDTYPE_ATTR_DIR,
|
||||
FDTYPE_INDEX,
|
||||
FDTYPE_INDEX_DIR,
|
||||
FDTYPE_QUERY,
|
||||
FDTYPE_SOCKET
|
||||
};
|
||||
|
||||
|
||||
/* Prototypes */
|
||||
|
||||
extern struct file_descriptor *alloc_fd(void);
|
||||
extern int new_fd_etc(struct io_context *, struct file_descriptor *, int firstIndex);
|
||||
extern int new_fd(struct io_context *, struct file_descriptor *);
|
||||
extern struct file_descriptor *get_fd(struct io_context *, int);
|
||||
extern void close_fd(struct file_descriptor *descriptor);
|
||||
extern void put_fd(struct file_descriptor *descriptor);
|
||||
extern status_t select_fd(int fd, uint8 event, uint32 ref, struct select_sync *sync, bool kernel);
|
||||
extern status_t deselect_fd(int fd, uint8 event, struct select_sync *sync, bool kernel);
|
||||
extern bool fd_is_valid(int fd, bool kernel);
|
||||
|
||||
static struct io_context *get_current_io_context(bool kernel);
|
||||
|
||||
/* The prototypes of the (sys|user)_ functions are currently defined in vfs.h */
|
||||
|
||||
|
||||
/* Inlines */
|
||||
|
||||
static inline struct io_context *
|
||||
get_current_io_context(bool kernel)
|
||||
{
|
||||
if (kernel)
|
||||
return (struct io_context *)team_get_kernel_team()->io_context;
|
||||
|
||||
return (struct io_context *)thread_get_current_thread()->team->io_context;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FD_H */
|
||||
Reference in New Issue
Block a user