Make shell:disk_list_partitions() more verbose

Show disk sector size and capacity, partition's size and start sector.
This commit is contained in:
Ivan Baravy 2023-01-03 20:39:10 +00:00
parent b0be99a9e9
commit f291ffc03b
32 changed files with 273 additions and 77 deletions

View File

@ -5,21 +5,89 @@ MKFILEPATTERN=../tools/mkfilepattern
DIRTOTEST=python3 ../tools/dirtotest.py
MOUNT_OPT=-t xfs
TEMP_DIR:=$(shell mktemp -d)
LOOP_DEV=$(shell losetup --find)
XFS_MIN_PART_SIZE=300MiB
all: s05k s4k unicode v5 kolibri.img fat32_test0.img coverage
all: s05k s4k unicode v5 kolibri.img fat32_test0.img coverage gpt
rmdir $(TEMP_DIR)
s05k: xfs_v4_ftype0_s05k_b2k_n8k.img xfs_v4_ftype1_s05k_b2k_n8k.img xfs_v4_xattr.img xfs_v4_files_s05k_b4k_n8k.img xfs_v4_ftype0_s05k_b2k_n8k_xattr.img xfs_v4_btrees_l2.img xfs_short_dir_i8.img exfat_s05k_c16k_b16k.img
s05k: xfs_v4_ftype0_s05k_b2k_n8k.img xfs_v4_ftype1_s05k_b2k_n8k.img \
xfs_v4_xattr.img xfs_v4_files_s05k_b4k_n8k.img \
xfs_v4_ftype0_s05k_b2k_n8k_xattr.img xfs_v4_btrees_l2.img \
xfs_short_dir_i8.img exfat_s05k_c8k_b8k.img exfat_s05k_c16k_b16k.img \
gpt_partitions_s05k.img
s4k: xfs_v4_ftype0_s4k_b4k_n8k.img
s4k: xfs_v4_ftype0_s4k_b4k_n8k.img gpt_partitions_s4k.img
unicode: xfs_v4_unicode.img
v5: xfs_v5_ftype1_s05k_b2k_n8k.img xfs_v5_files_s05k_b4k_n8k.img xfs_bigtime.img xfs_nrext64.img xfs_lookup_v5.img xfs_lookup_v4.img
v5: xfs_v5_ftype1_s05k_b2k_n8k.img xfs_v5_files_s05k_b4k_n8k.img \
xfs_bigtime.img xfs_nrext64.img xfs_lookup_v5.img xfs_lookup_v4.img
coverage: jfs.img xfs_borg_bit.img xfs_short_dir_i8.img
gpt: gpt_partitions_s05k.img gpt_partitions_s4k.img
gpt_partitions_s05k.img:
fallocate -l 1GiB $@
parted --script --align optimal $@ mktable gpt
parted --script --align optimal $@ mkpart part0 1MiB 2MiB
parted --script --align optimal $@ mkpart part1 2MiB 3MiB
parted --script --align optimal $@ mkpart part2 4MiB 5MiB
parted --script --align optimal $@ mkpart part3 3MiB 4MiB
parted --script --align optimal $@ mkpart part4 5MiB 6MiB
parted --script --align optimal $@ mkpart part5 6MiB 7MiB
parted --script --align optimal $@ mkpart part6 7MiB 8MiB
parted --script --align optimal $@ mkpart part7 8MiB 9MiB
parted --script --align optimal $@ mkpart part8 9MiB 10MiB
parted --script --align optimal $@ mkpart part9 10MiB 11MiB
parted --script --align optimal $@ mkpart part10 11MiB 12MiB
parted --script --align optimal $@ mkpart part11 12MiB 13MiB
parted --script --align optimal $@ mkpart part12 13MiB 14MiB
parted --script --align optimal $@ mkpart part13 14MiB 15MiB
parted --script --align optimal $@ mkpart part14 15MiB 16MiB
parted --script --align optimal $@ mkpart part15 16MiB 17MiB
parted --script --align optimal $@ mkpart part16 17MiB 18MiB
parted --script --align optimal $@ mkpart part17 18MiB 19MiB
parted --script --align optimal $@ mkpart part18 19MiB 20MiB
parted --script --align optimal $@ mkpart part19 20MiB 21MiB
parted --script --align optimal $@ mkpart part20 21MiB 22MiB
parted --script --align optimal $@ mkpart part21 22MiB 23MiB
parted --script --align optimal $@ mkpart part22 23MiB 24MiB
parted --script --align optimal $@ mkpart part23 24MiB 25MiB
gpt_partitions_s4k.img:
fallocate -l 1GiB $@
sudo losetup -b 4096 $(LOOP_DEV) $@
sudo parted --script --align optimal $(LOOP_DEV) mktable msdos
sudo parted --script --align optimal $(LOOP_DEV) mkpart primary 1MiB 100%
sudo parted --script --align optimal $(LOOP_DEV) mktable gpt
sudo parted --script --align optimal $(LOOP_DEV) mkpart part0 1MiB 2MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part1 2MiB 3MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part2 4MiB 5MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part3 3MiB 4MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part4 5MiB 6MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part5 6MiB 7MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part6 7MiB 8MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part7 8MiB 9MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part8 9MiB 10MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part9 10MiB 11MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part10 11MiB 12MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part11 12MiB 13MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part12 13MiB 14MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part13 14MiB 15MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part14 15MiB 16MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part15 16MiB 17MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part16 17MiB 18MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part17 18MiB 19MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part18 19MiB 20MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part19 20MiB 21MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part20 21MiB 22MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part21 22MiB 23MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part22 23MiB 24MiB
sudo parted --script --align optimal $(LOOP_DEV) mkpart part23 24MiB 25MiB
sudo losetup -d $(LOOP_DEV)
kolibri.img: ../default.skn ../fill.cur
touch $@
fallocate -z -o 0 -l 1440KiB $@
@ -35,7 +103,7 @@ jfs.img:
fallocate -l 16MiB $@
mkfs.jfs -q $@
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_lookup_v4.img:
@ -171,7 +239,7 @@ xfs_borg_bit.img:
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -n version=ci $@
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_short_dir_i8.img:
@ -189,11 +257,11 @@ xfs_short_dir_i8.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
parted --script --align optimal $@ mktable gpt
parted --script --align optimal $@ mkpart part0 1MiB 99%
xfs_v4_ftype0_s05k_b2k_n8k.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -220,11 +288,11 @@ xfs_v4_ftype0_s05k_b2k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_ftype1_s05k_b2k_n8k.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=1 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -251,11 +319,11 @@ xfs_v4_ftype1_s05k_b2k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_xattr.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR) -o attr2
sudo chown $$USER $(TEMP_DIR) -R
@ -274,11 +342,11 @@ xfs_v4_xattr.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_btrees_l2.img:
fallocate -l 127MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=1k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=4k,ftype=1 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -295,11 +363,11 @@ xfs_v4_btrees_l2.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_files_s05k_b4k_n8k.img:
fallocate -l 127MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -n size=8k,ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -330,11 +398,11 @@ xfs_v4_files_s05k_b4k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_ftype0_s4k_b4k_n8k.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=4k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=4k -i maxpct=100 -n size=8k,ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -361,15 +429,13 @@ xfs_v4_ftype0_s4k_b4k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
sudo losetup -b 4096 /dev/loop8 $@
sudo parted --script /dev/loop8 mktable msdos
sudo losetup -b 4096 /dev/loop8 $@ # FIXME: --find --show, add gpt test
sudo parted --script --align optimal /dev/loop8 mktable msdos
sudo parted --script --align optimal /dev/loop8 mkpart primary 1MiB 100%
sudo losetup -d /dev/loop8
# parted --script $@ mktable msdos
# parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_ftype0_s05k_b2k_n8k_xattr.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=2k -m crc=0,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -403,11 +469,11 @@ xfs_v4_ftype0_s05k_b2k_n8k_xattr.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v4_unicode.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -m crc=0,finobt=0,rmapbt=0,reflink=0 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -428,11 +494,11 @@ xfs_v4_unicode.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v5_ftype1_s05k_b2k_n8k.img:
fallocate -l 63MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=2k -m crc=1,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -i maxpct=100 -n size=8k,ftype=1 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -459,11 +525,11 @@ xfs_v5_ftype1_s05k_b2k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
xfs_v5_files_s05k_b4k_n8k.img:
fallocate -l 127MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.xfs -b size=4k -m crc=1,finobt=0,rmapbt=0,reflink=0 -d sectsize=512 -n size=8k,ftype=1 $@
sudo mount $(MOUNT_OPT) $@ $(TEMP_DIR)
sudo chown $$USER $(TEMP_DIR) -R
@ -488,11 +554,11 @@ xfs_v5_files_s05k_b4k_n8k.img:
#
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
fat32_test0.img:
fallocate -l 64MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.fat -n KOLIBRIOS -F 32 $@
sudo mount -o codepage=866,iocharset=utf8,umask=111,dmask=000 $@ $(TEMP_DIR)
$(RANDDIR) $(TEMP_DIR) 1000 8 255 65536
@ -502,7 +568,7 @@ fat32_test0.img:
sudo umount $(TEMP_DIR)
exfat_s05k_c16k_b16k.img:
fallocate -l 256MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.exfat -L KOLIBRIOS -c 16k -b 16k $@
sudo mount -o codepage=866,iocharset=utf8,umask=111,dmask=000 $@ $(TEMP_DIR)
mkdir $(TEMP_DIR)/dir_0
@ -516,11 +582,11 @@ exfat_s05k_c16k_b16k.img:
# $(MKDIRRANGE) $(TEMP_DIR)/dir_100000 0 100000 201 43
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%
exfat_s05k_c8k_b8k.img:
fallocate -l 256MiB $@
fallocate -l $(XFS_MIN_PART_SIZE) $@
mkfs.exfat -L KOLIBRIOS -c 8k -b 8k $@
sudo mount -o codepage=866,iocharset=utf8,umask=111,dmask=000 $@ $(TEMP_DIR)
mkdir $(TEMP_DIR)/dir_000
@ -589,6 +655,6 @@ exfat_s05k_c8k_b8k.img:
echo -n 'x' > $(TEMP_DIR)/dir_031/file_031
sudo umount $(TEMP_DIR)
fallocate -i -o 0 -l 1MiB $@
parted --script $@ mktable msdos
parted --script --align optimal $@ mktable msdos
parted --script --align optimal $@ mkpart primary 1MiB 100%

