Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 88252
Collapse All | Expand All

(-)grub-0.96/INSTALL (+3 lines)
Lines 207-212 Link Here
207
`--disable-reiserfs'
207
`--disable-reiserfs'
208
     Omit the ReiserFS support in Stage 2.
208
     Omit the ReiserFS support in Stage 2.
209
209
210
`--disable-reiser4'
211
     Omit the Reiser4 support in Stage 2.
212
210
`--disable-vstafs'
213
`--disable-vstafs'
211
     Omit the VSTa filesystem support in Stage 2.
214
     Omit the VSTa filesystem support in Stage 2.
212
215
(-)grub-0.96/config.h.in (+7 lines)
Lines 27-35 Link Here
27
/* Define to 1 if you have the <inttypes.h> header file. */
27
/* Define to 1 if you have the <inttypes.h> header file. */
28
#undef HAVE_INTTYPES_H
28
#undef HAVE_INTTYPES_H
29
29
30
/* Define to 1 if you have the `aal-minimal' library (-laal-minimal). */
31
#undef HAVE_LIBAAL_MINIMAL
32
30
/* Define if you have a curses library */
33
/* Define if you have a curses library */
31
#undef HAVE_LIBCURSES
34
#undef HAVE_LIBCURSES
32
35
36
/* Define to 1 if you have the `reiser4-minimal' library (-lreiser4-minimal).
37
   */
38
#undef HAVE_LIBREISER4_MINIMAL
39
33
/* Define to 1 if you have the <memory.h> header file. */
40
/* Define to 1 if you have the <memory.h> header file. */
34
#undef HAVE_MEMORY_H
41
#undef HAVE_MEMORY_H
35
42
(-)grub-0.96/configure.ac (+71 lines)
Lines 263-268 Link Here
263
  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
263
  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
264
fi
264
fi
265
265
266
dnl Checking for reiser4
267
REISER4_LIBS=""
268
REISER4_CFLAGS=""
269
270
OLD_LIBS=$LIBS
271
OLD_CFLAGS=$CFLAGS
272
LIBS=""
273
CFLAGS=""
274
275
AC_ARG_ENABLE(reiser4,
276
  [  --disable-reiser4       disable Reiser4 support in Stage 2])
277
278
if test x"$enable_reiser4" != xno; then
279
  AC_CHECK_LIB(aal-minimal, aal_mem_init, , 
280
    AC_MSG_WARN(
281
Reiser4 support is disabled due to inability find libaal-minimal with 
282
memory manager support turned on.)
283
    enable_reiser4=no
284
  )
285
fi
286
  
287
if test x"$enable_reiser4" != xno; then
288
  AC_CHECK_HEADER(aal/libaal.h, ,
289
  AC_MSG_WARN(
290
Libaal header files are not found. Reiser4 support is disabled
291
  )
292
  enable_reiser4=no)
293
fi
294
  
295
if test x"$enable_reiser4" != xno; then
296
  AC_CHECK_LIB(reiser4-minimal, reiser4_fs_open, , 
297
  AC_MSG_WARN(
298
Reiser4 support is disabled due to inability find valid libreiser4-minimal.)
299
    enable_reiser4=no, 
300
    -laal-minimal
301
  )
302
fi
303
304
if test x"$enable_reiser4" != xno; then
305
  AC_CHECK_HEADER(reiser4/libreiser4.h, ,
306
  AC_MSG_WARN(
307
Reiser4 header files are not found. Reiser4 support is disabled.
308
  )
309
  enable_reiser4=no)
310
fi
311
312
if test x"$enable_reiser4" != xno; then
313
  REISER4_CFLAGS="$REISER4_CFLAGS -DFSYS_REISER4=1"
314
  REISER4_LIBS=$LIBS
315
fi
316
317
if test x"$enable_reiser4" != xno; then
318
  AC_CHECK_LIB(reiser4-minimal, __sym40_plug_init, 
319
    REISER4_CFLAGS="$REISER4_CFLAGS -DENABLE_SYMLINKS=1",
320
AC_MSG_WARN(Reiser4 symlinks support is disabled.), 
321
    -laal-minimal
322
  )
323
fi
324
325
LIBS=$OLD_LIBS
326
CFLAGS=$OLD_CFLAGS
327
328
if test x"$enable_reiser4" != xno; then
329
  enable_reiser4_support=yes
