ioctl: move type definitions to common.h

This commit is contained in:
CismonX 2025-02-02 21:35:12 +08:00
parent 031691fae5
commit 1d1ff58aa4
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
11 changed files with 47 additions and 49 deletions

View file

@ -30,10 +30,8 @@
#ifdef BUILDING_BOOKMARKFS
# include "common.h"
# include "ioctl.h"
#else
# include <bookmarkfs/common.h>
# include <bookmarkfs/ioctl.h>
#endif
// backend_create() flags

View file

@ -49,7 +49,6 @@
#include "backend_util.h"
#include "hash.h"
#include "hashmap.h"
#include "ioctl.h"
#include "json.h"
#include "lib.h"
#include "macros.h"

View file

@ -48,7 +48,6 @@
#include "db.h"
#include "hash.h"
#include "hashmap.h"
#include "ioctl.h"
#include "lib.h"
#include "macros.h"
#include "prng.h"

View file

@ -32,7 +32,7 @@
#include <fcntl.h>
#include "ioctl.h"
#include "common.h"
#include "xstd.h"
int

View file

@ -23,6 +23,9 @@
#ifndef BOOKMARKFS_COMMON_H_
#define BOOKMARKFS_COMMON_H_
#include <limits.h>
#include <stdint.h>
struct bookmarkfs_conf_opt {
char *key;
char *val;
@ -30,4 +33,39 @@ struct bookmarkfs_conf_opt {
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_) */

View file

@ -26,6 +26,7 @@
# include "config.h"
#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -40,7 +41,6 @@
#include "frontend_util.h"
#include "fsck_handler.h"
#include "fsck_ops.h"
#include "ioctl.h"
#include "lib.h"
#include "xstd.h"

View file

@ -27,10 +27,8 @@
#ifdef BUILDING_BOOKMARKFS
# include "common.h"
# include "ioctl.h"
#else
# include <bookmarkfs/common.h>
# include <bookmarkfs/ioctl.h>
#endif
// init() flags

View file

@ -31,7 +31,6 @@
#include "backend_util.h"
#include "fsck_handler.h"
#include "fsck_util.h"
#include "ioctl.h"
#include "xstd.h"
#define FSCK_HANDLER_EXPECT_INPUT ( 1u << 16 )

View file

@ -29,7 +29,6 @@
#include <string.h>
#include "fsck_ops.h"
#include "ioctl.h"
#include "version.h"
#include "xstd.h"

View file

@ -25,7 +25,7 @@
#include <stddef.h>
#include "ioctl.h"
#include "common.h"
int
explain_fsck_result (

View file

@ -23,11 +23,14 @@
#ifndef BOOKMARKFS_IOCTL_H_
#define BOOKMARKFS_IOCTL_H_
#include <limits.h>
#include <stdint.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_(rw, ...) _IO##rw(BOOKMARKFS_IOC_MAGIC_, __VA_ARGS__)
#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_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_) */