diff -r -c3 linux-1.1.83/arch/i386/config.in linux/arch/i386/config.in
*** linux-1.1.83/arch/i386/config.in	Thu Jan 19 19:17:42 1995
--- linux/arch/i386/config.in	Thu Jan 19 17:55:05 1995
***************
*** 210,215 ****
--- 210,216 ----
  fi
  bool 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS n
  bool 'System V and Coherent filesystem support' CONFIG_SYSV_FS n
+ bool 'BSD ufs filesystem support' CONFIG_UFS_FS n
  
  comment 'character devices'
  
diff -r -c3 linux-1.1.83/drivers/block/genhd.c linux/drivers/block/genhd.c
*** linux-1.1.83/drivers/block/genhd.c	Thu Jan  5 12:55:40 1995
--- linux/drivers/block/genhd.c	Mon Jan  9 03:04:26 1995
***************
*** 100,105 ****
--- 100,148 ----
  	brelse(bh);
  }
  
+ #ifdef CONFIG_UFS_FS		/* not needed when no UFS... */
+ /* 
+  * Create devices for BSD partitions listed in a disklabel, under a
+  * dos-like partition. See extended_partition() for more information.
+  */
+ static void disklabel_partition(struct gendisk *hd, int dev)
+ {
+ 	struct buffer_head *bh;
+ 	struct bsd_disklabel *l;
+ 	struct bsd_partition *p;
+ 	int mask = (1 << hd->minor_shift) - 1;
+ 
+ 	if (!(bh = bread(dev,0,1024)))
+ 		return;
+ 	bh->b_dirt = 0;
+ 	bh->b_uptodate = 0;
+ 	bh->b_req = 0;
+ 	l = (struct bsd_disklabel *) (bh->b_data+512);
+ 	if (l->d_magic != BSD_DISKMAGIC) {
+ 		brelse(bh);
+ 		return;
+ 	}
+ 		
+ 	p = &l->d_partitions[0];
+ 	while (p - &l->d_partitions[0] <= BSD_MAXPARTITIONS) {
+ 		if ((current_minor & mask) >= (4 + hd->max_p))
+ 			break;
+ 
+ 		if (p->p_fstype != BSD_FS_UNUSED) {
+ 			hd->part[current_minor].start_sect = p->p_offset;
+ 			hd->part[current_minor].nr_sects = p->p_size;
+ 			printk(" %s%c%d", hd->major_name,
+ 				'a'+(current_minor >> hd->minor_shift),
+ 				mask & current_minor);
+ 			current_minor++;
+ 		}
+ 		p++;
+ 	}
+ 	brelse(bh);
+ 	
+ }
+ #endif
+ 
  static void check_partition(struct gendisk *hd, unsigned int dev)
  {
  	static int first_time = 1;
***************
*** 142,147 ****
--- 185,197 ----
  				extended_partition(hd, (hd->major << 8) | minor);
  				printk(" >");
  			}
+ #ifdef CONFIG_UFS_FS
+ 			if (p->sys_ind == BSD_PARTITION) {
+ 				printk(" <");
+ 				disklabel_partition(hd, (hd->major << 8) | minor);
+ 				printk(" >");
+ 			}
+ #endif
  		}
  		/*
  		 * check for Disk Manager partition table
diff -r -c3 linux-1.1.83/fs/Makefile linux/fs/Makefile
*** linux-1.1.83/fs/Makefile	Mon Jan  9 08:22:18 1995
--- linux/fs/Makefile	Sat Jan 14 03:40:18 1995
***************
*** 7,13 ****
  #
  # Note 2! The CFLAGS definitions are now in the main makefile...
  
! SUBDIRS = minix ext ext2 msdos proc isofs nfs xiafs umsdos hpfs sysv
  
  ifdef CONFIG_MINIX_FS
  FS_SUBDIRS := $(FS_SUBDIRS) minix
--- 7,13 ----
  #
  # Note 2! The CFLAGS definitions are now in the main makefile...
  
! SUBDIRS = minix ext ext2 msdos proc isofs nfs xiafs umsdos hpfs sysv ufs
  
  ifdef CONFIG_MINIX_FS
  FS_SUBDIRS := $(FS_SUBDIRS) minix
***************
*** 65,70 ****
--- 65,76 ----
  
  ifdef CONFIG_HPFS_FS
  FS_SUBDIRS := $(FS_SUBDIRS) hpfs
+ endif
+ 
+ ifdef CONFIG_UFS_FS
+ FS_SUBDIRS := $(FS_SUBDIRS) ufs
+ else
+ MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) ufs
  endif
  
  ifdef CONFIG_BINFMT_ELF
diff -r -c3 linux-1.1.83/fs/filesystems.c linux/fs/filesystems.c
*** linux-1.1.83/fs/filesystems.c	Sun Jul 24 16:39:44 1994
--- linux/fs/filesystems.c	Fri Dec  2 01:45:26 1994
***************
*** 20,25 ****
--- 20,26 ----
  #include <linux/iso_fs.h>
  #include <linux/sysv_fs.h>
  #include <linux/hpfs_fs.h>
+ #include <linux/ufs_fs.h>
  
  extern void device_setup(void);
  
***************
*** 92,97 ****
--- 93,102 ----
  #ifdef CONFIG_HPFS_FS
  	register_filesystem(&(struct file_system_type)
  		{hpfs_read_super, "hpfs", 1, NULL});
+ #endif
+ #ifdef CONFIG_UFS_FS
+ 	register_filesystem(&(struct file_system_type)
+ 		{ufs_read_super, "ufs", 1, NULL});
  #endif
  
  	mount_root();
diff -r -c3 linux-1.1.83/include/linux/fs.h linux/include/linux/fs.h
*** linux-1.1.83/include/linux/fs.h	Fri Jan 13 12:35:12 1995
--- linux/include/linux/fs.h	Sun Jan 15 19:15:33 1995
***************
*** 163,168 ****
--- 163,169 ----
  #include <linux/nfs_fs_i.h>
  #include <linux/xia_fs_i.h>
  #include <linux/sysv_fs_i.h>
+ #include <linux/ufs_fs_i.h>
  
  #ifdef __KERNEL__
  
***************
*** 246,251 ****
--- 247,253 ----
  		struct nfs_inode_info nfs_i;
  		struct xiafs_inode_info xiafs_i;
  		struct sysv_inode_info sysv_i;
+ 		struct ufs_inode_info ufs_i;
  		struct socket socket_i;
  		void * generic_ip;
  	} u;
***************
*** 294,299 ****
--- 298,304 ----
  #include <linux/nfs_fs_sb.h>
  #include <linux/xia_fs_sb.h>
  #include <linux/sysv_fs_sb.h>
+ #include <linux/ufs_fs_sb.h>
  
  struct super_block {
  	dev_t s_dev;
***************
*** 320,325 ****
--- 325,331 ----
  		struct nfs_sb_info nfs_sb;
  		struct xiafs_sb_info xiafs_sb;
  		struct sysv_sb_info sysv_sb;
+ 		struct ufs_sb_info ufs_sb;
  		void *generic_sbp;
  	} u;
  };
diff -r -c3 linux-1.1.83/include/linux/genhd.h linux/include/linux/genhd.h
*** linux-1.1.83/include/linux/genhd.h	Wed Dec  1 13:44:15 1993
--- linux/include/linux/genhd.h	Fri Dec  2 00:22:43 1994
***************
*** 7,12 ****
--- 7,14 ----
   * 		Drew Eckhardt
   *
   *		<drew@colorado.edu>
+  *
+  *	BSD Disklabel support by Yossi Gottlieb (yogo@math.tau.ac.il)
   */
  	
  #define EXTENDED_PARTITION 5