330
  FSYS_CFLAGS="$FSYS_CFLAGS $REISER4_CFLAGS"
331
fi
332
333
AC_SUBST(REISER4_LIBS)
334
AC_SUBST(REISER4_CFLAGS)
335
AM_CONDITIONAL(ENABLE_REISER4_SUPPORT, test x"$enable_reiser4" != xno)
336
266
AC_ARG_ENABLE(vstafs,
337
AC_ARG_ENABLE(vstafs,
267
  [  --disable-vstafs        disable VSTa FS support in Stage 2])
338
  [  --disable-vstafs        disable VSTa FS support in Stage 2])
268
339
(-)grub-0.96/docs/grub.texi (-1 / +2 lines)
Lines 283-289 Link Here
283
Support multiple filesystem types transparently, plus a useful explicit
283
Support multiple filesystem types transparently, plus a useful explicit
284
blocklist notation. The currently supported filesystem types are
284
blocklist notation. The currently supported filesystem types are
285
@dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux
285
@dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux
286
ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa
286
ext2fs}, @dfn{ReiserFS}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa
287
fs}. @xref{Filesystem}, for more information.
287
fs}. @xref{Filesystem}, for more information.
288
288
289
@item Support automatic decompression
289
@item Support automatic decompression
Lines 1776-1781 Link Here
1776
@itemx jfs_stage1_5
1776
@itemx jfs_stage1_5
1777
@itemx minix_stage1_5
1777
@itemx minix_stage1_5
1778
@itemx reiserfs_stage1_5
1778
@itemx reiserfs_stage1_5
1779
@itemx reiser4_stage1_5
1779
@itemx vstafs_stage1_5
1780
@itemx vstafs_stage1_5
1780
@itemx xfs_stage1_5
1781
@itemx xfs_stage1_5
1781
1782
(-)grub-0.96/grub/Makefile.am (-1 / +1 lines)
Lines 16-19 Link Here
16
AM_CFLAGS = $(GRUB_CFLAGS)
16
AM_CFLAGS = $(GRUB_CFLAGS)
17
17
18
grub_SOURCES = main.c asmstub.c
18
grub_SOURCES = main.c asmstub.c
19
grub_LDADD = ../stage2/libgrub.a  ../lib/libcommon.a $(GRUB_LIBS)
19
grub_LDADD = ../stage2/libgrub.a  ../lib/libcommon.a $(GRUB_LIBS) $(REISER4_LIBS)
(-)grub-0.96/stage2/Makefile.am (-14 / +36 lines)
Lines 13-29 Link Here
13
# For <stage1.h>.
13
# For <stage1.h>.
14
INCLUDES = -I$(top_srcdir)/stage1
14
INCLUDES = -I$(top_srcdir)/stage1
15
15
16
if ENABLE_REISER4_SUPPORT
17
REISER4_STAGE1_5 = reiser4_stage1_5
18
REISER4_STAGE1_5_EXEC = reiser4_stage1_5.exec
19
else
20
REISER4_STAGE1_5 =
21
REISER4_STAGE1_5_EXEC =
22
endif
23
16
# The library for /sbin/grub.
24
# The library for /sbin/grub.
17
noinst_LIBRARIES = libgrub.a
25
noinst_LIBRARIES = libgrub.a
18
libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
26
libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
19
	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
27
	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
20
	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
28
 	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_reiser4.c fsys_ufs2.c \
21
	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
29
	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
22
	terminfo.c tparm.c graphics.c
30
	terminfo.c tparm.c graphics.c
23
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
31
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
24
	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
32
	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
25
	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
33
	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
26
	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
34
 	$(REISER4_CFLAGS) -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
27
	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
35
	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
28
36
29
# Stage 2 and Stage 1.5's.
37
# Stage 2 and Stage 1.5's.
Lines 34-57 Link Here
34
if DISKLESS_SUPPORT
42
if DISKLESS_SUPPORT
35
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
43
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
36
	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
44
	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
37
	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
45
	reiserfs_stage1_5 $(REISER4_STAGE1_5) ufs2_stage1_5 \
38
	nbgrub pxegrub
46
	vstafs_stage1_5 xfs_stage1_5 nbgrub pxegrub
