ldivmod, uldivmod: fix qdivrem calls
[minix.git] / include / minix / sffs.h
blobee8425340c8b79058cf02cfa4a4f37ed6041af8b
1 /* Part of libsffs - (c) 2012, D.C. van Moolenbroek */
3 #ifndef _MINIX_SFFS_H
4 #define _MINIX_SFFS_H
6 #include <sys/types.h>
7 #include <sys/time.h>
8 #include <minix/u64.h>
10 typedef void *sffs_file_t; /* handle to open file */
11 typedef void *sffs_dir_t; /* handle to directory search */
13 struct sffs_attr {
14 u32_t a_mask; /* which fields to retrieve/set */
15 mode_t a_mode; /* file type and permissions */
16 u64_t a_size; /* file size */
17 struct timespec a_crtime; /* file creation time */
18 struct timespec a_atime; /* file access time */
19 struct timespec a_mtime; /* file modification time */
20 struct timespec a_ctime; /* file change time */
23 #define SFFS_ATTR_SIZE 0x01 /* get/set file size */
24 #define SFFS_ATTR_CRTIME 0x02 /* get/set file creation time */
25 #define SFFS_ATTR_ATIME 0x04 /* get/set file access time */
26 #define SFFS_ATTR_MTIME 0x08 /* get/set file modification time */
27 #define SFFS_ATTR_CTIME 0x10 /* get/set file change time */
28 #define SFFS_ATTR_MODE 0x20 /* get/set file mode */
30 struct sffs_table {
31 int (*t_open)(char *path, int flags, int mode, sffs_file_t *handle);
32 ssize_t (*t_read)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
33 ssize_t (*t_write)(sffs_file_t handle, char *buf, size_t size, u64_t pos);
34 int (*t_close)(sffs_file_t handle);
36 size_t (*t_readbuf)(char **ptr);
37 size_t (*t_writebuf)(char **ptr);
39 int (*t_opendir)(char *path, sffs_dir_t *handle);
40 int (*t_readdir)(sffs_dir_t handle, unsigned int index, char *buf,
41 size_t size, struct sffs_attr *attr);
42 int (*t_closedir)(sffs_dir_t handle);
44 int (*t_getattr)(char *path, struct sffs_attr *attr);
45 int (*t_setattr)(char *path, struct sffs_attr *attr);
47 int (*t_mkdir)(char *path, int mode);
48 int (*t_unlink)(char *path);
49 int (*t_rmdir)(char *path);
50 int (*t_rename)(char *opath, char *npath);
52 int (*t_queryvol)(char *path, u64_t *free, u64_t *total);
55 struct sffs_params {
56 char p_prefix[PATH_MAX]; /* prefix for all paths used */
57 uid_t p_uid; /* UID that owns all files */
58 gid_t p_gid; /* GID that owns all files */
59 unsigned int p_file_mask; /* AND-mask to apply to file permissions */
60 unsigned int p_dir_mask; /* AND-mask to apply to directory perms */
61 int p_case_insens; /* case insensitivity flag */
64 int sffs_init(char *name, const struct sffs_table *table,
65 struct sffs_params *params);
66 void sffs_signal(int signo);
67 void sffs_loop(void);
69 #endif /* _MINIX_SFFS_H */