Skip to content

Commit

Permalink
[kernel,cmds] Small fixes to ps, mkfs and ramdisk driver
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Apr 5, 2024
1 parent 96ed606 commit b78722b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion elks/Makefile-rules
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ LHFLAGS = $(LCFLAGS) -exportfcn -declundef -fcnuse -fielduse \
ifneq ($(USEBCC), N)

################################
# Definitions using ia16-unknown-elks-gcc compiler
# Definitions using ia16-elf-gcc compiler

AS = ia16-elf-as
ASFLAGS = $(CPU_AS) $(ARCH_AS) --32-segelf
Expand Down
2 changes: 2 additions & 0 deletions elks/arch/i86/drivers/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static void INITPROC extended_partition(register struct gendisk *hd, kdev_t dev)
unmap_brelse(bh);
}

#ifdef CONFIG_MSDOS_PARTITION
static int INITPROC msdos_partition(struct gendisk *hd,
kdev_t dev, sector_t first_sector)
{
Expand Down Expand Up @@ -287,6 +288,7 @@ static int INITPROC msdos_partition(struct gendisk *hd,
unmap_brelse(bh);
return 1;
}
#endif

static void INITPROC check_partition(register struct gendisk *hd, kdev_t dev)
{
Expand Down
7 changes: 6 additions & 1 deletion elks/arch/i86/drivers/block/rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ static int rd_open(struct inode *inode, struct file *filp)
int target = DEVICE_NR(inode->i_rdev);

debug("RD: open /dev/rd%d\n", target);
if (!rd_initialised || target >= MAX_DRIVES || !drive_info[target].valid)
if (!rd_initialised || target >= MAX_DRIVES
#if CONFIG_RAMDISK_SEGMENT
|| !drive_info[target].valid
#endif
)
return -ENXIO;

++access_count[target];
Expand Down Expand Up @@ -286,6 +290,7 @@ void INITPROC rd_init(void)
if (register_blkdev(MAJOR_NR, DEVICE_NAME, &rd_fops) == 0) {
blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
rd_initialised = 1;

#if CONFIG_RAMDISK_SEGMENT
printk("rd: %dK ramdisk at %x:0000\n",
drive_info[0].size >> 1, rd_segment[0].seg);
Expand Down
2 changes: 2 additions & 0 deletions elks/include/linuxmt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Compile-time configuration
*/

#define CONFIG_MSDOS_PARTITION 1 /* support DOS HD partitions */

#ifdef CONFIG_ARCH_IBMPC
#define MAX_SERIAL 4 /* max number of serial tty devices*/

Expand Down
2 changes: 0 additions & 2 deletions elks/include/linuxmt/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* <[email protected]>
*/

#define CONFIG_MSDOS_PARTITION 1

/* These two have identical behaviour; use the second one if DOS fdisk gets
confused about extended/logical partitions starting past cylinder 1023. */

Expand Down
11 changes: 7 additions & 4 deletions elkscmd/disk_utils/mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <string.h>
#include <signal.h>
#include <fcntl.h>
/*#include <ctype.h>*/
#include <stdlib.h>
#include <termios.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -301,9 +300,13 @@ int main(int argc, char ** argv)
die("unable to open device");
if (fstat(DEV,&statbuf)<0)
die("unable to stat %s");
//else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
//die("Will not try to make filesystem on '%s'");

/***if (statbuf.st_rdev == DEV_FD0 || statbuf.st_rdev == DEV_HDA)
die("Will not try to make filesystem on '%s'");***/
if ((BLOCKS << 10) > statbuf.st_size) {
printf("Requested block count %luK exceeds device size %luK\n",
BLOCKS, statbuf.st_size >> 10);
exit(8);
}
setup_tables();
make_root_inode();
write_tables();
Expand Down
3 changes: 2 additions & 1 deletion elkscmd/sys_utils/ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <pwd.h>
#include <getopt.h>
#include <paths.h>
#include <libgen.h>

#define LINEARADDRESS(off, seg) ((off_t) (((off_t)seg << 4) + off))

Expand Down Expand Up @@ -125,7 +126,7 @@ int main(int argc, char **argv)
struct passwd * pwent;
int f_listall = 0;
char *progname = argv[0];
int f_uptime = !strcmp(progname, "uptime");
int f_uptime = !strcmp(basename(progname), "uptime");
struct task_struct task_table;

while ((c = getopt(argc, argv, "lu")) != -1) {
Expand Down
14 changes: 11 additions & 3 deletions image/Make.devices
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Make.devices - make character and block special devies on MINIX image
# Make.devices - make character and block special devices on MINIX image
#
# Devices MAJOR are defined in /include/linuxmt/major.h

Expand Down Expand Up @@ -61,8 +61,16 @@ devices:

##############################################################################
# Direct floppy devices.
$(MKDEV) /dev/df0 b 4 0
$(MKDEV) /dev/df1 b 4 1
$(MKDEV) /dev/df0 b 4 0
$(MKDEV) /dev/df1 b 4 1
# $(MKDEV) /dev/df0-360 b 4 2
# $(MKDEV) /dev/df0-1200 b 4 4
# $(MKDEV) /dev/df0-360at3 b 4 6
# $(MKDEV) /dev/df0-720 b 4 8
# $(MKDEV) /dev/df0-360at5 b 4 10
# $(MKDEV) /dev/df0-720at5 b 4 12
# $(MKDEV) /dev/df0-1440 b 4 14
# $(MKDEV) /dev/df0-2880 b 4 16

##############################################################################
# Pseudo-TTY master devices.
Expand Down

0 comments on commit b78722b

Please sign in to comment.