39
noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
47
noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
40
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
48
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
41
	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
49
	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
42
	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
50
	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
43
	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
51
	reiserfs_stage1_5.exec $(REISER4_STAGE1_5_EXEC) ufs2_stage1_5.exec \
44
	xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
52
	vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec pxeloader.exec \
53
	diskless.exec
45
else
54
else
46
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
55
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
47
	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
56
	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
48
	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
57
	reiserfs_stage1_5 $(REISER4_STAGE1_5) ufs2_stage1_5 \
58
	vstafs_stage1_5 xfs_stage1_5
49
noinst_DATA = pre_stage2 start start_eltorito
59
noinst_DATA = pre_stage2 start start_eltorito
50
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
60
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
51
	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
61
	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
52
	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
62
	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
53
	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
63
	reiserfs_stage1_5.exec $(REISER4_STAGE1_5_EXEC) ufs2_stage1_5.exec \
54
	xfs_stage1_5.exec
64
	vstafs_stage1_5.exec xfs_stage1_5.exec
55
endif
65
endif
56
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
66
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
57
67
Lines 85-91 Link Here
85
GRAPHICS_FLAGS =
95
GRAPHICS_FLAGS =
86
endif
96
endif
87
97
88
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
98
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin \
89
	$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
99
	$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
90
100
91
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
101
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
Lines 95-109 Link Here
95
pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
105
pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
96
	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
106
	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
97
	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
107
	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
98
	fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
108
 	fsys_reiserfs.c fsys_reiser4.c fsys_ufs2.c fsys_vstafs.c \
99
	hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
109
 	fsys_xfs.c gunzip.c hercules.c md5.c serial.c smp-imps.c \
100
	graphics.c
110
 	stage2.c terminfo.c tparm.c graphics.c
101
pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
111
pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
102
pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
112
pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
103
pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
113
pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
104
114
105
if NETBOOT_SUPPORT
115
if NETBOOT_SUPPORT
106
pre_stage2_exec_LDADD = ../netboot/libdrivers.a
116
pre_stage2_exec_LDADD = ../netboot/libdrivers.a $(REISER4_LIBS)
117
else
118
pre_stage2_exec_LDADD = $(REISER4_LIBS)
107
endif
119
endif
108
120
109
if DISKLESS_SUPPORT
121
if DISKLESS_SUPPORT
Lines 197-202 Link Here
197
	-DNO_BLOCK_FILES=1
209
	-DNO_BLOCK_FILES=1
198
reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
210
reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
199
211
212
# For reiser4_stage1_5 target.
213
reiser4_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
214
	disk_io.c stage1_5.c fsys_reiser4.c bios.c
215
reiser4_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) $(REISER4_CFLAGS) \
216
	-DNO_BLOCK_FILES=1
217
reiser4_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) $(REISER4_CFLAGS) \
218
	-DNO_BLOCK_FILES=1
219
reiser4_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
220
reiser4_stage1_5_exec_LDADD = $(REISER4_LIBS)
221
200
# For vstafs_stage1_5 target.
222
# For vstafs_stage1_5 target.
201
vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
223
vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
202
	disk_io.c stage1_5.c fsys_vstafs.c bios.c
224
	disk_io.c stage1_5.c fsys_vstafs.c bios.c
(-)grub-0.96/stage2/builtins.c (+1 lines)
Lines 4062-4067 Link Here
4062
    {"jfs",      "/jfs_stage1_5"},
4062
    {"jfs",      "/jfs_stage1_5"},
4063
    {"minix",    "/minix_stage1_5"},
4063
    {"minix",    "/minix_stage1_5"},
4064
    {"reiserfs", "/reiserfs_stage1_5"},
4064
    {"reiserfs", "/reiserfs_stage1_5"},
4065
    {"reiser4",  "/reiser4_stage1_5"},
4065
    {"vstafs",   "/vstafs_stage1_5"},
4066
    {"vstafs",   "/vstafs_stage1_5"},
4066
    {"xfs",      "/xfs_stage1_5"}
4067
    {"xfs",      "/xfs_stage1_5"}
4067
  };
4068
  };
