diff -urN linux-2.0.36/Documentation/Configure.help linux/Documentation/Configure.help --- linux-2.0.36/Documentation/Configure.help Sat Dec 26 04:34:17 1998 +++ linux/Documentation/Configure.help Sat Dec 26 04:36:18 1998 @@ -3800,6 +3800,24 @@ your Linux box if you also have configured BSD ufs filesystem support. If you don't know what all this is about, say N. +Unixware slices support (EXPERIMENTAL) +CONFIG_UNIXWARE_DISKLABEL + Like some systems, Unixware uses, except DOS-like partition table, + its own slice table inside a partition (VTOC - Virtual Table of + Contents). Its format is incompatible with all other OSes. Saying Y + here allows you to read VTOC and further mount Unixware partitions + read-only from within Linux if you have also said Y to "UFS + filesystem support" or "System V and Coherent filesystem support", + above. + + This is mainly used to carry data from a Unixware box to your + Linux box via a removable medium like magneto-optical, ZIP or + removable IDE drives. Note, however, that a good portable way to + transport files and directories between unixes (and even other + operating systems) is given by the tar program ("man tar" or + preferably "info tar"). If you don't know what all this is about, + say N. + SMD disklabel (Sun partition tables) support CONFIG_SMD_DISKLABEL Like most systems, SunOS uses its own partition table format, diff -urN linux-2.0.36/drivers/block/genhd.c linux/drivers/block/genhd.c --- linux-2.0.36/drivers/block/genhd.c Thu Jun 4 00:17:47 1998 +++ linux/drivers/block/genhd.c Sat Dec 26 04:55:04 1998 @@ -242,6 +242,45 @@ } #endif +#ifdef CONFIG_UNIXWARE_DISKLABEL +/* + * Create devices for Unixware partitions listed in a disklabel, under a + * dos-like partition. See extended_partition() for more information. + */ +static void unixware_partition(struct gendisk *hd, kdev_t dev) +{ + struct buffer_head *bh; + struct unixware_disklabel *l; + struct unixware_slice *p; + int mask = (1 << hd->minor_shift) - 1; + + if (!(bh = bread(dev, 14, 1024))) + return; + bh->b_state = 0; + l = (struct unixware_disklabel *) (bh->b_data+512); + if (l->d_magic != UNIXWARE_DISKMAGIC || + l->vtoc.v_magic != UNIXWARE_DISKMAGIC2) { + brelse(bh); + return; + } + printk(" vtoc.v_slice[1]; + /* I omit the 0th slice as it is the same as whole disk. */ + while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) { + if ((current_minor & mask) == 0) + break; + + if (p->s_label != UNIXWARE_FS_UNUSED) { + add_partition(hd, current_minor, START_SECT(p), NR_SECTS(p)); + current_minor++; + } + p++; + } + brelse(bh); + printk(" >"); +} +#endif + static int msdos_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector) { int i, minor = current_minor; @@ -371,6 +410,10 @@ bsd_disklabel_partition(hd, MKDEV(hd->major, minor)); printk(" >"); } +#endif +#ifdef CONFIG_UNIXWARE_DISKLABEL + if (SYS_IND(p) == UNIXWARE_PARTITION) + unixware_partition(hd, MKDEV(hd->major, minor)); #endif } /* diff -urN linux-2.0.36/fs/Config.in linux/fs/Config.in --- linux-2.0.36/fs/Config.in Mon Jul 13 22:47:34 1998 +++ linux/fs/Config.in Sat Dec 26 04:42:25 1998 @@ -81,4 +81,7 @@ bool 'BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL bool 'SMD disklabel (Sun partition tables) support' CONFIG_SMD_DISKLABEL fi +if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool 'Unixware slices support (EXPERIMENTAL)' CONFIG_UNIXWARE_DISKLABEL +fi endmenu diff -urN linux-2.0.36/include/linux/genhd.h linux/include/linux/genhd.h --- linux-2.0.36/include/linux/genhd.h Sat Dec 26 04:34:20 1998 +++ linux/include/linux/genhd.h Sat Dec 26 04:56:01 1998 @@ -123,6 +123,63 @@ #endif /* CONFIG_BSD_DISKLABEL */ +#ifdef CONFIG_UNIXWARE_DISKLABEL +/* + * Unixware slices support by Andrzej Krzysztofowicz + * and Krzysztof G. Baranowski + */ + +#define UNIXWARE_PARTITION 0x63 /* Partition ID, same as */ + /* GNU_HURD and SCO Unix */ +#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */ +#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */ +#define UNIXWARE_NUMSLICE 16 +#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ + +struct unixware_slice { + __u16 s_label; /* label */ + __u16 s_flags; /* permission flags */ + __u32 start_sect; /* starting sector */ + __u32 nr_sects; /* number of sectors in slice */ +}; + +struct unixware_disklabel { + __u32 d_type; /* drive type */ + __u32 d_magic; /* the magic number */ + __u32 d_version; /* version number */ + char d_serial[12]; /* serial number of the device */ + __u32 d_ncylinders; /* # of data cylinders per device */ + __u32 d_ntracks; /* # of tracks per cylinder */ + __u32 d_nsectors; /* # of data sectors per track */ + __u32 d_secsize; /* # of bytes per sector */ + __u32 d_part_start; /* # of first sector of this partition */ + __u32 d_unknown1[12]; /* ? */ + __u32 d_alt_tbl; /* byte offset of alternate table */ + __u32 d_alt_len; /* byte length of alternate table */ + __u32 d_phys_cyl; /* # of physical cylinders per device */ + __u32 d_phys_trk; /* # of physical tracks per cylinder */ + __u32 d_phys_sec; /* # of physical sectors per track */ + __u32 d_phys_bytes; /* # of physical bytes per sector */ + __u32 d_unknown2; /* ? */ + __u32 d_unknown3; /* ? */ + __u32 d_pad[8]; /* pad */ + + struct unixware_vtoc { + __u32 v_magic; /* the magic number */ + __u32 v_version; /* version number */ + char v_name[8]; /* volume name */ + __u16 v_nslices; /* # of slices */ + __u16 v_unknown1; /* ? */ + __u32 v_reserved[10]; /* reserved */ + struct unixware_slice + v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ + } vtoc; + +}; /* 408 */ + +#endif /* CONFIG_UNIXWARE_DISKLABEL */ + + extern struct gendisk *gendisk_head; /* linked list of disks */ /*