***************
*** 43,50 ****
  	int nr_real;			/* number of real devices */
  
  	void *real_devices;		/* internal use */
  	struct gendisk *next;
  };
  
  extern int NR_GENDISKS;			/* total */
  extern struct gendisk *gendisk_head;	/* linked list of disks */
--- 45,105 ----
  	int nr_real;			/* number of real devices */
  
  	void *real_devices;		/* internal use */
  	struct gendisk *next;
  };
+ 
+ /* BSD disklabel
+  */
+ #ifdef CONFIG_UFS_FS
+ 
+ #define BSD_DISKMAGIC	(0x82564557UL)	/* The disk magic number */
+ #define BSD_MAXPARTITIONS	8
+ #define BSD_PARTITION		0xa5	/* Partition ID */
+ #define BSD_FS_UNUSED		0	/* disklabel unused partition entry ID */
+ struct bsd_disklabel {
+ 	u_long	d_magic;		/* the magic number */
+ 	short	d_type;			/* drive type */
+ 	short	d_subtype;		/* controller/d_type specific */
+ 	char	d_typename[16];		/* type name, e.g. "eagle" */
+ 	char	d_packname[16];			/* pack identifier */ 
+ 	u_long	d_secsize;		/* # of bytes per sector */
+ 	u_long	d_nsectors;		/* # of data sectors per track */
+ 	u_long	d_ntracks;		/* # of tracks per cylinder */
+ 	u_long	d_ncylinders;		/* # of data cylinders per unit */
+ 	u_long	d_secpercyl;		/* # of data sectors per cylinder */
+ 	u_long	d_secperunit;		/* # of data sectors per unit */
+ 	u_short	d_sparespertrack;	/* # of spare sectors per track */
+ 	u_short	d_sparespercyl;		/* # of spare sectors per cylinder */
+ 	u_long	d_acylinders;		/* # of alt. cylinders per unit */
+ 	u_short	d_rpm;			/* rotational speed */
+ 	u_short	d_interleave;		/* hardware sector interleave */
+ 	u_short	d_trackskew;		/* sector 0 skew, per track */
+ 	u_short	d_cylskew;		/* sector 0 skew, per cylinder */
+ 	u_long	d_headswitch;		/* head switch time, usec */
+ 	u_long	d_trkseek;		/* track-to-track seek, usec */
+ 	u_long	d_flags;		/* generic flags */
+ #define NDDATA 5
+ 	u_long	d_drivedata[NDDATA];	/* drive-type specific information */
+ #define NSPARE 5
+ 	u_long	d_spare[NSPARE];	/* reserved for future use */
+ 	u_long	d_magic2;		/* the magic number (again) */
+ 	u_short	d_checksum;		/* xor of data incl. partitions */
+ 
+ 			/* filesystem and partition information: */
+ 	u_short	d_npartitions;		/* number of partitions in following */
+ 	u_long	d_bbsize;		/* size of boot area at sn0, bytes */
+ 	u_long	d_sbsize;		/* max size of fs superblock, bytes */
+ 	struct	bsd_partition {		/* the partition table */
+ 		u_long	p_size;		/* number of sectors in partition */
+ 		u_long	p_offset;	/* starting sector */
+ 		u_long	p_fsize;	/* filesystem basic fragment size */
+ 		u_char	p_fstype;	/* filesystem type, see below */
+ 		u_char	p_frag;		/* filesystem fragments per block */
+ 		u_short	p_cpg;		/* filesystem cylinders per group */
+ 	} d_partitions[BSD_MAXPARTITIONS];	/* actually may be more */
+ };
+ 
+ #endif	/* CONFIG_UFS_FS */
  
  extern int NR_GENDISKS;			/* total */
  extern struct gendisk *gendisk_head;	/* linked list of disks */