65
shell.c
View File

@ -476,23 +476,64 @@ cmd_i40(struct shell_ctx *ctx, int argc, char **argv) {
regs.ebx, regs.ebx, (int32_t)regs.ebx);
}
static void
bytes_to_kmgt(uint64_t *bytes, const char **kmg) {
*kmg = "B";
lldiv_t d = lldiv(*bytes, 1024);
if (d.rem != 0) {
return;
}
*bytes = d.quot;
*kmg = "kiB";
d = lldiv(*bytes, 1024);
if (d.rem != 0) {
return;
}
*bytes = d.quot;
*kmg = "MiB";
d = lldiv(*bytes, 1024);
if (d.rem != 0) {
return;
}
*bytes = d.quot;
*kmg = "GiB";
d = lldiv(*bytes, 1024);
if (d.rem != 0) {
return;
}
*bytes = d.quot;
*kmg = "TiB";
}
static void
disk_list_partitions(disk_t *d) {
uint64_t kmgt_count = d->media_info.sector_size * d->media_info.capacity;
const char *kmgt = NULL;
bytes_to_kmgt(&kmgt_count, &kmgt);
printf("/%s: sector_size=%u, capacity=%" PRIu64 " (%" PRIu64 " %s), "
"num_partitions=%u\n", d->name, d->media_info.sector_size,
d->media_info.capacity, kmgt_count, kmgt, d->num_partitions);
for (size_t i = 0; i < d->num_partitions; i++) {
printf("/%s/%d: ", d->name, i+1);
if (d->partitions[i]->fs_user_functions == xfs_user_functions) {
puts("xfs");
} else if (d->partitions[i]->fs_user_functions == ext_user_functions) {
puts("ext");
} else if (d->partitions[i]->fs_user_functions == fat_user_functions) {
puts("fat");
} else if (d->partitions[i]->fs_user_functions == exfat_user_functions) {
puts("exfat");
} else if (d->partitions[i]->fs_user_functions == ntfs_user_functions) {
puts("ntfs");
partition_t *p = d->partitions[i];
const char *fsname;
if (p->fs_user_functions == xfs_user_functions) {
fsname = "xfs";
} else if (p->fs_user_functions == ext_user_functions) {
fsname = "ext";
} else if (p->fs_user_functions == fat_user_functions) {
fsname = "fat";
} else if (p->fs_user_functions == exfat_user_functions) {
fsname = "exfat";
} else if (p->fs_user_functions == ntfs_user_functions) {
fsname = "ntfs";
} else {
puts("???");
fsname = "???";
}
kmgt_count = d->media_info.sector_size * p->length;
bytes_to_kmgt(&kmgt_count, &kmgt);
printf("/%s/%d: fs=%s, start=%" PRIu64 ", length=%" PRIu64
" (%" PRIu64 " %s)\n", d->name, i+1, fsname, p->first_sector,
p->length, kmgt_count, kmgt);
}
}

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> ls70 /hd0/1/sf_empty
status = 6 end_of_file, count = 2
total = 2

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> # zero length
/> read70 /hd0/1/no_hole 0 0 -b
status = 0 success, count = 0

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> stat70 /hd0/1/
status = 0 success
attr: ----f

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> pwd
/
/> cd /hd0

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> # hole begin
/> # zero length
/> read70 /hd0/1/hole_begin 0 0 -b

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> stat70 /hd0/1/sf_empty
status = 0 success
attr: ----f

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=4096, capacity=77056 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=256, length=76800 (300 MiB)
/> ls70 /hd0/1/sf
status = 6 end_of_file, count = 5
total = 5

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> ls70 /hd0/1/sf_empty
status = 6 end_of_file, count = 2
total = 2

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> stat70 /hd0/1/sf_empty
status = 0 success
attr: ----f

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_unicode.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/>
/> stat80 /hd0/1/dir0
status = 0 success

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> ls70 /hd0/1/sf_empty
status = 6 end_of_file, count = 2
total = 2

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> stat70 /hd0/1/sf_empty
status = 0 success
attr: ----f

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> # hole begin
/> # zero length
/> read70 /hd0/1/hole_begin 0 0 -b

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> # zero length
/> read70 /hd0/1/no_hole 0 0 -b
status = 0 success, count = 0

View File

@ -2,7 +2,8 @@
/> set_mouse_pos_screen 40 30
/> #disk_add ../img/kolibri.img rd -c 0
/> ramdisk_init ../img/kolibri.img
/rd/1: fat
/rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1
/rd/1: fs=fat, start=0, length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/> window_redraw 1

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/>
/> read70 /hd0/1/4GiB_plus 0x3ff4 11 -b
status = 0 success, count = 11

View File

@ -1,7 +1,9 @@
/> umka_init
/> disk_add ../img/jfs.img hd0 -c 0
/hd0/1: ???
/hd0: sector_size=512, capacity=34816 (17 MiB), num_partitions=1
/hd0/1: fs=???, start=2048, length=32768 (16 MiB)
/> disk_del hd0
/> disk_add ../img/xfs_borg_bit.img hd0 -c 0
/hd0/1: ???
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=???, start=2048, length=614400 (300 MiB)
/> disk_del hd0

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_v4_btrees_l2.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/>
/> ls80 /hd0/1/dir_btree_l2 -f 0 -c 1
status = 0 success, count = 1

View File

@ -1,7 +1,8 @@
/> umka_set_boot_params --x_res 44 --y_res 44
/> umka_init
/> ramdisk_init ../img/kolibri.img
/rd/1: fat
/rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1
/rd/1: fs=fat, start=0, length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/fat32_test0.img hd0 -c 0
/hd0/1: fat
/hd0: sector_size=512, capacity=614400 (300 MiB), num_partitions=1
/hd0/1: fs=fat, start=0, length=614376 (307188 kiB)
/> ls80 /hd0/1/
status = 0 success, count = 100
total = 107

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/exfat_s05k_c16k_b16k.img hd0 -c 0
/hd0/1: exfat
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=exfat, start=2048, length=614400 (300 MiB)
/>
/> ls70 /hd0/1/dir_0 -f 0 -c 0
/> ls70 /hd0/1/dir_0 -f 0 -c 1

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/exfat_s05k_c8k_b8k.img hd0 -c 0
/hd0/1: exfat
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=exfat, start=2048, length=614400 (300 MiB)
/>
/> stat70 /hd0/1/dir_000
status = 0 success

View File

@ -1,7 +1,8 @@
/> umka_init
/> #set_mouse_pos_screen 40 30
/> ramdisk_init ../img/kolibri.img
/rd/1: fat
/rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1
/rd/1: fs=fat, start=0, length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>

View File

@ -1,7 +1,8 @@
/> umka_init
/>
/> ramdisk_init ../img/kolibri.img
/rd/1: fat
/rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1
/rd/1: fs=fat, start=0, length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_bigtime.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=616448 (301 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=614400 (300 MiB)
/> ls70 /hd0/1/
status = 6 end_of_file, count = 8
total = 8

View File

@ -1,6 +1,7 @@
/> umka_init
/> disk_add ../img/xfs_nrext64.img hd0 -c 0
/hd0/1: xfs
/hd0: sector_size=512, capacity=6146048 (3001 MiB), num_partitions=1
/hd0/1: fs=xfs, start=2048, length=6144000 (3000 MiB)
/> stat70 /hd0/1/dir_sf
status = 0 success
attr: ----f

55
test/059_#gpt_all.ref.log Normal file
View File

@ -0,0 +1,55 @@
/> umka_init
/> disk_add ../img/gpt_partitions_s05k.img hd0 -c 0
/hd0: sector_size=512, capacity=2097152 (1 GiB), num_partitions=24
/hd0/1: fs=???, start=2048, length=2048 (1 MiB)
/hd0/2: fs=???, start=4096, length=2048 (1 MiB)
/hd0/3: fs=???, start=8192, length=2048 (1 MiB)
/hd0/4: fs=???, start=6144, length=2048 (1 MiB)
/hd0/5: fs=???, start=10240, length=2048 (1 MiB)
/hd0/6: fs=???, start=12288, length=2048 (1 MiB)
/hd0/7: fs=???, start=14336, length=2048 (1 MiB)
/hd0/8: fs=???, start=16384, length=2048 (1 MiB)
/hd0/9: fs=???, start=18432, length=2048 (1 MiB)
/hd0/10: fs=???, start=20480, length=2048 (1 MiB)
/hd0/11: fs=???, start=22528, length=2048 (1 MiB)
/hd0/12: fs=???, start=24576, length=2048 (1 MiB)
/hd0/13: fs=???, start=26624, length=2048 (1 MiB)
/hd0/14: fs=???, start=28672, length=2048 (1 MiB)
/hd0/15: fs=???, start=30720, length=2048 (1 MiB)
/hd0/16: fs=???, start=32768, length=2048 (1 MiB)
/hd0/17: fs=???, start=34816, length=2048 (1 MiB)
/hd0/18: fs=???, start=36864, length=2048 (1 MiB)
/hd0/19: fs=???, start=38912, length=2048 (1 MiB)
/hd0/20: fs=???, start=40960, length=2048 (1 MiB)
/hd0/21: fs=???, start=43008, length=2048 (1 MiB)
/hd0/22: fs=???, start=45056, length=2048 (1 MiB)
/hd0/23: fs=???, start=47104, length=2048 (1 MiB)
/hd0/24: fs=???, start=49152, length=2048 (1 MiB)
/> disk_del hd0
/> disk_add ../img/gpt_partitions_s4k.img hd0 -c 0
/hd0: sector_size=4096, capacity=262144 (1 GiB), num_partitions=24
/hd0/1: fs=???, start=256, length=256 (1 MiB)
/hd0/2: fs=???, start=512, length=256 (1 MiB)
/hd0/3: fs=???, start=1024, length=256 (1 MiB)
/hd0/4: fs=???, start=768, length=256 (1 MiB)
/hd0/5: fs=???, start=1280, length=256 (1 MiB)
/hd0/6: fs=???, start=1536, length=256 (1 MiB)
/hd0/7: fs=???, start=1792, length=256 (1 MiB)
/hd0/8: fs=???, start=2048, length=256 (1 MiB)
/hd0/9: fs=???, start=2304, length=256 (1 MiB)
/hd0/10: fs=???, start=2560, length=256 (1 MiB)
/hd0/11: fs=???, start=2816, length=256 (1 MiB)
/hd0/12: fs=???, start=3072, length=256 (1 MiB)
/hd0/13: fs=???, start=3328, length=256 (1 MiB)
/hd0/14: fs=???, start=3584, length=256 (1 MiB)
/hd0/15: fs=???, start=3840, length=256 (1 MiB)
/hd0/16: fs=???, start=4096, length=256 (1 MiB)
/hd0/17: fs=???, start=4352, length=256 (1 MiB)
/hd0/18: fs=???, start=4608, length=256 (1 MiB)
/hd0/19: fs=???, start=4864, length=256 (1 MiB)
/hd0/20: fs=???, start=5120, length=256 (1 MiB)
/hd0/21: fs=???, start=5376, length=256 (1 MiB)
/hd0/22: fs=???, start=5632, length=256 (1 MiB)
/hd0/23: fs=???, start=5888, length=256 (1 MiB)
/hd0/24: fs=???, start=6144, length=256 (1 MiB)
/> disk_del hd0

5
test/059_#gpt_all.t Normal file
View File

@ -0,0 +1,5 @@
umka_init
disk_add ../img/gpt_partitions_s05k.img hd0 -c 0
disk_del hd0
disk_add ../img/gpt_partitions_s4k.img hd0 -c 0
disk_del hd0

View File

@ -29,9 +29,10 @@ net_tests := $(addsuffix .out.log, $(basename $(wildcard *\#net_*.t)))
arp_tests := $(addsuffix .out.log, $(basename $(wildcard *\#arp_*.t)))
acpi_tests := $(addsuffix .out.log, $(basename $(wildcard *\#acpi_*.t)))
input_tests := $(addsuffix .out.log, $(basename $(wildcard *\#input_*.t)))
gpt_tests := $(addsuffix .out.log, $(basename $(wildcard *\#gpt_*.t)))
all: xfs exfat s05k s4k f30 f70 f70s0 f70s1 f70s5 lookup bug xattr unicode v5 \
draw coverage i40 net arp acpi input
draw coverage i40 net arp acpi input gpt
@echo all tests passed
xfs: $(xfs_tests)
@ -55,6 +56,7 @@ net: $(net_tests)
arp: $(arp_tests)
acpi: $(acpi_tests)
input: $(input_tests)
gpt: $(gpt_tests)
%.out.log: %.t
$(UMKA_SHELL) -ri $*.t -o $@

2
umka.h
View File

@ -267,7 +267,7 @@ typedef struct {
uint32_t mtime;
uint32_t mdate;
uint64_t size;
char name[0x7777]; // how to handle this properly? FIXME
char name[0x777]; // how to handle this properly? FIXME
} bdfe_t;
typedef struct {