Skip to content

Commit

Permalink
prepare for const ( deprecation in vlang/v#22019
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Aug 10, 2024
1 parent 4ccbc8f commit 5745194
Show file tree
Hide file tree
Showing 19 changed files with 316 additions and 362 deletions.
4 changes: 1 addition & 3 deletions kernel/modules/block/partition/partition.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import resource
import lib
import fs

const (
gpt_signature = u64(0x5452415020494645)
)
const gpt_signature = u64(0x5452415020494645)

struct Partition {
pub mut:
Expand Down
42 changes: 20 additions & 22 deletions kernel/modules/dev/ahci/ahci.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,26 @@ import fs
import katomic
import time.sys

const (
ahci_class = 0x1
ahci_subclass = 0x6
ahci_progif = 0x1
sata_ata = 0x101
sata_atapi = u32(0xeb140101)
sata_semb = u32(0xc33C0101)
sata_pm = u32(0x96690101)
hba_cmd_st = 0x1
hba_cmd_fre = 0x10
hba_cmd_fr = 0x4000
hba_cmd_cr = 0x8000
fis_reg_h2d = 0x27
fis_reg_d2h = 0x34
fis_dma_enable = 0x39
fis_dma_setup = 0x41
fis_data = 0x46
fis_bist = 0x58
fis_pio_setup = 0x5f
fis_device_bits = 0xa1
sector_size = 0x200
)
const ahci_class = 0x1
const ahci_subclass = 0x6
const ahci_progif = 0x1
const sata_ata = 0x101
const sata_atapi = u32(0xeb140101)
const sata_semb = u32(0xc33C0101)
const sata_pm = u32(0x96690101)
const hba_cmd_st = 0x1
const hba_cmd_fre = 0x10
const hba_cmd_fr = 0x4000
const hba_cmd_cr = 0x8000
const fis_reg_h2d = 0x27
const fis_reg_d2h = 0x34
const fis_dma_enable = 0x39
const fis_dma_setup = 0x41
const fis_data = 0x46
const fis_bist = 0x58
const fis_pio_setup = 0x5f
const fis_device_bits = 0xa1
const sector_size = 0x200

@[packed]
struct AHCIRegisters {
Expand Down
32 changes: 15 additions & 17 deletions kernel/modules/dev/console/console.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ import file
import userland
import proc
import katomic
import flanterm

const (
max_scancode = 0x57
capslock = 0x3a
numlock = 0x45
left_alt = 0x38
left_alt_rel = 0xb8
right_shift = 0x36
left_shift = 0x2a
right_shift_rel = 0xb6
left_shift_rel = 0xaa
ctrl = 0x1d
ctrl_rel = 0x9d
console_buffer_size = 1024
console_bigbuf_size = 4096
)
import flanterm as _

const max_scancode = 0x57
const capslock = 0x3a
const numlock = 0x45
const left_alt = 0x38
const left_alt_rel = 0xb8
const right_shift = 0x36
const left_shift = 0x2a
const right_shift_rel = 0xb6
const left_shift_rel = 0xaa
const ctrl = 0x1d
const ctrl_rel = 0x9d
const console_buffer_size = 1024
const console_bigbuf_size = 4096

__global (
console_convtab_numpad_numlock map[u8]u8
Expand Down
38 changes: 16 additions & 22 deletions kernel/modules/dev/nvme/nvme.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,22 @@ import block.partition
import fs
import katomic

const (
nvme_class = 0x1
nvme_subclass = 0x8
nvme_progif = 0x2
)

const (
opcode_delete_sq = 0x0
opcode_create_sq = 0x1
opcode_delete_cq = 0x4
opcode_create_cq = 0x5
opcode_identify = 0x6
opcode_abort = 0x8
opcode_set_features = 0x9
opcode_get_features = 0xa
opcode_ns_management = 0xd
opcode_format_cmd = 0x80
)

const (
nvme_io_queue_cnt = 0x4
)
const nvme_class = 0x1
const nvme_subclass = 0x8
const nvme_progif = 0x2

const opcode_delete_sq = 0x0
const opcode_create_sq = 0x1
const opcode_delete_cq = 0x4
const opcode_create_cq = 0x5
const opcode_identify = 0x6
const opcode_abort = 0x8
const opcode_set_features = 0x9
const opcode_get_features = 0xa
const opcode_ns_management = 0xd
const opcode_format_cmd = 0x80

const nvme_io_queue_cnt = 0x4

@[packed]
struct NVMERegisters {
Expand Down
40 changes: 18 additions & 22 deletions kernel/modules/elf/elf.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@ pub mut:
at_phnum u64
}

pub const (
et_dyn = 0x03
pub const et_dyn = 0x03

at_entry = 9
at_phdr = 3
at_phent = 4
at_phnum = 5
pub const at_entry = 9
pub const at_phdr = 3
pub const at_phent = 4
pub const at_phnum = 5

pt_load = 0x00000001
pt_interp = 0x00000003
pt_phdr = 0x00000006
pub const pt_load = 0x00000001
pub const pt_interp = 0x00000003
pub const pt_phdr = 0x00000006

abi_sysv = 0x00
arch_x86_64 = 0x3e
bits_le = 0x01
pub const abi_sysv = 0x00
pub const arch_x86_64 = 0x3e
pub const bits_le = 0x01

ei_class = 4
ei_data = 5
ei_version = 6
ei_osabi = 7
)
pub const ei_class = 4
pub const ei_data = 5
pub const ei_version = 6
pub const ei_osabi = 7

pub struct Header {
pub mut:
Expand All @@ -57,11 +55,9 @@ pub mut:
shstrndx u16
}

pub const (
pf_x = 1
pf_w = 2
pf_r = 4
)
pub const pf_x = 1
pub const pf_w = 2
pub const pf_r = 4

pub struct ProgramHdr {
pub mut:
Expand Down
Loading

0 comments on commit 5745194

Please sign in to comment.