mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
ioctl: move type definitions to common.h
This commit is contained in:
parent
031691fae5
commit
1d1ff58aa4
11 changed files with 47 additions and 49 deletions
|
@ -30,10 +30,8 @@
|
||||||
|
|
||||||
#ifdef BUILDING_BOOKMARKFS
|
#ifdef BUILDING_BOOKMARKFS
|
||||||
# include "common.h"
|
# include "common.h"
|
||||||
# include "ioctl.h"
|
|
||||||
#else
|
#else
|
||||||
# include <bookmarkfs/common.h>
|
# include <bookmarkfs/common.h>
|
||||||
# include <bookmarkfs/ioctl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// backend_create() flags
|
// backend_create() flags
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include "backend_util.h"
|
#include "backend_util.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "hashmap.h"
|
#include "hashmap.h"
|
||||||
#include "ioctl.h"
|
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "hashmap.h"
|
#include "hashmap.h"
|
||||||
#include "ioctl.h"
|
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "prng.h"
|
#include "prng.h"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "ioctl.h"
|
#include "common.h"
|
||||||
#include "xstd.h"
|
#include "xstd.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
38
src/common.h
38
src/common.h
|
@ -23,6 +23,9 @@
|
||||||
#ifndef BOOKMARKFS_COMMON_H_
|
#ifndef BOOKMARKFS_COMMON_H_
|
||||||
#define BOOKMARKFS_COMMON_H_
|
#define BOOKMARKFS_COMMON_H_
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
struct bookmarkfs_conf_opt {
|
struct bookmarkfs_conf_opt {
|
||||||
char *key;
|
char *key;
|
||||||
char *val;
|
char *val;
|
||||||
|
@ -30,4 +33,39 @@ struct bookmarkfs_conf_opt {
|
||||||
struct bookmarkfs_conf_opt *next;
|
struct bookmarkfs_conf_opt *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum bookmarkfs_fsck_result {
|
||||||
|
BOOKMARKFS_FSCK_RESULT_END = 0, // must be 0
|
||||||
|
BOOKMARKFS_FSCK_RESULT_NAME_DUPLICATE,
|
||||||
|
BOOKMARKFS_FSCK_RESULT_NAME_BADCHAR,
|
||||||
|
BOOKMARKFS_FSCK_RESULT_NAME_BADLEN,
|
||||||
|
BOOKMARKFS_FSCK_RESULT_NAME_DOTDOT,
|
||||||
|
BOOKMARKFS_FSCK_RESULT_NAME_INVALID,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Predefined reason codes for BOOKMARKFS_FSCK_RESULT_NAME_INVALID.
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
BOOKMARKFS_NAME_INVALID_REASON_NOTUTF8 = 256,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum bookmarkfs_permd_op {
|
||||||
|
BOOKMARKFS_PERMD_OP_SWAP,
|
||||||
|
BOOKMARKFS_PERMD_OP_MOVE_BEFORE,
|
||||||
|
BOOKMARKFS_PERMD_OP_MOVE_AFTER,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bookmarkfs_fsck_data {
|
||||||
|
uint64_t id;
|
||||||
|
uint64_t extra;
|
||||||
|
char name[NAME_MAX + 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bookmarkfs_permd_data {
|
||||||
|
enum bookmarkfs_permd_op op;
|
||||||
|
|
||||||
|
char name1[NAME_MAX + 1];
|
||||||
|
char name2[NAME_MAX + 1];
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* !defined(BOOKMARKFS_COMMON_H_) */
|
#endif /* !defined(BOOKMARKFS_COMMON_H_) */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -40,7 +41,6 @@
|
||||||
#include "frontend_util.h"
|
#include "frontend_util.h"
|
||||||
#include "fsck_handler.h"
|
#include "fsck_handler.h"
|
||||||
#include "fsck_ops.h"
|
#include "fsck_ops.h"
|
||||||
#include "ioctl.h"
|
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include "xstd.h"
|
#include "xstd.h"
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,8 @@
|
||||||
|
|
||||||
#ifdef BUILDING_BOOKMARKFS
|
#ifdef BUILDING_BOOKMARKFS
|
||||||
# include "common.h"
|
# include "common.h"
|
||||||
# include "ioctl.h"
|
|
||||||
#else
|
#else
|
||||||
# include <bookmarkfs/common.h>
|
# include <bookmarkfs/common.h>
|
||||||
# include <bookmarkfs/ioctl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init() flags
|
// init() flags
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "backend_util.h"
|
#include "backend_util.h"
|
||||||
#include "fsck_handler.h"
|
#include "fsck_handler.h"
|
||||||
#include "fsck_util.h"
|
#include "fsck_util.h"
|
||||||
#include "ioctl.h"
|
|
||||||
#include "xstd.h"
|
#include "xstd.h"
|
||||||
|
|
||||||
#define FSCK_HANDLER_EXPECT_INPUT ( 1u << 16 )
|
#define FSCK_HANDLER_EXPECT_INPUT ( 1u << 16 )
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fsck_ops.h"
|
#include "fsck_ops.h"
|
||||||
#include "ioctl.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "xstd.h"
|
#include "xstd.h"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "ioctl.h"
|
#include "common.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
explain_fsck_result (
|
explain_fsck_result (
|
||||||
|
|
44
src/ioctl.h
44
src/ioctl.h
|
@ -23,11 +23,14 @@
|
||||||
#ifndef BOOKMARKFS_IOCTL_H_
|
#ifndef BOOKMARKFS_IOCTL_H_
|
||||||
#define BOOKMARKFS_IOCTL_H_
|
#define BOOKMARKFS_IOCTL_H_
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#ifdef BUILDING_BOOKMARKFS
|
||||||
|
# include "common.h"
|
||||||
|
#else
|
||||||
|
# include <bookmarkfs/common.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BOOKMARKFS_IOC_MAGIC_ 0xbf
|
#define BOOKMARKFS_IOC_MAGIC_ 0xbf
|
||||||
#define BOOKMARKFS_IOC_(rw, ...) _IO##rw(BOOKMARKFS_IOC_MAGIC_, __VA_ARGS__)
|
#define BOOKMARKFS_IOC_(rw, ...) _IO##rw(BOOKMARKFS_IOC_MAGIC_, __VA_ARGS__)
|
||||||
#define BOOKMARKFS_IOC_RW_(rw, nr, name) \
|
#define BOOKMARKFS_IOC_RW_(rw, nr, name) \
|
||||||
|
@ -38,39 +41,4 @@
|
||||||
#define BOOKMARKFS_IOC_FSCK_APPLY BOOKMARKFS_IOC_RW_(WR, 2, fsck)
|
#define BOOKMARKFS_IOC_FSCK_APPLY BOOKMARKFS_IOC_RW_(WR, 2, fsck)
|
||||||
#define BOOKMARKFS_IOC_PERMD BOOKMARKFS_IOC_RW_(W, 3, permd)
|
#define BOOKMARKFS_IOC_PERMD BOOKMARKFS_IOC_RW_(W, 3, permd)
|
||||||
|
|
||||||
enum bookmarkfs_fsck_result {
|
|
||||||
BOOKMARKFS_FSCK_RESULT_END = 0, // must be 0
|
|
||||||
BOOKMARKFS_FSCK_RESULT_NAME_DUPLICATE,
|
|
||||||
BOOKMARKFS_FSCK_RESULT_NAME_BADCHAR,
|
|
||||||
BOOKMARKFS_FSCK_RESULT_NAME_BADLEN,
|
|
||||||
BOOKMARKFS_FSCK_RESULT_NAME_DOTDOT,
|
|
||||||
BOOKMARKFS_FSCK_RESULT_NAME_INVALID,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Predefined reason codes for BOOKMARKFS_FSCK_RESULT_NAME_INVALID.
|
|
||||||
*/
|
|
||||||
enum {
|
|
||||||
BOOKMARKFS_NAME_INVALID_REASON_NOTUTF8 = 256,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum bookmarkfs_permd_op {
|
|
||||||
BOOKMARKFS_PERMD_OP_SWAP,
|
|
||||||
BOOKMARKFS_PERMD_OP_MOVE_BEFORE,
|
|
||||||
BOOKMARKFS_PERMD_OP_MOVE_AFTER,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bookmarkfs_fsck_data {
|
|
||||||
uint64_t id;
|
|
||||||
uint64_t extra;
|
|
||||||
char name[NAME_MAX + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bookmarkfs_permd_data {
|
|
||||||
enum bookmarkfs_permd_op op;
|
|
||||||
|
|
||||||
char name1[NAME_MAX + 1];
|
|
||||||
char name2[NAME_MAX + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* !defined(BOOKMARKFS_IOCTL_H_) */
|
#endif /* !defined(BOOKMARKFS_IOCTL_H_) */
|
||||||
|
|
Loading…
Add table
Reference in a new issue