~ubuntu-branches/debian/jessie/ufsutils/jessie

« back to all changes in this revision

Viewing changes to debian/patches/02_mkfs.ufs.patch

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover, Robert Millan, Guillem Jover, Peter Pentchev
  • Date: 2011-05-31 03:50:05 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110531035005-wyiyk25p99ivd0k0
Tags: 8.2-1
[ Robert Millan ]
* Set ufsutils-udeb to kfreebsd-any.

[ Guillem Jover ]
* New upstream version (based on FreeBSD 8.2)
* Now using Standards-Version 3.9.2 (no changes needed).
* Switch to source format “3.0 (quilt)”.
  - Remove quilt from Build-Depends.
  - Remove patch target in debian/rules.
  - Remove now unneeded README.source.
  - Refresh all patches.
* Reorganize source code:
  - Switch from debian/upstream.sh to debian/rules get-orig-source target.
  - Switch from CVS to Subversion to retrieve the source code.
  - Use the same source layout as upstream (no more relocations),
    i.e. lib/, sbin/, sys/sys, sys/ufs.
  - Move libport/ to port/.
  - Merge libdisklabel/ into port/.
* Remove unneeded linking against libtermcap, thus removing the need for
  ncurses.
* Add an empty debian/watch file explaining that there's no packaged
  upstream releases. Suggested by Peter Pentchev.
* Update CVS to Subversion reference to upstream source code in
  debian/copyright.
* Remove unused lib variable from debian/rules.
* Use dpkg-buildflags to set CPPFLAGS, CFLAGS and LDFLAGS.
  Based on a patch by Peter Pentchev.
* Remove bogus reference to BSD license in /usr/share/common-licenses.
* Always set -I../../sys, even on GNU/kFreeBSD systems.

[ Peter Pentchev ]
* Remove duplicate section “utils” from ufsutils binary package.
* Remove XC- prefix from Package-Type.
* Honour CPPFLAGS and LDFLAGS and do not link with CFLAGS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: ufsutils/mkfs.ufs/mkfs.c
2
 
===================================================================
3
 
--- ufsutils.orig/mkfs.ufs/mkfs.c
4
 
+++ ufsutils/mkfs.ufs/mkfs.c
5
 
@@ -53,6 +53,7 @@
 
1
---
 
2
 sbin/newfs/Makefile |   22 ++++++++++------------
 
3
 sbin/newfs/mkfs.c   |    1 +
 
4
 sbin/newfs/newfs.8  |    4 ++--
 
5
 sbin/newfs/newfs.c  |   22 ++++++++++++++++++----
 
6
 4 files changed, 31 insertions(+), 18 deletions(-)
 
7
 
 
8
--- a/sbin/newfs/mkfs.c
 
9
+++ b/sbin/newfs/mkfs.c
 
10
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
6
11
 #include <stdint.h>
7
12
 #include <stdio.h>
8
13
 #include <unistd.h>
10
15
 #include <sys/param.h>
11
16
 #include <sys/time.h>
12
17
 #include <sys/types.h>
13
 
Index: ufsutils/mkfs.ufs/newfs.c
14
 
===================================================================
15
 
--- ufsutils.orig/mkfs.ufs/newfs.c
16
 
+++ ufsutils/mkfs.ufs/newfs.c
17
 
@@ -55,7 +55,6 @@
 
18
--- a/sbin/newfs/newfs.c
 
19
+++ b/sbin/newfs/newfs.c
 
20
@@ -55,7 +55,9 @@ __FBSDID("$FreeBSD$");
18
21
  */
19
22
 #include <sys/param.h>
20
23
 #include <sys/stat.h>
21
 
-#include <sys/disk.h>
 
24
+#ifdef HAVE_BSD_DISKLABEL
 
25
 #include <sys/disk.h>
 
26
+#endif
22
27
 #include <sys/disklabel.h>
23
28
 #include <sys/file.h>
24
29
 #include <sys/mount.h>
25
 
@@ -140,6 +139,7 @@
26
 
 static char    device[MAXPATHLEN];
27
 
 static char    *disktype;
28
 
 static int     unlabeled;
29
 
+static char    *progname;
30
 
 
31
 
 static struct disklabel *getdisklabel(char *s);
32
 
 static void rewritelabel(char *s, struct disklabel *lp);
