mirror of https://gitlab.com/drummyfish/anarch
Add perfomrance check
parent
3f1344e596
commit
b3decffc39
1
TODO.txt
1
TODO.txt
|
@ -1,5 +1,6 @@
|
|||
general:
|
||||
|
||||
- High pitch noise in SDL music AGAIN!
|
||||
- Refactor.
|
||||
- Port to OpenDingux.
|
||||
- Port to some fantasy console?
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// Pokitto config required by PokittoLib
|
||||
|
||||
//#define PROJ_SHOW_FPS_COUNTER
|
||||
#define PROJ_SCREENMODE 13
|
||||
#define PROJ_MODE13 1
|
||||
#define PROJ_ENABLE_SOUND 1
|
|
@ -0,0 +1,579 @@
|
|||
/**
|
||||
@file constants.h
|
||||
|
||||
This file contains definitions of game constants that are not considered
|
||||
part of game settings and whose change can ffect the game balance and
|
||||
playability, e.g. physics constants.
|
||||
|
||||
by Miloslav Ciz (drummyfish), 2019
|
||||
|
||||
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
plus a waiver of all other intellectual property. The goal of this work is
|
||||
be and remain completely in the public domain forever, available for any use
|
||||
whatsoever.
|
||||
*/
|
||||
|
||||
#ifndef _SFG_CONSTANTS_H
|
||||
#define _SFG_CONSTANTS_H
|
||||
|
||||
/**
|
||||
How quickly player moves, in squares per second.
|
||||
*/
|
||||
#define SFG_PLAYER_MOVE_SPEED 7
|
||||
|
||||
/**
|
||||
Gravity acceleration in squares / (second^2).
|
||||
*/
|
||||
#define SFG_GRAVITY_ACCELERATION 30
|
||||
|
||||
/**
|
||||
Initial upwards speed of player's jump, in squares per second.
|
||||
*/
|
||||
#define SFG_PLAYER_JUMP_SPEED 5
|
||||
|
||||
/**
|
||||
Melee and close-up attack range, in RCL_Units.
|
||||
*/
|
||||
#define SFG_MELEE_RANGE 1600
|
||||
|
||||
/**
|
||||
When a projectile is shot, it'll be offset by this distance (in RCL_Units)
|
||||
from the shooter.
|
||||
*/
|
||||
|
||||
#define SFG_PROJECTILE_SPAWN_OFFSET 256
|
||||
|
||||
/**
|
||||
Player's melee hit range, in RCL_Units (RCL_UNITS_PER_SQUARE means full angle,
|
||||
180 degrees to both sides).
|
||||
*/
|
||||
#define SFG_PLAYER_MELEE_ANGLE 512
|
||||
|
||||
/**
|
||||
How quickly elevators and squeezers move, in RCL_Unit per second.
|
||||
*/
|
||||
#define SFG_MOVING_WALL_SPEED 1024
|
||||
|
||||
/**
|
||||
How quickly doors open and close, in RCL_Unit per second.
|
||||
*/
|
||||
#define SFG_DOOR_OPEN_SPEED 2048
|
||||
|
||||
/**
|
||||
Helper special state value.
|
||||
*/
|
||||
#define SFG_CANT_SAVE 255
|
||||
|
||||
/**
|
||||
Says the distance in RCL_Units at which level elements (items, monsters etc.)
|
||||
are active.
|
||||
*/
|
||||
#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE (12 * 1024)
|
||||
|
||||
/**
|
||||
Rate at which AI will be updated, which also affects how fast enemies will
|
||||
appear.
|
||||
*/
|
||||
#define SFG_AI_FPS 4
|
||||
|
||||
/**
|
||||
Says a probability (0 - 255) of the AI changing its state during one update
|
||||
step.
|
||||
*/
|
||||
#define SFG_AI_RANDOM_CHANGE_PROBABILITY 40
|
||||
|
||||
/**
|
||||
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
||||
square).
|
||||
*/
|
||||
#define SFG_ELEMENT_COLLISION_RADIUS 1900
|
||||
|
||||
/**
|
||||
Height, in RCL_Units, at which collisions happen with level elements
|
||||
(sprites).
|
||||
*/
|
||||
#define SFG_ELEMENT_COLLISION_HEIGHT 1024
|
||||
|
||||
/**
|
||||
Distance at which explosion does damage and throws away the player and
|
||||
monsters, in RCL_Units.
|
||||
*/
|
||||
#define SFG_EXPLOSION_RADIUS 2048
|
||||
|
||||
/**
|
||||
Distance in RCL_Units which the player is pushed away by an explosion.
|
||||
*/
|
||||
#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1200
|
||||
|
||||
/**
|
||||
How much damage triggers a barrel explosion.
|
||||
*/
|
||||
|
||||
#define SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD 3
|
||||
|
||||
/**
|
||||
Maximum player health.
|
||||
*/
|
||||
#define SFG_PLAYER_MAX_HEALTH 125
|
||||
|
||||
/**
|
||||
Start health of player.
|
||||
*/
|
||||
#define SFG_PLAYER_START_HEALTH 100
|
||||
|
||||
/**
|
||||
At which value health indicator shows a warning (red color).
|
||||
*/
|
||||
#define SFG_PLAYER_HEALTH_WARNING_LEVEL 20
|
||||
|
||||
/**
|
||||
Amount of health that is increased by taking a health kit.
|
||||
*/
|
||||
#define SFG_HEALTH_KIT_VALUE 20
|
||||
|
||||
/**
|
||||
How much randomness (positive and negative) will be added to damage
|
||||
(e.g. by weapons, explosions, ...). This constant is is 0 to 255, 255 meaning
|
||||
100% of the base value.
|
||||
*/
|
||||
#define SFG_DAMAGE_RANDOMNESS 64
|
||||
|
||||
/**
|
||||
Height of monster collision BBox in RCL_Units.
|
||||
*/
|
||||
#define SFG_MONSTER_COLLISION_HEIGHT 1024
|
||||
|
||||
/**
|
||||
Specifies key repeat delay, in ms.
|
||||
*/
|
||||
#define SFG_KEY_REPEAT_DELAY 500
|
||||
|
||||
/**
|
||||
Specifies key repeat period, in ms.
|
||||
*/
|
||||
#define SFG_KEY_REPEAT_PERIOD 150
|
||||
|
||||
/**
|
||||
Angle in which multiple projectiles are spread, RCL_Units.
|
||||
*/
|
||||
#define SFG_PROJECTILE_SPREAD_ANGLE 100
|
||||
|
||||
#define SFG_MAX_MONSTERS 64
|
||||
|
||||
#define SFG_MAX_PROJECTILES 12
|
||||
|
||||
#define SFG_MAX_DOORS 32
|
||||
|
||||
#define SFG_AMMO_BULLETS 0
|
||||
#define SFG_AMMO_ROCKETS 1
|
||||
#define SFG_AMMO_PLASMA 2
|
||||
|
||||
#define SFG_AMMO_TOTAL 3
|
||||
|
||||
#define SFG_AMMO_NONE SFG_AMMO_TOTAL
|
||||
|
||||
#define SFG_AMMO_INCREASE_BULLETS 10
|
||||
#define SFG_AMMO_INCREASE_ROCKETS 5
|
||||
#define SFG_AMMO_INCREASE_PLASMA 8
|
||||
|
||||
#define SFG_AMMO_MAX_BULLETS 200
|
||||
#define SFG_AMMO_MAX_ROCKETS 100
|
||||
#define SFG_AMMO_MAX_PLASMA 150
|
||||
|
||||
/**
|
||||
Duration of story text (intro/outro) in ms.
|
||||
*/
|
||||
#define SFG_STORYTEXT_DURATION 15000
|
||||
|
||||
/**
|
||||
Time in ms of the player death animation.
|
||||
*/
|
||||
#define SFG_LOSE_ANIMATION_DURATION 2000
|
||||
|
||||
/**
|
||||
Time in ms of the level win animation.
|
||||
*/
|
||||
#define SFG_WIN_ANIMATION_DURATION 2500
|
||||
|
||||
/**
|
||||
Time in ms of the level start stage.
|
||||
*/
|
||||
#define SFG_LEVEL_START_DURATION 1500
|
||||
|
||||
/**
|
||||
Vertical sprite size, in RCL_Units.
|
||||
*/
|
||||
#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE
|
||||
|
||||
// ----------------------------
|
||||
// derived constants
|
||||
|
||||
#define SFG_GAME_RESOLUTION_X \
|
||||
(SFG_SCREEN_RESOLUTION_X / SFG_RESOLUTION_SCALEDOWN)
|
||||
|
||||
#define SFG_GAME_RESOLUTION_Y \
|
||||
(SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN)
|
||||
|
||||
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
|
||||
|
||||
#if SFG_MS_PER_FRAME == 0
|
||||
#undef SFG_MS_PER_FRAME
|
||||
#define SFG_MS_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_KEY_REPEAT_DELAY_FRAMES \
|
||||
(SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME)
|
||||
|
||||
#if SFG_KEY_REPEAT_DELAY_FRAMES == 0
|
||||
#undef SFG_KEY_REPEAT_DELAY_FRAMES
|
||||
#define SFG_KEY_REPEAT_DELAY_FRAMES 1
|
||||
#endif
|
||||
|
||||
#define SFG_KEY_REPEAT_PERIOD_FRAMES \
|
||||
(SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME)
|
||||
|
||||
#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0
|
||||
#undef SFG_KEY_REPEAT_PERIOD_FRAMES
|
||||
#define SFG_KEY_REPEAT_PERIOD_FRAMES 1
|
||||
#endif
|
||||
|
||||
#define SFG_WEAPON_IMAGE_SCALE \
|
||||
(SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5))
|
||||
|
||||
#if SFG_WEAPON_IMAGE_SCALE == 0
|
||||
#undef SFG_WEAPON_IMAGE_SCALE
|
||||
#define SFG_WEAPON_IMAGE_SCALE 1
|
||||
#endif
|
||||
|
||||
#define SFG_WEAPONBOB_OFFSET_PIXELS \
|
||||
(SFG_WEAPONBOB_OFFSET * SFG_WEAPON_IMAGE_SCALE)
|
||||
|
||||
#define SFG_WEAPON_IMAGE_POSITION_X \
|
||||
(SFG_GAME_RESOLUTION_X / 2 - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE) / 2)
|
||||
|
||||
#if SFG_GAME_RESOLUTION_Y > 70
|
||||
#define SFG_WEAPON_IMAGE_POSITION_Y \
|
||||
(SFG_GAME_RESOLUTION_Y - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE))
|
||||
#elif SFG_GAME_RESOLUTION_Y > 50
|
||||
#define SFG_WEAPON_IMAGE_POSITION_Y (SFG_GAME_RESOLUTION_Y \
|
||||
- ((SFG_WEAPON_IMAGE_SCALE * 3 * SFG_TEXTURE_SIZE) / 4))
|
||||
#else
|
||||
#define SFG_WEAPON_IMAGE_POSITION_Y \
|
||||
(SFG_GAME_RESOLUTION_Y - SFG_TEXTURE_SIZE / 2)
|
||||
#endif
|
||||
|
||||
#define SFG_PLAYER_TURN_UNITS_PER_FRAME \
|
||||
((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS))
|
||||
|
||||
#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0
|
||||
#undef SFG_PLAYER_TURN_UNITS_PER_FRAME
|
||||
#define SFG_PLAYER_TURN_UNITS_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME \
|
||||
((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS)
|
||||
|
||||
#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0
|
||||
#undef SFG_PLAYER_MOVE_UNITS_PER_FRAME
|
||||
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME \
|
||||
((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS))
|
||||
|
||||
#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0
|
||||
#undef SFG_GRAVITY_SPEED_INCREASE_PER_FRAME
|
||||
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \
|
||||
(((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \
|
||||
- SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2)
|
||||
/* ^ This substraction corrects the initial veloc. so that the numeric curve
|
||||
copies the analytical (smooth) curve. Without it the numeric curve goes
|
||||
ABOVE and makes player jump higher with lower FPS. To make sense of this
|
||||
try to solve the differential equation and plot it. */
|
||||
|
||||
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
|
||||
#undef SFG_PLAYER_JUMP_OFFSET_PER_FRAME
|
||||
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME \
|
||||
(SFG_HEADBOB_SPEED / SFG_FPS)
|
||||
|
||||
#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0
|
||||
#undef SFG_HEADBOB_FRAME_INCREASE_PER_FRAME
|
||||
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_HEADBOB_ENABLED (SFG_HEADBOB_SPEED > 0 && SFG_HEADBOB_OFFSET > 0)
|
||||
|
||||
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME \
|
||||
((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS)
|
||||
|
||||
#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0
|
||||
#undef SFG_CAMERA_SHEAR_STEP_PER_FRAME
|
||||
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_CAMERA_MAX_SHEAR_PIXELS \
|
||||
((SFG_CAMERA_MAX_SHEAR * SFG_GAME_RESOLUTION_Y) / 1024)
|
||||
|
||||
#define SFG_FONT_SIZE_SMALL \
|
||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50))
|
||||
|
||||
#if SFG_FONT_SIZE_SMALL == 0
|
||||
#undef SFG_FONT_SIZE_SMALL
|
||||
#define SFG_FONT_SIZE_SMALL 1
|
||||
#endif
|
||||
|
||||
#define SFG_FONT_SIZE_MEDIUM \
|
||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30))
|
||||
|
||||
#if SFG_FONT_SIZE_MEDIUM == 0
|
||||
#undef SFG_FONT_SIZE_MEDIUM
|
||||
#define SFG_FONT_SIZE_MEDIUM 1
|
||||
#endif
|
||||
|
||||
#define SFG_FONT_SIZE_BIG \
|
||||
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18))
|
||||
|
||||
#if SFG_FONT_SIZE_BIG == 0
|
||||
#undef SFG_FONT_SIZE_BIG
|
||||
#define SFG_FONT_SIZE_BIG 1
|
||||
#endif
|
||||
|
||||
#define SFG_Z_BUFFER_SIZE SFG_GAME_RESOLUTION_X
|
||||
|
||||
/**
|
||||
Step in which walls get higher, in raycastlib units.
|
||||
*/
|
||||
#define SFG_WALL_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 4)
|
||||
|
||||
#define SFG_CEILING_MAX_HEIGHT\
|
||||
(16 * RCL_UNITS_PER_SQUARE - RCL_UNITS_PER_SQUARE / 2 )
|
||||
|
||||
#define SFG_DOOR_UP_DOWN_MASK 0x20
|
||||
#define SFG_DOOR_LOCK(doorRecord) ((doorRecord) >> 6)
|
||||
#define SFG_DOOR_VERTICAL_POSITION_MASK 0x1f
|
||||
#define SFG_DOOR_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 0x1f)
|
||||
|
||||
#define SFG_DOOR_INCREMENT_PER_FRAME \
|
||||
(SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS))
|
||||
|
||||
#if SFG_DOOR_INCREMENT_PER_FRAME == 0
|
||||
#undef SFG_DOOR_INCREMENT_PER_FRAME
|
||||
#define SFG_DOOR_INCREMENT_PER_FRAME 1
|
||||
#endif
|
||||
|
||||
#define SFG_MAX_ITEMS SFG_MAX_LEVEL_ELEMENTS
|
||||
|
||||
#define SFG_MAX_SPRITE_SIZE SFG_GAME_RESOLUTION_X
|
||||
|
||||
#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE)
|
||||
|
||||
#if SFG_MAP_PIXEL_SIZE == 0
|
||||
#undef SFG_MAP_PIXEL_SIZE
|
||||
#define SFG_MAP_PIXEL_SIZE 1
|
||||
#endif
|
||||
|
||||
#define SFG_AI_UPDATE_FRAME_INTERVAL \
|
||||
(SFG_FPS / SFG_AI_FPS)
|
||||
|
||||
#if SFG_AI_UPDATE_FRAME_INTERVAL == 0
|
||||
#undef SFG_AI_UPDATE_FRAME_INTERVAL
|
||||
#define SFG_AI_UPDATE_FRAME_INTERVAL 1
|
||||
#endif
|
||||
|
||||
#define SFG_SPRITE_ANIMATION_FRAME_DURATION \
|
||||
(SFG_FPS / SFG_SPRITE_ANIMATION_SPEED)
|
||||
|
||||
#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0
|
||||
#undef SFG_SPRITE_ANIMATION_FRAME_DURATION
|
||||
#define SFG_SPRITE_ANIMATION_FRAME_DURATION 1
|
||||
#endif
|
||||
|
||||
#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 40)
|
||||
|
||||
#define SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS \
|
||||
(SFG_GAME_RESOLUTION_Y / SFG_HUD_BORDER_INDICATOR_WIDTH)
|
||||
|
||||
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES \
|
||||
(SFG_HUD_BORDER_INDICATOR_DURATION / SFG_MS_PER_FRAME)
|
||||
|
||||
#if SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES == 0
|
||||
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1
|
||||
#endif
|
||||
|
||||
#define SFG_BLINK_PERIOD_FRAMES (SFG_BLINK_PERIOD / SFG_MS_PER_FRAME)
|
||||
|
||||
#define SFG_HUD_BAR_HEIGHT \
|
||||
(SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1)
|
||||
|
||||
// ----------------------------
|
||||
// monsters
|
||||
|
||||
#define SFG_MONSTER_ATTACK_MELEE 0
|
||||
#define SFG_MONSTER_ATTACK_FIREBALL 1
|
||||
#define SFG_MONSTER_ATTACK_BULLET 2
|
||||
#define SFG_MONSTER_ATTACK_FIREBALL_BULLET 3
|
||||
#define SFG_MONSTER_ATTACK_PLASMA 4
|
||||
#define SFG_MONSTER_ATTACK_EXPLODE 5
|
||||
#define SFG_MONSTER_ATTACK_FIREBALL_PLASMA 6
|
||||
|
||||
#define SFG_MONSTER_ATTRIBUTE(attackType,aggressivity0to255,health0to255,spriteSize0to3) \
|
||||
((uint16_t) ( \
|
||||
attackType | \
|
||||
((aggressivity0to255 / 8) << 3) | \
|
||||
(spriteSize0to3 << 8) | \
|
||||
((health0to255 / 4) << 10)))
|
||||
|
||||
#define SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber) \
|
||||
(SFG_monsterAttributeTable[monsterNumber] & 0x0007)
|
||||
|
||||
#define SFG_GET_MONSTER_AGGRESSIVITY(monsterNumber) \
|
||||
(((SFG_monsterAttributeTable[monsterNumber] >> 3) & 0x1F) * 8)
|
||||
|
||||
#define SFG_GET_MONSTER_SPRITE_SIZE(monsterNumber) \
|
||||
((SFG_monsterAttributeTable[monsterNumber] >> 8) & 0x03)
|
||||
|
||||
#define SFG_GET_MONSTER_MAX_HEALTH(monsterNumber) \
|
||||
(((SFG_monsterAttributeTable[monsterNumber] >> 10) & 0x3F) * 4)
|
||||
|
||||
/**
|
||||
Table of monster attributes, each as a 16bit word in format:
|
||||
|
||||
MSB hhhhhhssaaaattt LSB
|
||||
|
||||
ttt: attack type
|
||||
aaaaa: aggressivity (frequence of attacks), 0 to 31
|
||||
ss: sprite size
|
||||
hhhhhh: health, 0 to 63
|
||||
*/
|
||||
uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] =
|
||||
{
|
||||
/* spider */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL,40,61,2),
|
||||
/* destr. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_BULLET,90,170,3),
|
||||
/* warrior */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_MELEE,255,40,1),
|
||||
/* plasma */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_PLASMA,56,92,1),
|
||||
/* ender */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_PLASMA,128,255,3),
|
||||
/* turret */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_BULLET,32,23,0),
|
||||
/* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1)
|
||||
};
|
||||
|
||||
// ----------------------------
|
||||
// weapons and projectiles
|
||||
|
||||
#define SFG_WEAPON_KNIFE 0
|
||||
#define SFG_WEAPON_SHOTGUN 1
|
||||
#define SFG_WEAPON_MACHINE_GUN 2
|
||||
#define SFG_WEAPON_ROCKET_LAUNCHER 3
|
||||
#define SFG_WEAPON_PLASMAGUN 4
|
||||
#define SFG_WEAPON_SOLUTION 5
|
||||
|
||||
#define SFG_WEAPONS_TOTAL 6
|
||||
|
||||
#define SFG_WEAPON_ATTRIBUTE(fireType,projectileCount,fireCooldownMs) \
|
||||
((uint8_t) (fireType | ((projectileCount - 1) << 2) | ((fireCooldownMs / (SFG_MS_PER_FRAME * 16)) << 4)))
|
||||
|
||||
#define SFG_GET_WEAPON_FIRE_TYPE(weaponNumber) \
|
||||
(SFG_weaponAttributeTable[weaponNumber] & 0x03)
|
||||
|
||||
#define SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(weaponNumber) \
|
||||
((SFG_weaponAttributeTable[weaponNumber] >> 4) * 16)
|
||||
|
||||
#define SFG_GET_WEAPON_PROJECTILE_COUNT(weaponNumber) \
|
||||
(((SFG_weaponAttributeTable[weaponNumber] >> 2) & 0x03) + 1)
|
||||
|
||||
#define SFG_MIN_WEAPON_COOLDOWN_FRAMES 8
|
||||
|
||||
#define SFG_WEAPON_FIRE_TYPE_MELEE 0
|
||||
#define SFG_WEAPON_FIRE_TYPE_BULLET 1
|
||||
#define SFG_WEAPON_FIRE_TYPE_FIREBALL 2
|
||||
#define SFG_WEAPON_FIRE_TYPE_PLASMA 3
|
||||
|
||||
#define SFG_WEAPON_FIRE_TYPES_TOTAL 4
|
||||
|
||||
/**
|
||||
Table of weapon attributes, each as a byte in format:
|
||||
|
||||
MSB ccccnnff LSB
|
||||
|
||||
ff: fire type
|
||||
nn: number of projectiles - 1
|
||||
cccc: fire cooldown in frames, i.e. time after which the next shot can be
|
||||
shot again, ccccc has to be multiplied by 16 to get the real value
|
||||
*/
|
||||
SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] =
|
||||
{
|
||||
/* knife */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_MELEE,1,650), // DPS: 6.2
|
||||
/* shotgun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,2,1250), // DPS: 12.8
|
||||
/* m. gun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,1,700), // DPS: 11.4
|
||||
/* r. laun. */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_FIREBALL,1,850), // DPS: 28.2
|
||||
/* plasma */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,1,550), // DPS: 32.7
|
||||
/* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,4,1050) // DPS: 85.7
|
||||
};
|
||||
|
||||
SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] =
|
||||
{
|
||||
/* melee */ 4,
|
||||
/* bullet */ 8,
|
||||
/* explostion (fireball) */ 24,
|
||||
/* plasma */ 18
|
||||
};
|
||||
|
||||
#define SFG_PROJECTILE_EXPLOSION 0
|
||||
#define SFG_PROJECTILE_FIREBALL 1
|
||||
#define SFG_PROJECTILE_PLASMA 2
|
||||
#define SFG_PROJECTILE_DUST 3
|
||||
#define SFG_PROJECTILE_BULLET 4
|
||||
#define SFG_PROJECTILE_NONE 255
|
||||
|
||||
#define SFG_PROJECTILES_TOTAL 5
|
||||
|
||||
#define SFG_PROJECTILE_ATTRIBUTE(speedSquaresPerSec,timeToLiveMs) \
|
||||
((uint8_t) \
|
||||
((((speedSquaresPerSec / 4 == 0) && (speedSquaresPerSec != 0)) ? 1 : speedSquaresPerSec / 4) | \
|
||||
((timeToLiveMs / (8 * SFG_MS_PER_FRAME)) << 3)))
|
||||
|
||||
#define SFG_GET_PROJECTILE_SPEED_UPS(projectileNumber) \
|
||||
(((SFG_projectileAttributeTable[projectileNumber] & 0x07) * 4 * RCL_UNITS_PER_SQUARE) / SFG_FPS)
|
||||
|
||||
#define SFG_GET_PROJECTILE_FRAMES_TO_LIVE(projectileNumber) \
|
||||
((SFG_projectileAttributeTable[projectileNumber] >> 3) * 8)
|
||||
|
||||
/**
|
||||
Table of projectile attributes, each as a byte in format:
|
||||
|
||||
MSB lllllsss LSB
|
||||
|
||||
fff: half speed in game squares per second
|
||||
lllll: eigth of frames to live
|
||||
*/
|
||||
|
||||
#define LOW_FPS (SFG_FPS < 20) ///< low FPS needs low speeds, because collisions
|
||||
|
||||
SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] =
|
||||
{
|
||||
/* explosion */ SFG_PROJECTILE_ATTRIBUTE(0,400),
|
||||
/* fireball */ SFG_PROJECTILE_ATTRIBUTE(10,1000),
|
||||
|
||||
#if LOW_FPS
|
||||
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(17,500),
|
||||
#else
|
||||
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(18,500),
|
||||
#endif
|
||||
|
||||
/* dust */ SFG_PROJECTILE_ATTRIBUTE(0,450),
|
||||
|
||||
#if LOW_FPS
|
||||
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(17,1000)
|
||||
#else
|
||||
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(28,1000)
|
||||
#endif
|
||||
};
|
||||
|
||||
#undef LOW_FPS
|
||||
|
||||
#endif // guard
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,225 @@
|
|||
/**
|
||||
@file levels.h
|
||||
|
||||
This file contains game levels and related code.
|
||||
|
||||
by Miloslav Ciz (drummyfish), 2019
|
||||
|
||||
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
|
||||
plus a waiver of all other intellectual property. The goal of this work is
|
||||
be and remain completely in the public domain forever, available for any use
|
||||
whatsoever.
|
||||
*/
|
||||
|
||||
#ifndef _SFG_LEVELS_H
|
||||
#define _SFG_LEVELS_H
|
||||
|
||||
#define SFG_MAP_SIZE 64
|
||||
#define SFG_TILE_DICTIONARY_SIZE 64
|
||||
|
||||
typedef uint16_t SFG_TileDefinition;
|
||||
/**<
|
||||
Defines a single game map tile. The format is following:
|
||||
|
||||
MSB aaabbbbb cccddddd LSB
|
||||
|
||||
aaa: ceiling texture index (from texture available on the map), 111
|
||||
means completely transparent texture
|
||||
bbbbb: ceiling height (1111 meaning no ceiling) ABOVE the floor
|
||||
ccc: floor texture index, 111 means completely transparent texture
|
||||
ddddd: floor height
|
||||
*/
|
||||
|
||||
#define SFG_TILE_CEILING_MAX_HEIGHT 31
|
||||
#define SFG_TILE_TEXTURE_TRANSPARENT 7
|
||||
|
||||
typedef SFG_TileDefinition SFG_TileDictionary[SFG_TILE_DICTIONARY_SIZE];
|
||||
|
||||
/// helper macros for SFG_TileDefinition
|
||||
#define SFG_TD(floorH, ceilH, floorT, ceilT)\
|
||||
((floorH & 0x001f) |\
|
||||
((floorT & 0x0007) << 5) |\
|
||||
((ceilH & 0x001f) << 8) |\
|
||||
((ceilT & 0x0007) << 13))
|
||||
|
||||
#define SFG_TILE_FLOOR_HEIGHT(tile) (tile & 0x1f)
|
||||
#define SFG_TILE_FLOOR_TEXTURE(tile) ((tile & 0xe0) >> 5)
|
||||
#define SFG_TILE_CEILING_HEIGHT(tile) ((tile & 0x1f00) >> 8)
|
||||
#define SFG_TILE_CEILING_TEXTURE(tile) ((tile & 0xe000) >> 13)
|
||||
|
||||
#define SFG_OUTSIDE_TILE SFG_TD(63,0,7,7)
|
||||
|
||||
/**
|
||||
Game map represented as a 2D array. Array item has this format:
|
||||
|
||||
MSB aabbbbbb LSB
|
||||
|
||||
aa: type of square, possible values:
|
||||
00: normal
|
||||
01: moving floor (elevator), moves from floor height to ceililing height
|
||||
(there is no ceiling above)
|
||||
10: moving ceiling, moves from ceiling height to floor height
|
||||
11: door
|
||||
bbbbbb: index into tile dictionary
|
||||
*/
|
||||
typedef uint8_t SFG_MapArray[SFG_MAP_SIZE * SFG_MAP_SIZE];
|
||||
|
||||
#define SFG_TILE_PROPERTY_MASK 0xc0
|
||||
#define SFG_TILE_PROPERTY_NORMAL 0x00
|
||||
#define SFG_TILE_PROPERTY_ELEVATOR 0x40
|
||||
#define SFG_TILE_PROPERTY_SQUEEZER 0x80
|
||||
#define SFG_TILE_PROPERTY_DOOR 0xc0
|
||||
|
||||
/**
|
||||
Serves to place elements (items, enemies etc.) into the game level.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t coords[2];
|
||||
} SFG_LevelElement;
|
||||
|
||||
#define SFG_MAX_LEVEL_ELEMENTS 128
|
||||
|
||||
/*
|
||||
Definitions of level element type. These values must leave the highest bit
|
||||
unused because that will be used by the game engine, so the values must be
|
||||
lower than 128.
|
||||
*/
|
||||
#define SFG_LEVEL_ELEMENT_NONE 0
|
||||
#define SFG_LEVEL_ELEMENT_BARREL 0x01
|
||||
#define SFG_LEVEL_ELEMENT_HEALTH 0x02
|
||||
#define SFG_LEVEL_ELEMENT_BULLETS 0x03
|
||||
#define SFG_LEVEL_ELEMENT_ROCKETS 0x04
|
||||
#define SFG_LEVEL_ELEMENT_PLASMA 0x05
|
||||
#define SFG_LEVEL_ELEMENT_TREE 0x06
|
||||
#define SFG_LEVEL_ELEMENT_FINISH 0x07
|
||||
#define SFG_LEVEL_ELEMENT_TELEPORT 0x08
|
||||
#define SFG_LEVEL_ELEMENT_TERMINAL 0x09
|
||||
#define SFG_LEVEL_ELEMENT_COLUMN 0x0a
|
||||
#define SFG_LEVEL_ELEMENT_RUIN 0x0b
|
||||
#define SFG_LEVEL_ELEMENT_LAMP 0x0c
|
||||
#define SFG_LEVEL_ELEMENT_CARD0 0x0d ///< Access card, unlocks doors with lock.
|
||||
#define SFG_LEVEL_ELEMENT_CARD1 0x0e
|
||||
#define SFG_LEVEL_ELEMENT_CARD2 0x0f
|
||||
#define SFG_LEVEL_ELEMENT_LOCK0 0x10 /**< Special level element that must be
|
||||
placed on a tile with door. This door is
|
||||
then unlocked by taking the corresponding
|
||||
access card. */
|
||||
#define SFG_LEVEL_ELEMENT_LOCK1 0x11
|
||||
#define SFG_LEVEL_ELEMENT_LOCK2 0x12
|
||||
#define SFG_LEVEL_ELEMENT_BLOCKER 0x13 ///< Invisible wall.
|
||||
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x20
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_DESTROYER 0x21
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_WARRIOR 0x22
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT 0x23
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_ENDER 0x24
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_TURRET 0x25
|
||||
#define SFG_LEVEL_ELEMENT_MONSTER_EXPLODER 0x26
|
||||
|
||||
#define SFG_MONSTERS_TOTAL 7
|
||||
|
||||
#define SFG_MONSTER_TYPE_TO_INDEX(monsterType) \
|
||||
((monsterType) - SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
|
||||
|
||||
#define SFG_MONSTER_INDEX_TO_TYPE(monsterIndex) \
|
||||
((monsterIndex) + SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
|
||||
|
||||
#define SFG_LEVEL_ELEMENT_TYPE_IS_MOSTER(t) \
|
||||
((t) >= SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SFG_MapArray mapArray;
|
||||
SFG_TileDictionary tileDictionary;
|
||||
uint8_t textureIndices[7]; /**< Says which textures are used on the map. There
|
||||
can be at most 7 because of 3bit indexing (one
|
||||
value is reserved for special transparent
|
||||
texture). */
|
||||
uint8_t doorTextureIndex; /**< Index (global, NOT from textureIndices) of a
|
||||
texture used for door. */
|
||||
uint8_t floorColor;
|
||||
uint8_t ceilingColor;
|
||||
uint8_t playerStart[3]; /**< Player starting location: square X, square Y,
|
||||
direction (fourths of RCL_Unit). */
|
||||
uint8_t backgroundImage; /** Index of level background image. */
|
||||
SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS];
|
||||
} SFG_Level;
|
||||
|
||||
static inline SFG_TileDefinition SFG_getMapTile
|
||||
(
|
||||
const SFG_Level *level,
|
||||
int16_t x,
|
||||
int16_t y,
|
||||
uint8_t *properties
|
||||
)
|
||||
{
|
||||
if (x < 0 || x >= SFG_MAP_SIZE || y < 0 || y >= SFG_MAP_SIZE)
|
||||
{
|
||||
*properties = SFG_TILE_PROPERTY_NORMAL;
|
||||
return SFG_OUTSIDE_TILE;
|
||||
}
|
||||
|
||||
uint8_t tile = level->mapArray[y * SFG_MAP_SIZE + x];
|
||||
|
||||
*properties = tile & 0xc0;
|
||||
return level->tileDictionary[tile & 0x3f];
|
||||
}
|
||||
|
||||
#define SFG_NUMBER_OF_LEVELS 10
|
||||
|
||||
/*
|
||||
NOTE: Initially the levels were stored sequentially in one big array, but that
|
||||
caused some issues with Arduino's PROGMEM, so now we store each level in a
|
||||
separate variable and eventually create an array of pointers to these.
|
||||
*/
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level1 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level2 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level3 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level4 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level5 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level6 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level7 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level8 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
SFG_PROGRAM_MEMORY SFG_Level SFG_level9 =
|
||||
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
|
||||
;
|
||||
|
||||
static const SFG_Level * SFG_levels[SFG_NUMBER_OF_LEVELS] =
|
||||
{
|
||||
&SFG_level0, &SFG_level1, &SFG_level2, &SFG_level3, &SFG_level4, &SFG_level5,
|
||||
&SFG_level6, &SFG_level7, &SFG_level8, &SFG_level9
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* mbed SDK
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Automatically generated configuration file.
|
||||
// DO NOT EDIT, content will be overwritten.
|
||||
|
||||
#ifndef __MBED_CONFIG_DATA__
|
||||
#define __MBED_CONFIG_DATA__
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
File: libacl.h
|
||||
|
||||
(C) 1999, 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __ACL_LIBACL_H
|
||||
#define __ACL_LIBACL_H
|
||||
|
||||
#include <sys/acl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Flags for acl_to_any_text() */
|
||||
|
||||
/* Print NO, SOME or ALL effective permissions comments. SOME prints
|
||||
effective rights comments for entries which have different permissions
|
||||
than effective permissions. */
|
||||
#define TEXT_SOME_EFFECTIVE 0x01
|
||||
#define TEXT_ALL_EFFECTIVE 0x02
|
||||
|
||||
/* Align effective permission comments to column 32 using tabs or
|
||||
use a single tab. */
|
||||
#define TEXT_SMART_INDENT 0x04
|
||||
|
||||
/* User and group IDs instead of names. */
|
||||
#define TEXT_NUMERIC_IDS 0x08
|
||||
|
||||
/* Only output the first letter of entry types
|
||||
("u::rwx" instead of "user::rwx"). */
|
||||
#define TEXT_ABBREVIATE 0x10
|
||||
|
||||
/* acl_check error codes */
|
||||
|
||||
#define ACL_MULTI_ERROR (0x1000) /* multiple unique objects */
|
||||
#define ACL_DUPLICATE_ERROR (0x2000) /* duplicate Id's in entries */
|
||||
#define ACL_MISS_ERROR (0x3000) /* missing required entry */
|
||||
#define ACL_ENTRY_ERROR (0x4000) /* wrong entry type */
|
||||
|
||||
extern char *acl_to_any_text(acl_t acl, const char *prefix,
|
||||
char separator, int options);
|
||||
extern int acl_cmp(acl_t acl1, acl_t acl2);
|
||||
extern int acl_check(acl_t acl, int *last);
|
||||
extern acl_t acl_from_mode(mode_t mode);
|
||||
extern int acl_equiv_mode(acl_t acl, mode_t *mode_p);
|
||||
extern int acl_extended_file(const char *path_p);
|
||||
extern int acl_extended_file_nofollow(const char *path_p);
|
||||
extern int acl_extended_fd(int fd);
|
||||
extern int acl_entries(acl_t acl);
|
||||
extern const char *acl_error(int code);
|
||||
extern int acl_get_perm(acl_permset_t permset_d, acl_perm_t perm);
|
||||
|
||||
/* Copying permissions between files */
|
||||
struct error_context;
|
||||
extern int perm_copy_file (const char *, const char *,
|
||||
struct error_context *);
|
||||
extern int perm_copy_fd (const char *, int, const char *, int,
|
||||
struct error_context *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ACL_LIBACL_H */
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2002,2004 Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __ATTRIBUTES_H__
|
||||
#define __ATTRIBUTES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef ENOATTR
|
||||
# define ENOATTR ENODATA
|
||||
#endif
|
||||
|
||||
/*
|
||||
* An almost-IRIX-compatible extended attributes API
|
||||
* (the IRIX attribute "list" operation is missing, added ATTR_SECURE).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The maximum size (into the kernel or returned from the kernel) of an
|
||||
* attribute value or the buffer used for an attr_list() call. Larger
|
||||
* sizes will result in an E2BIG return code.
|
||||
*/
|
||||
#define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */
|
||||
|
||||
|
||||
/*
|
||||
* Flags that can be used with any of the simple attribute calls.
|
||||
* All desired flags should be bit-wise OR'ed together.
|
||||
*/
|
||||
#define ATTR_DONTFOLLOW 0x0001 /* do not follow symlinks for a pathname */
|
||||
#define ATTR_ROOT 0x0002 /* use root namespace attributes in op */
|
||||
#define ATTR_TRUST 0x0004 /* tell server we can be trusted to properly
|
||||
handle extended attributes */
|
||||
#define ATTR_SECURE 0x0008 /* use security namespace attributes in op */
|
||||
|
||||
/*
|
||||
* Additional flags that can be used with the set() attribute call.
|
||||
* All desired flags (from both lists) should be bit-wise OR'ed together.
|
||||
*/
|
||||
#define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */
|
||||
#define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */
|
||||
|
||||
/*
|
||||
* Define how lists of attribute names are returned to the user from
|
||||
* the attr_list() call. A large, 32bit aligned, buffer is passed in
|
||||
* along with its size. We put an array of offsets at the top that each
|
||||
* reference an attrlist_ent_t and pack the attrlist_ent_t's at the bottom.
|
||||
*/
|
||||
typedef struct attrlist {
|
||||
int32_t al_count; /* number of entries in attrlist */
|
||||
int32_t al_more; /* T/F: more attrs (do call again) */
|
||||
int32_t al_offset[1]; /* byte offsets of attrs [var-sized] */
|
||||
} attrlist_t;
|
||||
|
||||
/*
|
||||
* Show the interesting info about one attribute. This is what the
|
||||
* al_offset[i] entry points to.
|
||||
*/
|
||||
typedef struct attrlist_ent { /* data from attr_list() */
|
||||
uint32_t a_valuelen; /* number bytes in value of attr */
|
||||
char a_name[1]; /* attr name (NULL terminated) */
|
||||
} attrlist_ent_t;
|
||||
|
||||
/*
|
||||
* Given a pointer to the (char*) buffer containing the attr_list() result,
|
||||
* and an index, return a pointer to the indicated attribute in the buffer.
|
||||
*/
|
||||
#define ATTR_ENTRY(buffer, index) \
|
||||
((attrlist_ent_t *) \
|
||||
&((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ])
|
||||
|
||||
/*
|
||||
* Implement a "cursor" for use in successive attr_list() calls.
|
||||
* It provides a way to find the last attribute that was returned in the
|
||||
* last attr_list() call so that we can get the next one without missing
|
||||
* any. This should be bzero()ed before use and whenever it is desired to
|
||||
* start over from the beginning of the attribute list. The only valid
|
||||
* operation on a cursor is to bzero() it.
|
||||
*/
|
||||
typedef struct attrlist_cursor {
|
||||
uint32_t opaque[4]; /* an opaque cookie */
|
||||
} attrlist_cursor_t;
|
||||
|
||||
/*
|
||||
* Multi-attribute operation vector.
|
||||
*/
|
||||
typedef struct attr_multiop {
|
||||
int32_t am_opcode; /* operation to perform (ATTR_OP_GET, etc.) */
|
||||
int32_t am_error; /* [out arg] result of this sub-op (an errno) */
|
||||
char *am_attrname; /* attribute name to work with */
|
||||
char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */
|
||||
int32_t am_length; /* [in/out arg] length of value */
|
||||
int32_t am_flags; /* flags (bit-wise OR of #defines above) */
|
||||
} attr_multiop_t;
|
||||
#define ATTR_MAX_MULTIOPS 128 /* max number ops in an oplist array */
|
||||
|
||||
/*
|
||||
* Valid values of am_opcode.
|
||||
*/
|
||||
#define ATTR_OP_GET 1 /* return the indicated attr's value */
|
||||
#define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */
|
||||
#define ATTR_OP_REMOVE 3 /* remove the indicated attr */
|
||||
|
||||
/*
|
||||
* Get the value of an attribute.
|
||||
* Valuelength must be set to the maximum size of the value buffer, it will
|
||||
* be set to the actual number of bytes used in the value buffer upon return.
|
||||
* The return value is -1 on error (w/errno set appropriately), 0 on success.
|
||||
*/
|
||||
extern int attr_get (const char *__path, const char *__attrname,
|
||||
char *__attrvalue, int *__valuelength, int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
extern int attr_getf (int __fd, const char *__attrname, char *__attrvalue,
|
||||
int *__valuelength, int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Set the value of an attribute, creating the attribute if necessary.
|
||||
* The return value is -1 on error (w/errno set appropriately), 0 on success.
|
||||
*/
|
||||
extern int attr_set (const char *__path, const char *__attrname,
|
||||
const char *__attrvalue, const int __valuelength,
|
||||
int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
extern int attr_setf (int __fd, const char *__attrname,
|
||||
const char *__attrvalue, const int __valuelength,
|
||||
int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Remove an attribute.
|
||||
* The return value is -1 on error (w/errno set appropriately), 0 on success.
|
||||
*/
|
||||
extern int attr_remove (const char *__path, const char *__attrname,
|
||||
int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
extern int attr_removef (int __fd, const char *__attrname, int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* List the names and sizes of the values of all the attributes of an object.
|
||||
* "Cursor" must be allocated and zeroed before the first call, it is used
|
||||
* to maintain context between system calls if all the attribute names won't
|
||||
* fit into the buffer on the first system call.
|
||||
* The return value is -1 on error (w/errno set appropriately), 0 on success.
|
||||
*/
|
||||
extern int attr_list(const char *__path, char *__buffer, const int __buffersize,
|
||||
int __flags, attrlist_cursor_t *__cursor)
|
||||
__attribute__ ((deprecated));
|
||||
extern int attr_listf(int __fd, char *__buffer, const int __buffersize,
|
||||
int __flags, attrlist_cursor_t *__cursor)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
/*
|
||||
* Operate on multiple attributes of the same object simultaneously.
|
||||
*
|
||||
* This call will save on system call overhead when many attributes are
|
||||
* going to be operated on.
|
||||
*
|
||||
* The return value is -1 on error (w/errno set appropriately), 0 on success.
|
||||
* Note that this call will not return -1 as a result of failure of any
|
||||
* of the sub-operations, their return value is stored in each element
|
||||
* of the operation array. This call will return -1 for a failure of the
|
||||
* call as a whole, eg: if the pathname doesn't exist, or the fd is bad.
|
||||
*
|
||||
* The semantics and allowable values for the fields in a attr_multiop_t
|
||||
* are the same as the semantics and allowable values for the arguments to
|
||||
* the corresponding "simple" attribute interface. For example: the args
|
||||
* to a ATTR_OP_GET are the same as the args to an attr_get() call.
|
||||
*/
|
||||
extern int attr_multi (const char *__path, attr_multiop_t *__oplist,
|
||||
int __count, int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
extern int attr_multif (int __fd, attr_multiop_t *__oplist,
|
||||
int __count, int __flags)
|
||||
__attribute__ ((deprecated));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ATTRIBUTES_H__ */
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
Copyright (C) 2009 Andreas Gruenbacher <agruen@suse.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __ERROR_CONTEXT_T
|
||||
#define __ERROR_CONTEXT_T
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct error_context {
|
||||
/* Process an error message */
|
||||
void (*error) (struct error_context *, const char *, ...);
|
||||
|
||||
/* Quote a file name for including in an error message */
|
||||
const char *(*quote) (struct error_context *, const char *);
|
||||
|
||||
/* Free a quoted name */
|
||||
void (*quote_free) (struct error_context *, const char *);
|
||||
};
|
||||
|
||||
#ifdef ERROR_CONTEXT_MACROS
|
||||
# define error(ctx, args...) do { \
|
||||
if ((ctx) && (ctx)->error) \
|
||||
(ctx)->error((ctx), args); \
|
||||
} while(0)
|
||||
# define quote(ctx, name) \
|
||||
( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) )
|
||||
# define quote_free(ctx, name) do { \
|
||||
if ((ctx) && (ctx)->quote_free) \
|
||||
(ctx)->quote_free((ctx), (name)); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ERROR_CONTEXT_T */
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright (C) 2009 Andreas Gruenbacher <agruen@suse.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LIBATTR_H
|
||||
#define __LIBATTR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct error_context;
|
||||
|
||||
extern int attr_copy_file (const char *, const char *,
|
||||
int (*) (const char *, struct error_context *),
|
||||
struct error_context *);
|
||||
extern int attr_copy_fd (const char *, int, const char *, int,
|
||||
int (*) (const char *, struct error_context *),
|
||||
struct error_context *);
|
||||
|
||||
/* Keep this function for backwards compatibility. */
|
||||
extern int attr_copy_check_permissions(const char *, struct error_context *);
|
||||
|
||||
#define ATTR_ACTION_SKIP 1
|
||||
#define ATTR_ACTION_PERMISSIONS 2
|
||||
|
||||
extern int attr_copy_action(const char *, struct error_context *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,461 @@
|
|||
/*
|
||||
* blkid.h - Interface for libblkid, a library to identify block devices
|
||||
*
|
||||
* Copyright (C) 2001 Andreas Dilger
|
||||
* Copyright (C) 2003 Theodore Ts'o
|
||||
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _BLKID_BLKID_H
|
||||
#define _BLKID_BLKID_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLKID_VERSION "2.31.1"
|
||||
#define BLKID_DATE "19-Dec-2017"
|
||||
|
||||
/**
|
||||
* blkid_dev:
|
||||
*
|
||||
* The device object keeps information about one device
|
||||
*/
|
||||
typedef struct blkid_struct_dev *blkid_dev;
|
||||
|
||||
/**
|
||||
* blkid_cache:
|
||||
*
|
||||
* information about all system devices
|
||||
*/
|
||||
typedef struct blkid_struct_cache *blkid_cache;
|
||||
|
||||
/**
|
||||
* blkid_probe:
|
||||
*
|
||||
* low-level probing setting
|
||||
*/
|
||||
typedef struct blkid_struct_probe *blkid_probe;
|
||||
|
||||
/**
|
||||
* blkid_topology:
|
||||
*
|
||||
* device topology information
|
||||
*/
|
||||
typedef struct blkid_struct_topology *blkid_topology;
|
||||
|
||||
/**
|
||||
* blkid_partlist
|
||||
*
|
||||
* list of all detected partitions and partitions tables
|
||||
*/
|
||||
typedef struct blkid_struct_partlist *blkid_partlist;
|
||||
|
||||
/**
|
||||
* blkid_partition:
|
||||
*
|
||||
* information about a partition
|
||||
*/
|
||||
typedef struct blkid_struct_partition *blkid_partition;
|
||||
|
||||
/**
|
||||
* blkid_parttable:
|
||||
*
|
||||
* information about a partition table
|
||||
*/
|
||||
typedef struct blkid_struct_parttable *blkid_parttable;
|
||||
|
||||
/**
|
||||
* blkid_loff_t:
|
||||
*
|
||||
* 64-bit signed number for offsets and sizes
|
||||
*/
|
||||
typedef int64_t blkid_loff_t;
|
||||
|
||||
/**
|
||||
* blkid_tag_iterate:
|
||||
*
|
||||
* tags iterator for high-level (blkid_cache) API
|
||||
*/
|
||||
typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
|
||||
|
||||
/**
|
||||
* blkid_dev_iterate:
|
||||
*
|
||||
* devices iterator for high-level (blkid_cache) API
|
||||
*/
|
||||
typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
|
||||
|
||||
/*
|
||||
* Flags for blkid_get_dev
|
||||
*
|
||||
* BLKID_DEV_CREATE Create an empty device structure if not found
|
||||
* in the cache.
|
||||
* BLKID_DEV_VERIFY Make sure the device structure corresponds
|
||||
* with reality.
|
||||
* BLKID_DEV_FIND Just look up a device entry, and return NULL
|
||||
* if it is not found.
|
||||
* BLKID_DEV_NORMAL Get a valid device structure, either from the
|
||||
* cache or by probing the device.
|
||||
*/
|
||||
#define BLKID_DEV_FIND 0x0000
|
||||
#define BLKID_DEV_CREATE 0x0001
|
||||
#define BLKID_DEV_VERIFY 0x0002
|
||||
#define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
|
||||
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __ul_attribute__
|
||||
# if __GNUC_PREREQ (3, 4)
|
||||
# define __ul_attribute__(_a_) __attribute__(_a_)
|
||||
# else
|
||||
# define __ul_attribute__(_a_)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* cache.c */
|
||||
extern void blkid_init_debug(int mask);
|
||||
extern void blkid_put_cache(blkid_cache cache);
|
||||
extern int blkid_get_cache(blkid_cache *cache, const char *filename);
|
||||
extern void blkid_gc_cache(blkid_cache cache);
|
||||
|
||||
/* dev.c */
|
||||
extern const char *blkid_dev_devname(blkid_dev dev)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
|
||||
extern int blkid_dev_set_search(blkid_dev_iterate iter,
|
||||
char *search_type, char *search_value);
|
||||
extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
|
||||
extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
|
||||
|
||||
/* devno.c */
|
||||
extern char *blkid_devno_to_devname(dev_t devno)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern int blkid_devno_to_wholedisk(dev_t dev, char *diskname,
|
||||
size_t len, dev_t *diskdevno)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* devname.c */
|
||||
extern int blkid_probe_all(blkid_cache cache);
|
||||
extern int blkid_probe_all_new(blkid_cache cache);
|
||||
extern int blkid_probe_all_removable(blkid_cache cache);
|
||||
|
||||
extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags);
|
||||
|
||||
/* getsize.c */
|
||||
extern blkid_loff_t blkid_get_dev_size(int fd);
|
||||
|
||||
/* verify.c */
|
||||
extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
|
||||
|
||||
/* read.c */
|
||||
|
||||
/* resolve.c */
|
||||
extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
|
||||
const char *devname)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern char *blkid_get_devname(blkid_cache cache, const char *token,
|
||||
const char *value)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* tag.c */
|
||||
extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
|
||||
extern int blkid_tag_next(blkid_tag_iterate iterate,
|
||||
const char **type, const char **value);
|
||||
extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
|
||||
extern int blkid_dev_has_tag(blkid_dev dev, const char *type, const char *value);
|
||||
|
||||
extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
|
||||
const char *type,
|
||||
const char *value);
|
||||
|
||||
extern int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val);
|
||||
|
||||
/* version.c */
|
||||
extern int blkid_parse_version_string(const char *ver_string)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_get_library_version(const char **ver_string,
|
||||
const char **date_string);
|
||||
|
||||
/* encode.c */
|
||||
extern int blkid_encode_string(const char *str, char *str_enc, size_t len);
|
||||
extern int blkid_safe_string(const char *str, char *str_safe, size_t len);
|
||||
|
||||
/* evaluate.c */
|
||||
extern int blkid_send_uevent(const char *devname, const char *action);
|
||||
extern char *blkid_evaluate_tag(const char *token, const char *value,
|
||||
blkid_cache *cache)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* probe.c */
|
||||
extern blkid_probe blkid_new_probe(void)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern blkid_probe blkid_new_probe_from_filename(const char *filename)
|
||||
__ul_attribute__((warn_unused_result))
|
||||
__ul_attribute__((nonnull));
|
||||
extern void blkid_free_probe(blkid_probe pr);
|
||||
|
||||
extern void blkid_reset_probe(blkid_probe pr);
|
||||
extern int blkid_probe_reset_buffers(blkid_probe pr);
|
||||
extern int blkid_probe_hide_range(blkid_probe pr, uint64_t off, uint64_t len);
|
||||
|
||||
extern int blkid_probe_set_device(blkid_probe pr, int fd,
|
||||
blkid_loff_t off, blkid_loff_t size)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern dev_t blkid_probe_get_devno(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern dev_t blkid_probe_get_wholedisk_devno(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_is_wholedisk(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern blkid_loff_t blkid_probe_get_size(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_probe_get_sectors(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_get_fd(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* superblocks probing
|
||||
*/
|
||||
extern int blkid_known_fstype(const char *fstype)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage);
|
||||
|
||||
extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
|
||||
#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/
|
||||
#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */
|
||||
#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */
|
||||
#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */
|
||||
#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */
|
||||
#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */
|
||||
#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */
|
||||
#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */
|
||||
#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */
|
||||
|
||||
#define BLKID_SUBLKS_DEFAULT (BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | \
|
||||
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE)
|
||||
|
||||
extern int blkid_probe_set_superblocks_flags(blkid_probe pr, int flags)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_reset_superblocks_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_invert_superblocks_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/**
|
||||
* BLKID_FLTR_NOTIN
|
||||
*/
|
||||
#define BLKID_FLTR_NOTIN 1
|
||||
/**
|
||||
* BLKID_FLTR_ONLYIN
|
||||
*/
|
||||
#define BLKID_FLTR_ONLYIN 2
|
||||
extern int blkid_probe_filter_superblocks_type(blkid_probe pr, int flag, char *names[] |