Accepting request 177733 from home:ihno:branches:Base:System

Added mkfs.bfs_cleanup64bit.patch and mkfs.bfs_cleanup_endian.patch to fix 64Bit and endian issues.

OBS-URL: https://build.opensuse.org/request/show/177733
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=159
This commit is contained in:
Marcus Meissner 2013-06-05 12:07:19 +00:00 committed by Git OBS Bridge
parent 7650fbe6dd
commit 1dd2f9d8c6
4 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,66 @@
bla fasel
--- util-linux-2.21.2.orig/disk-utils/mkfs.bfs.c
+++ util-linux-2.21.2/disk-utils/mkfs.bfs.c
@@ -1,6 +1,7 @@
/*
* mkfs.bfs - Create SCO BFS filesystem - aeb, 1999-09-07
*
+ * Usage: mkfs.bfs [-N nr-of-inodes] [-V volume-name] [-F fsname] device
*/
#include <errno.h>
@@ -27,13 +28,13 @@
/* superblock - 512 bytes */
struct bfssb {
- unsigned int s_magic;
- unsigned int s_start; /* byte offset of start of data */
- unsigned int s_end; /* sizeof(slice)-1 */
+ uint32_t s_magic;
+ uint32_t s_start; /* byte offset of start of data */
+ uint32_t s_end; /* sizeof(slice)-1 */
/* for recovery during compaction */
- int s_from, s_to; /* src and dest block of current transfer */
- int s_backup_from, s_backup_to;
+ uint32_t s_from, s_to; /* src and dest block of current transfer */
+ int32_t s_backup_from, s_backup_to;
/* labels - may well contain garbage */
char s_fsname[6];
@@ -43,16 +44,16 @@
/* inode - 64 bytes */
struct bfsi {
- unsigned short i_ino;
+ uint16_t i_ino;
unsigned char i_pad1[2];
- unsigned long i_first_block;
- unsigned long i_last_block;
- unsigned long i_bytes_to_end;
- unsigned long i_type; /* 1: file, 2: the unique dir */
- unsigned long i_mode;
- unsigned long i_uid, i_gid;
- unsigned long i_nlinks;
- unsigned long i_atime, i_mtime, i_ctime;
+ uint32_t i_first_block;
+ uint32_t i_last_block;
+ uint32_t i_bytes_to_end;
+ uint32_t i_type; /* 1: file, 2: the unique dir */
+ uint32_t i_mode;
+ uint32_t i_uid, i_gid;
+ uint32_t i_nlinks;
+ uint32_t i_atime, i_mtime, i_ctime;
unsigned char i_pad2[16];
};
@@ -60,7 +61,7 @@
/* directory entry - 16 bytes */
struct bfsde {
- unsigned short d_ino;
+ uint16_t d_ino;
char d_name[BFS_NAMELEN];
};

View File

@ -0,0 +1,76 @@
--- util-linux-2.21.2/disk-utils/mkfs.bfs.c.old 2013-05-28 19:26:05.000000000 +0200
+++ util-linux-2.21.2/disk-utils/mkfs.bfs.c 2013-05-28 19:39:28.000000000 +0200
@@ -98,6 +98,7 @@
unsigned long long user_specified_total_blocks = 0;
int verbose = 0;
int fd;
+ uint32_t first_block;
struct bfssb sb;
struct bfsi ri;
struct bfsde de;
@@ -224,9 +224,9 @@
ino_blocks + 33);
memset(&sb, 0, sizeof(sb));
- sb.s_magic = BFS_SUPER_MAGIC;
- sb.s_start = ino_bytes + sizeof(struct bfssb);
- sb.s_end = total_blocks * BFS_BLOCKSIZE - 1;
+ sb.s_magic = htole32(BFS_SUPER_MAGIC);
+ sb.s_start = htole32(ino_bytes + sizeof(struct bfssb));
+ sb.s_end = htole32(total_blocks * BFS_BLOCKSIZE - 1);
sb.s_from = sb.s_to = sb.s_backup_from = sb.s_backup_to = -1;
memcpy(sb.s_fsname, fsname, 6);
memcpy(sb.s_volume, volume, 6);
@@ -244,28 +244,29 @@
inodes, ino_blocks);
fprintf(stderr, _("Blocks: %lld\n"), total_blocks);
fprintf(stderr, _("Inode end: %d, Data end: %d\n"),
- sb.s_start - 1, sb.s_end);
+ htole32(sb.s_start) - 1, htole32(sb.s_end));
}
if (write(fd, &sb, sizeof(sb)) != sizeof(sb))
err(EXIT_FAILURE, _("error writing superblock"));
memset(&ri, 0, sizeof(ri));
- ri.i_ino = BFS_ROOT_INO;
- ri.i_first_block = 1 + ino_blocks;
- ri.i_last_block = ri.i_first_block +
- (inodes * sizeof(de) - 1) / BFS_BLOCKSIZE;
- ri.i_bytes_to_end = ri.i_first_block * BFS_BLOCKSIZE
- + 2 * sizeof(struct bfsde) - 1;
- ri.i_type = BFS_DIR_TYPE;
- ri.i_mode = S_IFDIR | 0755; /* or just 0755 */
- ri.i_uid = 0;
- ri.i_gid = 1; /* random */
+ ri.i_ino = htole16(BFS_ROOT_INO);
+ first_block = 1 + ino_blocks;
+ ri.i_first_block = htole32(first_block);
+ ri.i_last_block = htole32(first_block +
+ (inodes * sizeof(de) - 1) / BFS_BLOCKSIZE);
+ ri.i_bytes_to_end = htole32(first_block * BFS_BLOCKSIZE
+ + 2 * sizeof(struct bfsde) - 1);
+ ri.i_type = htole32(BFS_DIR_TYPE);
+ ri.i_mode = htole32(S_IFDIR | 0755); /* or just 0755 */
+ ri.i_uid = htole32(0);
+ ri.i_gid = htole32(1); /* random */
ri.i_nlinks = 2;
time(&now);
- ri.i_atime = now;
- ri.i_mtime = now;
- ri.i_ctime = now;
+ ri.i_atime = htole32(now);
+ ri.i_mtime = htole32(now);
+ ri.i_ctime = htole32(now);
if (write(fd, &ri, sizeof(ri)) != sizeof(ri))
err(EXIT_FAILURE, _("error writing root inode"));
@@ -279,7 +280,7 @@
err(EXIT_FAILURE, _("seek error"));
memset(&de, 0, sizeof(de));
- de.d_ino = BFS_ROOT_INO;
+ de.d_ino = htole16(BFS_ROOT_INO);
memcpy(de.d_name, ".", 1);
if (write(fd, &de, sizeof(de)) != sizeof(de))
err(EXIT_FAILURE, _("error writing . entry"));

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed May 29 11:45:04 UTC 2013 - ihno@suse.com
- fixing mkfs.bfs to make it 64bit and endian clean.
adding the patches mkfs.bfs_cleanup_64bit.patch and
mkfs.bfs_cleanup_endian.patch
-------------------------------------------------------------------
Sun Mar 17 20:39:47 UTC 2013 - jengelh@inai.de

View File

@ -116,6 +116,10 @@ Patch26: fdiskbsdlabel.patch
Patch55: klogconsole-quiet.patch
Patch56: klogconsole.diff
## fix mkfs.bfs
Patch60: mkfs.bfs_cleanup_64bit.patch
Patch61: mkfs.bfs_cleanup_endian.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq %fillup_prereq /bin/sed
#
@ -234,6 +238,10 @@ Files to develop applications using the libmount library.
cp %{S:22} %{S:23} .
# nologin
cp %{S:2} %{S:3} %{S:26} %{S:30} .
%patch60 -p1
%patch61 -p1
cd ../klogconsole
%patch55 -p1
%patch56 -p1