33
 
@@ -156,6 +156,8 @@
34
 
        int ch, i;
 
30
@@ -133,6 +135,8 @@ main(int argc, char *argv[])
35
31
        off_t mediasize;
 
32
        char part_name;         /* partition name, default to full disk */
36
33
 
37
 
+       progname = argv[0];
 
34
+       setprogname(argv[0]);
38
35
+
 
36
        part_name = 'c';
 
37
        reserved = 0;
39
38
        while ((ch = getopt(argc, argv,
40
 
            "EJL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:no:s:")) != -1)
41
 
                switch (ch) {
42
 
@@ -297,12 +299,19 @@
 
39
@@ -303,8 +307,9 @@ main(int argc, char *argv[])
43
40
        }
44
41
        if (fstat(disk.d_fd, &st) < 0)
45
42
                err(1, "%s", special);
46
 
+/*
47
 
        if ((st.st_mode & S_IFMT) != S_IFCHR)
48
 
                errx(1, "%s: not a character-special device", special);
49
 
+*/
50
 
 
 
43
-       if ((st.st_mode & S_IFMT) != S_IFCHR) {
 
44
-               warn("%s: not a character-special device", special);
 
45
+       if ((st.st_mode & S_IFMT) != S_IFCHR &&
 
46
+           (st.st_mode & S_IFMT) != S_IFBLK) {
 
47
+               warn("%s: not a block or character-special device", special);
 
48
                is_file = 1;    /* assume it is a file */
 
49
                dkname = special;
 
50
                if (sectorsize == 0)
 
51
@@ -312,10 +317,15 @@ main(int argc, char *argv[])
 
52
                mediasize = st.st_size;
 
53
                /* set fssize from the partition */
 
54
        } else {
51
55
+#ifdef HAVE_BSD_DISKLABEL
52
 
        if (sectorsize == 0)
53
 
                ioctl(disk.d_fd, DIOCGSECTORSIZE, &sectorsize);
54
 
-       if (sectorsize && !ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize)) {
 
56
            if (sectorsize == 0)
 
57
                if (ioctl(disk.d_fd, DIOCGSECTORSIZE, &sectorsize) == -1)
 
58
                    sectorsize = 0;     /* back out on error for safety */
 
59
-           if (sectorsize && ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize) != -1)
55
60
+#else
56
 
+       sectorsize = 512;
 
61
+           sectorsize = 512;
57
62
+#endif
58
 
+       mediasize = get_block_device_size(disk.d_fd);
59
 
+       if (sectorsize && mediasize) {
60
 
                if (fssize == 0)
61
 
                        fssize = mediasize / sectorsize;
62
 
                else if (fssize > mediasize / sectorsize)
63
 
@@ -375,7 +384,7 @@
 
63
+           mediasize = get_block_device_size(disk.d_fd);
 
64
+           if (sectorsize && mediasize)
 
65
                getfssize(&fssize, special, mediasize / sectorsize, reserved);
 
66
        }
 
67
        pp = NULL;
 
68
@@ -370,7 +380,7 @@ main(int argc, char *argv[])
64
69
                        pp->p_size *= secperblk;
65
70
        }
66
71
        mkfs(pp, special);
69
74
                if (realsectorsize != DEV_BSIZE)
70
75
                        pp->p_size /= realsectorsize / DEV_BSIZE;
71
76
                if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition)))
72
 
@@ -388,6 +397,7 @@
73
 
 struct disklabel *
74
 
 getdisklabel(char *s)
75
 
 {
 
77
@@ -415,8 +425,10 @@ getdisklabel(char *s)
 
78
                return &lab;
 
79
        }
 
80
 
76
81
+#if HAVE_BSD_DISKLABEL
77
 
        static struct disklabel lab;
78
 
        struct disklabel *lp;
79
 
 
80
 
@@ -399,6 +409,7 @@
81
 
                if (lp != NULL)
82
 
                        return (lp);
83
 
        }
 
82
        if (ioctl(disk.d_fd, DIOCGDINFO, (char *)&lab) != -1)
 
83
                return (&lab);
84
84
+#endif
85
 
        return (NULL);
86
 
 }
87
 
 
88
 
@@ -409,8 +420,10 @@
 
85
        unlabeled++;
 
