chore: sync repo

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-06-13 08:46:58 +02:00
parent ec0bd60a10
commit 9a8950c304
2 changed files with 16 additions and 10 deletions

View file

@ -5,13 +5,15 @@
# define STPDFS_SB_MAGIC 0x44505453
# define STPDFS_BLOCK_SIZE_BITS 10
# define STPDFS_BLOCK_SIZE_BITS 9
# define STPDFS_BLOCK_SIZE (1 << STPDFS_BLOCK_SIZE_BITS)
# define STPDFS_NAME_MAX 255
# define STPDFS_INODES_PER_BLOCK (STPDFS_BLOCK_SIZE / (sizeof(struct stpdfs_inode)))
# define STPDFS_ROOT_INO 1
# define STPDFS_LZP_COMPRESSION (1 << 0)
# define STPDFS_FILE_ENCRYPTION (1 << 1)
@ -25,10 +27,10 @@ struct stpdfs_free {
*/
struct stpdfs_sb {
uint32_t magic;
uint32_t isize; /*< size in block of the I list */
uint32_t fsize; /*< size in block of the entire volume */
uint32_t isize; /**< size in block of the I list */
uint32_t fsize; /**< size in block of the entire volume */
uint32_t free[100];
uint8_t nfree; /*< number of free block (0-100) */
uint8_t nfree; /**< number of free block (0-100) */
uint8_t flock;
uint8_t ilock;
uint8_t fmod;
@ -38,13 +40,13 @@ struct stpdfs_sb {
/**
* \brief StupidFS I-node
*/
struct inode {
uint16_t mode; /*< file mode */
uint8_t nlink; /*< link count */
uint8_t uid; /*< owner user id */
uint8_t gid; /*< group id */
struct stpdfs_inode {
uint16_t mode; /**< file mode */
uint8_t nlink; /**< link count */
uint8_t uid; /**< owner user id */
uint8_t gid; /**< group id */
uint32_t size;
uint16_t addr[8];
uint32_t zones[10];
uint32_t actime[2];
uint32_t modtime[2];
} __attribute__((packed));

View file

@ -6,6 +6,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
@ -114,8 +115,11 @@ mkfs()
write_block(fd, NULL, 0);
super.magic = STPDFS_SB_MAGIC;
super.isize = inodes / STPDFS_INODES_PER_BLOCK;
super.fsize = blocks;
super.time = time(NULL);
write_block(fd, &super, sizeof(struct stpdfs_sb));
close(fd);