mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-03 09:00:21 +00:00
Retire the bogus uses of the disklabel field d_sbsize and begin to
initialize it to zero so we don't have to have everbody and their aunt including FFS specific header files. Sponsored by: DARPA & NAI Labs.
This commit is contained in:
parent
201efb1913
commit
77068a7fe2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96475
@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#define DKTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
@ -118,7 +116,7 @@ getdiskbyname(const char *name)
|
||||
getnumdflt(dp->d_headswitch, "hs", 0);
|
||||
getnumdflt(dp->d_trkseek, "ts", 0);
|
||||
getnumdflt(dp->d_bbsize, "bs", BBSIZE);
|
||||
getnumdflt(dp->d_sbsize, "sb", SBSIZE);
|
||||
getnumdflt(dp->d_sbsize, "sb", 0);
|
||||
strcpy(psize, "px");
|
||||
strcpy(pbsize, "bx");
|
||||
strcpy(pfsize, "fx");
|
||||
|
@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define DOSPTYP_EXTENDED 5
|
||||
#define BBSIZE 8192
|
||||
#define SBSIZE 8192
|
||||
#define SBSIZE 0
|
||||
#define DEF_RPM 3600
|
||||
#define DEF_INTERLEAVE 1
|
||||
|
||||
|
@ -64,7 +64,6 @@ static const char rcsid[] =
|
||||
#ifdef __sparc64__
|
||||
#include <sys/sun_disklabel.h>
|
||||
#endif
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -937,7 +936,7 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
||||
int i;
|
||||
|
||||
lp->d_bbsize = BBSIZE; /* XXX */
|
||||
lp->d_sbsize = SBSIZE; /* XXX */
|
||||
lp->d_sbsize = 0; /* XXX */
|
||||
while (fgets(line, sizeof(line) - 1, f)) {
|
||||
lineno++;
|
||||
if ((cp = index(line,'\n')) != 0)
|
||||
@ -1332,11 +1331,6 @@ checklabel(struct disklabel *lp)
|
||||
errors++;
|
||||
} else if (lp->d_bbsize % lp->d_secsize)
|
||||
Warning("boot block size %% sector-size != 0");
|
||||
if (lp->d_sbsize == 0) {
|
||||
fprintf(stderr, "super block size 0\n");
|
||||
errors++;
|
||||
} else if (lp->d_sbsize % lp->d_secsize)
|
||||
Warning("super block size %% sector-size != 0");
|
||||
if (lp->d_npartitions > MAXPARTITIONS)
|
||||
Warning("number of partitions (%lu) > MAXPARTITIONS (%d)",
|
||||
(u_long)lp->d_npartitions, MAXPARTITIONS);
|
||||
|
@ -64,7 +64,6 @@ static const char rcsid[] =
|
||||
#ifdef __sparc64__
|
||||
#include <sys/sun_disklabel.h>
|
||||
#endif
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -937,7 +936,7 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
||||
int i;
|
||||
|
||||
lp->d_bbsize = BBSIZE; /* XXX */
|
||||
lp->d_sbsize = SBSIZE; /* XXX */
|
||||
lp->d_sbsize = 0; /* XXX */
|
||||
while (fgets(line, sizeof(line) - 1, f)) {
|
||||
lineno++;
|
||||
if ((cp = index(line,'\n')) != 0)
|
||||
@ -1332,11 +1331,6 @@ checklabel(struct disklabel *lp)
|
||||
errors++;
|
||||
} else if (lp->d_bbsize % lp->d_secsize)
|
||||
Warning("boot block size %% sector-size != 0");
|
||||
if (lp->d_sbsize == 0) {
|
||||
fprintf(stderr, "super block size 0\n");
|
||||
errors++;
|
||||
} else if (lp->d_sbsize % lp->d_secsize)
|
||||
Warning("super block size %% sector-size != 0");
|
||||
if (lp->d_npartitions > MAXPARTITIONS)
|
||||
Warning("number of partitions (%lu) > MAXPARTITIONS (%d)",
|
||||
(u_long)lp->d_npartitions, MAXPARTITIONS);
|
||||
|
@ -43,6 +43,7 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ufs/dir.h>
|
||||
|
@ -506,9 +506,6 @@ calcsb(char *dev, int devfd, struct fs *fs)
|
||||
fs->fs_nsect = lp->d_nsectors;
|
||||
fs->fs_spc = lp->d_secpercyl;
|
||||
fs->fs_nspf = fs->fs_fsize / lp->d_secsize;
|
||||
fs->fs_sblkno = roundup(
|
||||
howmany(lp->d_bbsize + lp->d_sbsize, fs->fs_fsize),
|
||||
fs->fs_frag);
|
||||
fs->fs_cgmask = 0xffffffff;
|
||||
for (i = fs->fs_ntrak; i > 1; i >>= 1)
|
||||
fs->fs_cgmask <<= 1;
|
||||
|
@ -42,6 +42,7 @@ static const char rcsid[] =
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ufs/dir.h>
|
||||
|
@ -481,9 +481,6 @@ calcsb(char *dev, int devfd, struct fs *fs)
|
||||
fs->fs_nsect = lp->d_nsectors;
|
||||
fs->fs_spc = lp->d_secpercyl;
|
||||
fs->fs_nspf = fs->fs_fsize / lp->d_secsize;
|
||||
fs->fs_sblkno = roundup(
|
||||
howmany(lp->d_bbsize + lp->d_sbsize, fs->fs_fsize),
|
||||
fs->fs_frag);
|
||||
fs->fs_cgmask = 0xffffffff;
|
||||
for (i = fs->fs_ntrak; i > 1; i >>= 1)
|
||||
fs->fs_cgmask <<= 1;
|
||||
|
@ -99,7 +99,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/disk.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/vnode.h>
|
||||
@ -1662,7 +1661,7 @@ ccdgetdisklabel(dev_t dev)
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
lp->d_bbsize = BBSIZE; /* XXX */
|
||||
lp->d_sbsize = SBSIZE; /* XXX */
|
||||
lp->d_sbsize = 0;
|
||||
|
||||
lp->d_magic = DISKMAGIC;
|
||||
lp->d_magic2 = DISKMAGIC;
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/queue.h>
|
||||
|
@ -752,7 +752,7 @@ get_volume_label(char *name, int plexes, u_int64_t size, struct disklabel *lp)
|
||||
lp->d_secperunit = size; /* data sectors per unit */
|
||||
|
||||
lp->d_bbsize = BBSIZE;
|
||||
lp->d_sbsize = SBSIZE;
|
||||
lp->d_sbsize = 0;
|
||||
|
||||
lp->d_magic = DISKMAGIC;
|
||||
lp->d_magic2 = DISKMAGIC;
|
||||
|
@ -99,7 +99,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/disk.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/vnode.h>
|
||||
@ -1662,7 +1661,7 @@ ccdgetdisklabel(dev_t dev)
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
lp->d_bbsize = BBSIZE; /* XXX */
|
||||
lp->d_sbsize = SBSIZE; /* XXX */
|
||||
lp->d_sbsize = 0;
|
||||
|
||||
lp->d_magic = DISKMAGIC;
|
||||
lp->d_magic2 = DISKMAGIC;
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <ufs/ffs/fs.h>
|
||||
|
||||
#define TRACE(str) do { if (ds_debug) printf str; } while (0)
|
||||
|
||||
typedef u_char bool_t;
|
||||
@ -113,8 +111,6 @@ clone_label(lp)
|
||||
lp1->d_npartitions = MAXPARTITIONS;
|
||||
if (lp1->d_bbsize == 0)
|
||||
lp1->d_bbsize = BBSIZE;
|
||||
if (lp1->d_sbsize == 0)
|
||||
lp1->d_sbsize = SBSIZE;
|
||||
lp1->d_partitions[RAW_PART].p_size = lp1->d_secperunit;
|
||||
lp1->d_magic = DISKMAGIC;
|
||||
lp1->d_magic2 = DISKMAGIC;
|
||||
@ -394,7 +390,7 @@ dsioctl(dev, cmd, data, flags, sspp)
|
||||
lp->d_ntracks = 64;
|
||||
|
||||
lp->d_bbsize = BBSIZE;
|
||||
lp->d_sbsize = SBSIZE;
|
||||
lp->d_sbsize = 0;
|
||||
lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
|
||||
lp->d_ncylinders = sp->ds_size / lp->d_secpercyl;
|
||||
lp->d_secperunit = sp->ds_size;
|
||||
|
Loading…
Reference in New Issue
Block a user