86
        if (disktype) {
 
87
                lp = getdiskbyname(disktype);
 
88
@@ -441,8 +453,10 @@ rewritelabel(char *s, struct disklabel *
 
89
                        errx(1, "cannot write label");
89
90
                return;
90
 
        lp->d_checksum = 0;
91
 
        lp->d_checksum = dkcksum(lp);
 
91
        }
92
92
+#if HAVE_BSD_DISKLABEL
93
 
        if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) < 0)
 
93
        if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) == -1)
94
94
                warn("ioctl (WDINFO): %s: can't rewrite disk label", s);
95
95
+#endif
96
96
 }
97
97
 
98
98
 static void
99
 
@@ -418,7 +431,7 @@
100
 
 {
101
 
        fprintf(stderr,
102
 
            "usage: %s [ -fsoptions ] special-device%s\n",
103
 
-           getprogname(),
104
 
+           progname,
105
 
            " [device-type]");
106
 
        fprintf(stderr, "where fsoptions are:\n");
107
 
        fprintf(stderr, "\t-J Enable journaling via gjournal\n");
108
 
Index: ufsutils/mkfs.ufs/Makefile
109
 
===================================================================
110
 
--- ufsutils.orig/mkfs.ufs/Makefile
111
 
+++ ufsutils/mkfs.ufs/Makefile
112
 
@@ -1,17 +1,20 @@
 
99
--- a/sbin/newfs/Makefile
 
100
+++ b/sbin/newfs/Makefile
 
101
@@ -1,20 +1,18 @@
113
102
 #      @(#)Makefile    8.2 (Berkeley) 3/27/94
114
 
 # $FreeBSD: src/sbin/newfs/Makefile,v 1.22 2003/02/11 03:06:45 jmallett Exp $
 
103
 # $FreeBSD$
115
104
 
 
105
-.PATH: ${.CURDIR}/../../sys/geom
 
106
-
116
107
-PROG=  newfs
117
108
-DPADD= ${LIBUFS}
118
109
-LDADD= -lufs
119
 
-SRCS=  newfs.c mkfs.c
120
 
-WARNS?=        2
 
110
-SRCS=  newfs.c mkfs.c geom_bsd_enc.c
 
111
-
 
112
+PROG=  mkfs.ufs
 
113
+SRCS=  newfs.c mkfs.c ../../sys/geom/geom_bsd_enc.c
 
114
 WARNS?=        2
121
115
-MAN=   newfs.8
122
 
+PROG = mkfs.ufs
123
 
+SRCS = newfs.c mkfs.c
124
 
+WARNS ?= 2
125
 
+MAN = newfs.8:mkfs.ufs.8
 
116
+MAN=   newfs.8:mkfs.ufs.8
 
117
+
 
118
+LDADD += -L../../lib/libufs -lufs -L../../lib/port -lport -lbsd
 
119
+INCLUDES = -I../../lib/libufs -include ../../lib/port/blockdev.h
126
120
 
127
121
-.include <bsd.prog.mk>
128
 
+LDADD += -L../libufs -lufs -L../libdisklabel -ldisklabel -L../libport -lport -lbsd
129
 
+INCLUDES = -I../libufs \
130
 
+           -include port/blockdev.h
131
 
+
132
 
+include ../Makefile.common
 
122
+include ../../Makefile.common
133
123
 
134
124
 test:  ${PROG}
135
125
-       sh ${.CURDIR}/runtest01.sh 
139
129
+       sh ${CURDIR}/runtest00.sh | tee _.test
140
130
+       diff --ignore-matching-lines=FreeBSD _.test ${CURDIR}/ref.test
141
131
        echo All Tests Passed
142
 
+
 
132
--- a/sbin/newfs/newfs.8
 
133
+++ b/sbin/newfs/newfs.8
 
134
@@ -78,10 +78,10 @@ The following options define the general
 
135
 .It Fl E
 
136
 Erase the content of the disk before making the filesystem.
 
137
 The reserved area in front of the superblock (for bootcode) will not be erased.
 
138
-
 
139
+.Pp
 
140
 This is a relevant option for flash based storage devices that use
 
141
 wear levelling algorithms.
 
142
-
 
143
+.Pp
 
144
 NB: Erasing may take as long time as writing every sector on the disk.
 
145
 .It Fl J
 
146
 Enable journaling on the new file system via gjournal.