(-)grub-0.96/stage2/disk_io.c (+3 lines)
Lines 63-68 Link Here
63
# ifdef FSYS_REISERFS
63
# ifdef FSYS_REISERFS
64
  {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
64
  {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
65
# endif
65
# endif
66
# ifdef FSYS_REISER4
67
  {"reiser4", reiser4_mount, reiser4_read, reiser4_dir, 0, reiser4_embed},
68
# endif
66
# ifdef FSYS_VSTAFS
69
# ifdef FSYS_VSTAFS
67
  {"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0},
70
  {"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0},
68
# endif
71
# endif
(-)grub-0.96/stage2/filesys.h (-2 / +12 lines)
Lines 77-82 Link Here
77
#define FSYS_REISERFS_NUM 0
77
#define FSYS_REISERFS_NUM 0
78
#endif
78
#endif
79
79
80
#ifdef FSYS_REISER4
81
#define FSYS_REISER4_NUM 1
82
int reiser4_mount (void);
83
int reiser4_read (char *buf, int len);
84
int reiser4_dir (char *dirname);
85
int reiser4_embed (int *start_sector, int needed_sectors);
86
#else
87
#define FSYS_REISER4_NUM 0
88
#endif
89
80
#ifdef FSYS_VSTAFS
90
#ifdef FSYS_VSTAFS
81
#define FSYS_VSTAFS_NUM 1
91
#define FSYS_VSTAFS_NUM 1
82
int vstafs_mount (void);
92
int vstafs_mount (void);
Lines 127-134 Link Here
127
#ifndef NUM_FSYS
137
#ifndef NUM_FSYS
128
#define NUM_FSYS	\
138
#define NUM_FSYS	\
129
  (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
139
  (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
130
   + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM	\
140
   + FSYS_REISERFS_NUM + FSYS_REISER4_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \
131
   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
141
   + FSYS_XFS_NUM + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
132
#endif
142
#endif
133
143
134
/* defines for the block filesystem info area */
144
/* defines for the block filesystem info area */
(-)grub-0.96/stage2/fsys_reiser4.c (+260 lines)
Line 0 Link Here
1
/* 
2
 *  fsys_reiser4.c -- reiser4 filesystem support.
3
 *  Copyright (C) 2000, 2001   Free Software Foundation, Inc.
4
 *  
5
 *  GRUB  --  GRand Unified Bootloader
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
*/
21
22
#ifdef FSYS_REISER4
23
#include "shared.h"
24
#include "filesys.h"
25
26
#define ENABLE_MINIMAL
27
#include <reiser4/libreiser4.h>
28
29
static reiser4_fs_t *fs = NULL;
30
static aal_device_t *dev = NULL;
31
static reiser4_object_t *object = NULL;
32
33
/* Read callback of grub specific device. It uses devread() for reading passed
34
   @count of device blocks starting from @blk to passed @buff. */
35
static errno_t grub_dev_read(aal_device_t *device,
36
			     void *buff, blk_t blk,
37
			     count_t count)
38
{
39
	unsigned int size;
40
	unsigned int factor;
41
	unsigned int sector;
42
43
	/* Calculating actual sector and size in bytes to be read from
44
	   device. */
45
	factor = device->blksize / SECTOR_SIZE;
46
	sector = (unsigned int)blk << aal_log2(factor);
47
	size = (unsigned int)count * (SECTOR_SIZE * factor);
48
	
49
	/* Reading from the current device */
50
        if (!devread(sector, 0, size, buff))
51
    	        return -EIO;
52
		
53
	return 0;
54
}
55
56
/* Length callback of grub device */
57
static count_t grub_dev_len(aal_device_t *device) {
58
	unsigned int factor;
59
60
	/* Getting partition length in device blocks */
61
	factor = device->blksize / SECTOR_SIZE;
62
	return (part_length >> aal_log2(factor));
63
}
64
65
/*
66
  Initializing grub device abstraction instance. It will use devread and friends
67
  for providing needed functionality.
68
*/
69
struct aal_device_ops grub_dev_ops = {
70
	.read   = grub_dev_read,
71
	.len    = grub_dev_len
72
};
73
74
/* Initializes reiser4 */
75
static int reiser4_init(void) {
76
	extern aal_hash_table_t *plugins;
77
	
78
	plugins = NULL;
79
80
	/* Initializing memory manager */
81
	aal_mem_init((void *)FSYS_BUF, FSYS_BUFLEN);
82
83
	/* Initializing device abstraction on current device GRUB uses. */
84
	if (!(dev = aal_device_open(&grub_dev_ops, NULL,
85
				    SECTOR_SIZE, 0)))
86
	{
87
		return 0;
88
	}
89
90
	/* Initializing libreiser4 (plugins, etc) */
91
	return !libreiser4_init();
92
}
93
94
#define MEMORY_WATERMARK 8192
95
96
/* Memory pressure detect function. */
97
static int mpressure_detect(reiser4_tree_t *tree) {
98
	return (aal_mem_free() <= MEMORY_WATERMARK);
99
}
100
101
/* Reiser4 mount() routine */
102
int reiser4_mount(void) {
103
	
104
	/* Initialize all reiser4 related stuff first */
105
	if (!reiser4_init())
106
		return 0;
107
	
108
	/* Open filesystem on @dev. */
109
	if (!(fs = reiser4_fs_open(dev)))
110
		return 0;
111
112
	fs->tree->mpc_func = mpressure_detect;
113
	
114
	object = NULL;
115
	return 1;
116
}
117
118
/* Reiser4 read() handler */
119
int reiser4_read(char *buf, int len) {
120
	int64_t read;
121
122
	if (object == NULL)
123
		return 0;
124
125
	/* Seet at current position denoted by @filepos */
126
	if (objplug(object)->o.object_ops->seek) {
127
		plug_call(objplug(object)->o.object_ops,
128
			  seek, object->ent, filepos);
129
	}
130
	
131
	/* Reading current file data starting from @filepos */
132
	disk_read_func = disk_read_hook;
133
	read = objplug(object)->o.object_ops->read ?
134
		plug_call(objplug(object)->o.object_ops, read, 
135
			  object->ent, buf, len) : -EINVAL;
136
	disk_read_func = NULL;
137
138
	if (read < 0) {
139
		errnum = ERR_FSYS_CORRUPT;
140
		return 0;
141
	}
142
143
    	filepos += read;
144
	return read;
145
}
146
147
/* Reiser4 file open() routine */
148
int reiser4_dir(char *dirname) {
149
	char *ch;
150
	
151
	if (fs == NULL)
152
		return 0;
153
154
	if (object != NULL) {
155
		plug_call(objplug(object)->o.object_ops, 
156
			  close, object->ent);
157
		aal_free(object);
158
		object = NULL;
159
	}
160
161
	/* Cutting out string after first space character */
162
    	if ((ch = aal_strchr(dirname, ' ')))
163
		*ch = '\0';
164
		
165
	/* This function is also called for getting directory list for
166
	   maintaining the bash-like completion. */
167
#ifndef STAGE1_5
168
	if (print_possibilities) {
169
		char entry[256];
170
		entry_hint_t entry_hint;
171
		
172
		/* Getting last part of name (jsut after last '/') */
173
		if (*(dirname + aal_strlen(dirname) - 1) != '/') {
174
		
175
			if (!(ch = aal_strrchr(dirname, '/'))) {
176
				errnum = ERR_BAD_FILETYPE;
177
				return 0;
178
			}
179
180
			aal_strncpy(entry, ch + 1, sizeof(entry));
181
			*(ch + 1) = '\0';
182
		} else {
183
			aal_memset(entry, 0, sizeof(entry));
184
		}
185
186
		/* Open obejct by @dirname */
187
		if (!(object = reiser4_semantic_open(fs->tree, dirname, 
188
						     NULL, 1))) 
189
		{
190
			errnum = ERR_FILE_NOT_FOUND;
191
			return 0;
192
		}
193
194
		/* Checking if it is a directory object */
195
		if (object->ent->opset.plug[OPSET_OBJ]->id.group != DIR_OBJECT)
196
		{
197
			/* If not, cutting out last '/' character */
198
    			if ((ch = aal_strrchr(dirname, '/')))
199
				*ch = '\0';
200
201
			/* Close current object */
202
			plug_call(objplug(object)->o.object_ops, 
203
				  close, object->ent);
204
			aal_free(object);
205
			return 0;
206
		}
207
		
208
		/* Reading the opened directory to build the completion list. */
209
		if (objplug(object)->o.object_ops->readdir) {
210
			while (plug_call(objplug(object)->o.object_ops, readdir,
211
					 object->ent, &entry_hint) > 0) 
212
			{
213
				if (substring(entry, entry_hint.name) <= 0) {
214
					if (print_possibilities > 0)
215
						print_possibilities = 
216
							-print_possibilities;
217
				
218
					print_a_completion(entry_hint.name);
219
				}
220
			}
221
		}
222
	} else {
223
#endif
224
		/* This is the case when resier4_dir() is called for open the
225
		   file @dirname, not for building completion list. */
226
		if (!(object = reiser4_semantic_open(fs->tree, dirname,
227
						     NULL, 1))) 
228
		{
229
			errnum = ERR_FILE_NOT_FOUND;
230
			return 0;
231
		}
232
		
233
		if (object->ent->opset.plug[OPSET_OBJ]->id.group != REG_OBJECT)
234
		{
235
			errnum = ERR_BAD_FILETYPE;
236
			return 0;
237
		}
238
		
239
		/* Initializing GRUB global variables @filepos and @filemax. */
240
		filepos = 0;
241
		filemax = reiser4_object_size(object);
242
	
243
		return 1;
244
#ifndef STAGE1_5
245
	}
246
247
	return 1;
248
#endif
249
250
	errnum = ERR_FILE_NOT_FOUND;
251
	return 0;
252
}
253
254
/* Returns how many sectors may be used for embeding reiser4_stage1_5 in teh
255
   case of installing GRUB to partition instead of MBR. */
256
int reiser4_embed (int *start_sector, int needed_sectors) {
257
	*start_sector = 1;
258
	return needed_sectors <= ((REISER4_MASTER_OFFSET >> SECTOR_BITS) - 1);
259
}
260
#endif /* FSYS_REISER4 */
(-)grub-0.96/stage2/shared.h (-5 / +8 lines)
Lines 207-217 Link Here
207
#define STAGE2_ID_FAT_STAGE1_5		3
207
#define STAGE2_ID_FAT_STAGE1_5		3
208
#define STAGE2_ID_MINIX_STAGE1_5	4
208
#define STAGE2_ID_MINIX_STAGE1_5	4
209
#define STAGE2_ID_REISERFS_STAGE1_5	5
209
#define STAGE2_ID_REISERFS_STAGE1_5	5
210
#define STAGE2_ID_VSTAFS_STAGE1_5	6
210
#define STAGE2_ID_REISER4_STAGE1_5	6
211
#define STAGE2_ID_JFS_STAGE1_5		7
211
#define STAGE2_ID_VSTAFS_STAGE1_5	7
212
#define STAGE2_ID_XFS_STAGE1_5		8
212
#define STAGE2_ID_JFS_STAGE1_5		8
213
#define STAGE2_ID_ISO9660_STAGE1_5	9
213
#define STAGE2_ID_XFS_STAGE1_5		9
214
#define STAGE2_ID_UFS2_STAGE1_5		10
214
#define STAGE2_ID_ISO9660_STAGE1_5	10
215
#define STAGE2_ID_UFS2_STAGE1_5		11
215
216
216
#ifndef STAGE1_5
217
#ifndef STAGE1_5
217
# define STAGE2_ID	STAGE2_ID_STAGE2
218
# define STAGE2_ID	STAGE2_ID_STAGE2
Lines 226-231 Link Here
226
#  define STAGE2_ID	STAGE2_ID_MINIX_STAGE1_5
227
#  define STAGE2_ID	STAGE2_ID_MINIX_STAGE1_5
227
# elif defined(FSYS_REISERFS)
228
# elif defined(FSYS_REISERFS)
228
#  define STAGE2_ID	STAGE2_ID_REISERFS_STAGE1_5
229
#  define STAGE2_ID	STAGE2_ID_REISERFS_STAGE1_5
230
# elif defined(FSYS_REISER4)
231
#  define STAGE2_ID	STAGE2_ID_REISER4_STAGE1_5
229
# elif defined(FSYS_VSTAFS)
232
# elif defined(FSYS_VSTAFS)
230
#  define STAGE2_ID	STAGE2_ID_VSTAFS_STAGE1_5
233
#  define STAGE2_ID	STAGE2_ID_VSTAFS_STAGE1_5
231
# elif defined(FSYS_JFS)
234
# elif defined(FSYS_JFS)

Return to bug 88252