Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 2003 11:55:21 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 36694 for review
Message-ID:  <200308221855.h7MItLFS031870@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=36694

Change 36694 by rwatson@rwatson_tislabs on 2003/08/22 11:54:34

	Integrate multilabel newfs and sysinstall support from the MAC
	branch into the SEBSD branch.  These changes are under-tested.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/sbin/newfs/mkfs.c#4 integrate
.. //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.8#4 integrate
.. //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.c#4 integrate
.. //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.h#4 integrate
.. //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/install.c#4 integrate
.. //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/label.c#5 integrate
.. //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/sysinstall.h#4 integrate

Differences ...

==== //depot/projects/trustedbsd/sebsd/sbin/newfs/mkfs.c#4 (text+ko) ====

@@ -138,6 +138,8 @@
 		sblock.fs_flags |= FS_DOSOFTDEP;
 	if (Lflag)
 		strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
+	if (lflag)
+		sblock.fs_flags |= FS_MULTILABEL;
 	/*
 	 * Validate the given file system size.
 	 * Verify that its last block can actually be accessed.

==== //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.8#4 (text+ko) ====

@@ -40,7 +40,7 @@
 .Nd construct a new UFS1/UFS2 file system
 .Sh SYNOPSIS
 .Nm
-.Op Fl NU
+.Op Fl NUl
 .Op Fl L Ar volname
 .Op Fl O Ar filesystem-type
 .Op Fl S Ar sector-size
@@ -149,6 +149,8 @@
 to create more inodes a smaller number should be given.
 One inode is required for each distinct file, so this value effectively
 specifies the average file size on the file system.
+.It Fl l
+Enables multilabel MAC on the new file system.
 .It Fl m Ar free-space
 The percentage of space reserved from normal users; the minimum free
 space threshold.

==== //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.c#4 (text+ko) ====

@@ -119,6 +119,7 @@
 int	Oflag = 2;		/* file system format (1 => UFS1, 2 => UFS2) */
 int	Rflag;			/* regression test */
 int	Uflag;			/* enable soft updates for file system */
+int	lflag;			/* enable multilabel for file system */
 quad_t	fssize;			/* file system size */
 int	sectorsize;		/* bytes/sector */
 int	realsectorsize;		/* bytes/sector in hardware */
@@ -156,7 +157,7 @@
 	off_t mediasize;
 
 	while ((ch = getopt(argc, argv,
-	    "L:NO:RS:T:Ua:b:c:d:e:f:g:h:i:m:o:s:")) != -1)
+	    "L:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:o:s:")) != -1)
 		switch (ch) {
 		case 'L':
 			volumelabel = optarg;
@@ -235,6 +236,9 @@
 			if ((density = atoi(optarg)) <= 0)
 				errx(1, "%s: bad bytes per inode", optarg);
 			break;
+		case 'l':
+			lflag = 1;
+			break;
 		case 'm':
 			if ((minfree = atoi(optarg)) < 0 || minfree > 99)
 				errx(1, "%s: bad free space %%", optarg);

==== //depot/projects/trustedbsd/sebsd/sbin/newfs/newfs.h#4 (text+ko) ====

@@ -52,6 +52,7 @@
 extern int	Oflag;		/* build UFS1 format file system */
 extern int	Rflag;		/* regression test */
 extern int	Uflag;		/* enable soft updates for file system */
+extern int	lflag;		/* enable multilabel MAC for file system */
 extern quad_t	fssize;		/* file system size */
 extern int	sectorsize;	/* bytes/sector */
 extern int	realsectorsize;	/* bytes/sector in hardware*/

==== //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/install.c#4 (text+ko) ====

@@ -885,10 +885,11 @@
 	if (pi->do_newfs) {
 		switch(pi->newfs_type) {
 		case NEWFS_UFS:
-			snprintf(buffer, LINE_MAX, "%s %s %s %s %s",
+			snprintf(buffer, LINE_MAX, "%s %s %s %s %s %s",
 			    NEWFS_UFS_CMD,
 			    pi->newfs_data.newfs_ufs.softupdates ?  "-U" : "",
 			    pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
+			    pi->newfs_data.newfs_ufs.multilabel ? "-l" : "",
 			    pi->newfs_data.newfs_ufs.user_options,
 			    dname);
 			break;

==== //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/label.c#5 (text+ko) ====

@@ -463,9 +463,10 @@
 
     switch (p->newfs_type) {
     case NEWFS_UFS:
-	snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s",
+	snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s %s",
 	    NEWFS_UFS_CMD, p->newfs_data.newfs_ufs.softupdates ?  "-U" : "",
 	    p->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
+	    p->newfs_data.newfs_ufs.multilabel ? "-l" : "",
 	    p->newfs_data.newfs_ufs.user_options);
 	break;
     case NEWFS_MSDOS:
@@ -519,7 +520,8 @@
 static void
 print_label_chunks(void)
 {
-    int  i, j, spaces, srow, prow, pcol;
+    int  j, spaces, srow, prow, pcol;
+    int  needspaces = 0, i;
     int  sz;
     char clrmsg[80];
     int ChunkPartStartRow;
@@ -689,15 +691,22 @@
 
 		switch (pi->newfs_type) {
 		case NEWFS_UFS:
+
 			strcpy(newfs, NEWFS_UFS_STRING);
 			if (pi->newfs_data.newfs_ufs.ufs1)
 				strcat(newfs, "1");
 			else
 				strcat(newfs, "2");
 			if (pi->newfs_data.newfs_ufs.softupdates)
-				strcat(newfs, "+S");
+				strcat(newfs, "S");
+			else
+				needspaces++;
+			if (pi->newfs_data.newfs_ufs.multilabel)
+				strcat(newfs, "L");
 			else
-				strcat(newfs, "  ");
+				needspaces++;
+			for (j = 0; j < needspaces; i++)
+				strcat(newfs, " ");
 
 			break;
 		case NEWFS_MSDOS:
@@ -1078,6 +1087,19 @@
 	    record_label_chunks(devs, dev);
 	    break;
 
+	case 'L':	/* toggle multilabel */
+	    if (label_chunk_info[here].type == PART_FILESYSTEM) {
+		PartInfo *pi =
+		    ((PartInfo *)label_chunk_info[here].c->private_data);
+
+		if ((pi != NULL) &&
+		    (pi->newfs_type == NEWFS_UFS)) {
+			pi->newfs_data.newfs_ufs.multilabel =
+			    !pi->newfs_data.newfs_ufs.multilabel;
+		} else msg = MSG_NOT_APPLICABLE;
+	    } else msg = MSG_NOT_APPLICABLE;
+	    break;
+
 	case 'M':	/* mount */
 	    switch(label_chunk_info[here].type) {
 	    case PART_SLICE:

==== //depot/projects/trustedbsd/sebsd/usr.sbin/sysinstall/sysinstall.h#4 (text+ko) ====



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308221855.h7MItLFS031870>