aboutsummaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2026-10-26 03:08:03 +0100
committerJavier <dev.git@javispedro.com>2026-10-26 03:08:03 +0100
commit2b80e7e349eeb6b5839577946cff962470d57c21 (patch)
tree1f9a3d482f92faa64748cc9f5380ad5b1e44922d /linux
parent21e31414334b494c4e3f2ebae5f3bfe6c5e00da3 (diff)
downloadchu-2b80e7e349eeb6b5839577946cff962470d57c21.tar.gz
chu-2b80e7e349eeb6b5839577946cff962470d57c21.zip
change default major number to 63
Diffstat (limited to 'linux')
-rw-r--r--linux/chudisk.c17
-rw-r--r--linux/makefile5
-rwxr-xr-xlinux/mkdev.sh2
3 files changed, 13 insertions, 11 deletions
diff --git a/linux/chudisk.c b/linux/chudisk.c
index 31dd9e5..c2eb2f7 100644
--- a/linux/chudisk.c
+++ b/linux/chudisk.c
@@ -28,8 +28,8 @@
/* module parameters */
/** configurable major number */
-/* by default, reuse the one from Mylex DAC960 PCI RAID controller; sixth controller" */
-static short major = 53;
+/* by default, reuse one in the experimental space */
+static short major = 63;
/** IO base */
static short io = 0x260;
/** skip device proving */
@@ -39,7 +39,7 @@ static int softblk = 1024;
/* for blk.h: (needs to be defined before blk.h/lnxabs.h is included) */
#define MAJOR_NR major
-#define DEVICE_NAME "CH375"
+#define DEVICE_NAME "chud"
#define DEVICE_REQUEST do_chudisk_request
#define DEVICE_NR(device) (MINOR(device)>>CHUDISK_MINOR_SHIFT)
#define DEVICE_ON(device)
@@ -50,7 +50,6 @@ static int softblk = 1024;
#include "ch375lnx.h"
#include <scsi.h>
-#define ENABLE_DLOG 0
#if ENABLE_DLOG
#define dprintf(args...) printk(KERN_DEBUG args)
#else
@@ -87,7 +86,7 @@ static struct ch375 chudisk_dev[CHUDISK_MAX_UNITS];
/** main gendisk layer data structure, which handles partioning */
static struct gendisk chudisk_gendisk = {
- .major_name = "chud",
+ .major_name = DEVICE_NAME,
.minor_shift = CHUDISK_MINOR_SHIFT,
.max_p = CHUDISK_MAX_PARTITIONS,
.max_nr = CHUDISK_MAX_UNITS,
@@ -148,7 +147,7 @@ static unsigned disk_read_sectors(struct ch375 *dev, uint8_t *buffer, uint32_t l
uint8_t result;
unsigned total = 0; // Total bytes written
- dprintf("disk read buf=%p sector=%lu num=%hu\n", buffer, lba, num);
+ dprintf("disk read buf=%p sector=%u num=%hu\n", buffer, lba, num);
// Initiate read operation
ch375_disk_read(dev, lba, num);
@@ -197,7 +196,7 @@ static unsigned disk_write_sectors(struct ch375 *dev, uint8_t *buffer, uint32_t
uint8_t result;
unsigned total = 0; // Total bytes written
- dprintf("disk write buf=%p sector=%lu num=%hu\n", buffer, lba, num);
+ dprintf("disk write buf=%p sector=%u num=%hu\n", buffer, lba, num);
// Initiate operation
ch375_disk_write(dev, lba, num);
@@ -387,7 +386,7 @@ static int chudisk_revalidate(kdev_t devno)
blk_size = ntohl(*(uint32_t*)&buffer[4]);
sector_cnt = ntohl(*(uint32_t*)&buffer[0]);
- dprintf("chudisk: sector size %u num sectors %u\n", blk_size, sector_cnt);
+ dprintf("chudisk[%d]: sector size %u num sectors %u\n", unit, blk_size, sector_cnt);
// TODO Support non-default block_size
dev->sec_size = blk_size;
@@ -585,7 +584,7 @@ static __init int chudisk_init(void)
blksize_size[MAJOR_NR] = chudisk_blksizes;
hardsect_size[MAJOR_NR] = chudisk_hardsectsizes;
- chudisk_gendisk.major = major;
+ chudisk_gendisk.major = MAJOR_NR;
chudisk_gendisk.nr_real = 1;
chudisk_gendisk.next = gendisk_head;
gendisk_head = &chudisk_gendisk;
diff --git a/linux/makefile b/linux/makefile
index f293cc1..e88ebac 100644
--- a/linux/makefile
+++ b/linux/makefile
@@ -2,6 +2,9 @@ MODDIR := /lib/modules/$(shell uname -r)
INCLUDE := -isystem $(MODDIR)/build/include -isystem ../inc
CFLAGS := -O2 -D__KERNEL__ -DMODULE -Wall $(INCLUDE)
+ifeq ($(debug),1)
+CFLAGS += -DENABLE_DLOG
+endif
ifneq (,$(wildcard $(MODDIR)/build/include/linux/modversions.h))
CFLAGS += -DMODVERSIONS
endif
@@ -16,7 +19,7 @@ clean:
install: chudisk.o
install -m0644 chudisk.o $(MODDIR)/block
- depmod -A
+ depmod
uninstall:
rm -f $(MODDIR)/block/chudisk.o
diff --git a/linux/mkdev.sh b/linux/mkdev.sh
index d1393e6..1a05b91 100755
--- a/linux/mkdev.sh
+++ b/linux/mkdev.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-major=53
+major=63
if [ $# -gt 0 ]; then
major=$1
fi