[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reiser4 and GRUB...
From: |
Yury Umanets |
Subject: |
Re: Reiser4 and GRUB... |
Date: |
Sun, 25 May 2003 00:02:12 +0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030523 |
Yoshinori K. Okuji wrote:
At Sat, 24 May 2003 18:54:23 +0400,
Yury Umanets wrote:
I'm sure, that I will cut it out soon.
Ok. I hope you will be able to reduce the size enough.
I have reduced it substansionaly today. By now reiser4_stage1_5 is 24308
bytes, whereas valid size is <= 24320 bytes. Of course, it still not
very good result, because we have not room for adding new code and new
plugins, but it is moving right direction :)
In general you are right. But consider about adding new plugins used for
root reiser4 filesystem. These plugins should be handled too. Also these
plugins may not be standard ones. I mean, that anyone is able to add
something in kernel code first and then in library. And in the case of
using current approach we will have supported GRUB out of the box. At
least using it with stage2 only.
That sounds reasonable, but I still prefer to include the library in
GRUB, so that we can make sure that the size is below the limit. What
I don't like is that it could cause random errors to depend on
third-party libraries.
I don't now what to say :) If someone use some stable version of
library, everythinh is ok. If not, hi uses it on his own risk. Then,
there exists fair interface. For instance, function library_read()
returns number of bytes was read. And fsys_reiser4.c knows about that
and uses this "feature". Interface is the thing, which is not changing
frequently and if it is changed, checking interface version of that
changed library in configure time will prevent using unsupported versions.
Thanks for answer. I thought before, that address@hidden list is not
friendly one. But I was wrong :)
I think you were right. That time, Jochen was responsible for ReiserFS
support, so I thought it would be better to keep things preferable for
him. He liked to use our own implementation. However, I haven't heard
from him anything recently, so I now think it would be better to
change things for a new active developer (i.e. you).
Hm... I'm agreed in general, but I'm afraid a little, that I will have
not enough time for that sometimes. There are few projects except
reiser4 I'm participating in.
But anyway, I have some changes for reiserfs stuff in GRUB. For
instnace, non standard journal support.
Also, note that I am much more conservative than other maintainers
(e.g. Andrew Clausen).
Yes :) Andrew likes new ideas like plugins in parted and so on. We have
worked together on reiserfs support in parted.
So it is much harder to change things in GRUB
than other projects. This is mainly because GRUB is very difficult to
test (consider how many variants of PC BIOSes are in the world),
Additionaly they are bugy sometimes.
but
this is also just because it is my nature. Thus, aggressive
propositions to change things dramatically are often rejected, unless
you show well-grounded arguments.
Ah, another reason that this list is unfriendly is that my response is
really bad these days. Be patient, please. That is because I'm
preparing to move to a foreign country. I expect that I will have more
spare time in some months.
Okuji
Okay, thanks a lot. BTW, what is the country you are living currently
and what is that happy country you are going to?
P.S. I have attached fsys_reiser4.c for you. Take a look please. It is
pretty small.
--
Yury Umanets
"We're flying high, we're watching the world passes by..."
/*
fsys_reiser4.c -- reiser4 filesystem support for GNU GRUB
Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
reiser4progs/COPYING.
*/
#ifdef FSYS_REISER4
#include "shared.h"
#include "filesys.h"
#define ENABLE_STAND_ALONE
#include <reiser4/reiser4.h>
static reiser4_fs_t *fs = NULL;
static aal_device_t *dev = NULL;
static reiser4_object_t *object = NULL;
/* Read callback of grub specific device */
static errno_t dev_read(aal_device_t *device,
void *buff, blk_t blk,
count_t count)
{
unsigned long sector;
sector = (unsigned long)blk << 3;
if (!devread(sector, 0, (unsigned long)count * 4096, buff))
return -EIO;
return 0;
}
/* Length callback of grub device */
static count_t dev_len(aal_device_t *device) {
return part_length >> 3;
}
/*
Initializing grub device abstraction instance. It will use devread and friends
for providing needed functionality.
*/
struct aal_device_ops grub_dev_ops = {
.read = dev_read,
.len = dev_len
};
extern register_builtin_t __register_builtin;
#define __register_reiser4_plugin(n) { \
extern plugin_init_t __##n##_plugin_init; \
__register_builtin(__##n##_plugin_init, NULL); \
}
static int reiser4_init(void) {
/* Initializing memory manager */
aal_mem_init((void *)FSYS_BUF, FSYS_BUFLEN);
/* Initializing plugins */
__register_reiser4_plugin(format40);
__register_reiser4_plugin(r5_hash);
__register_reiser4_plugin(direntry40);
__register_reiser4_plugin(stat40);
__register_reiser4_plugin(tail40);
__register_reiser4_plugin(nodeptr40);
__register_reiser4_plugin(extent40);
__register_reiser4_plugin(key40);
__register_reiser4_plugin(node40);
__register_reiser4_plugin(dir40);
__register_reiser4_plugin(reg40);
__register_reiser4_plugin(oid40);
__register_reiser4_plugin(sdext_lw);
/* Initializing libreiser4 (plugins, etc) */
return !libreiser4_init();
}
static void reiser4_fini(void) {
libreiser4_fini();
}
#define MEMORY_WATERMARK 8192
static errno_t connect_handler(reiser4_tree_t *tree,
reiser4_place_t *place,
reiser4_node_t *node,
void *data)
{
if (aal_mem_free() <= MEMORY_WATERMARK)
return aal_lru_adjust(tree->lru);
return 0;
}
extern aal_list_t *plugins;
int reiser4_mount(void) {
int res;
plugins = NULL;
if (!(res = reiser4_init()))
return res;
if (!(dev = aal_device_open(&grub_dev_ops, NULL,
REISER4_BLKSIZE, 0)))
{
grub_printf("Can't open grub device.\n");
goto error_fini;
}
if (!(fs = reiser4_fs_open(dev, NULL)))
goto error_free_dev;
if (!(fs->tree = reiser4_tree_init(fs)))
goto error_free_fs;
fs->tree->traps.connect = connect_handler;
object = NULL;
return 1;
error_free_fs:
reiser4_fs_close(fs);
fs = NULL;
error_free_dev:
aal_device_close(dev);
dev = NULL;
error_fini:
reiser4_fini();
return 0;
}
void reiser4_close(void) {
if (!object)
return;
reiser4_object_close(object);
object = NULL;
}
int reiser4_read(char *buf, int len) {
int read;
if (object == NULL)
return 0;
reiser4_object_seek(object, filepos);
disk_read_func = disk_read_hook;
read = reiser4_object_read(object, buf, len);
disk_read_func = NULL;
filepos += read;
return read;
}
int reiser4_dir(char *dirname) {
char *ch;
if (fs == NULL)
return 0;
reiser4_close();
if ((ch = aal_strchr(dirname, ' ')))
*ch = '\0';
#ifndef STAGE1_5
if (print_possibilities) {
char entry[128] = {0};
entry_hint_t entry_hint;
if (*(dirname + aal_strlen(dirname) - 1) != '/') {
if (!(ch = aal_strrchr(dirname, '/'))) {
errnum = ERR_BAD_FILETYPE;
return 0;
}
aal_strncpy(entry, ch + 1, sizeof(entry));
*(ch + 1) = '\0';
}
if (!(object = reiser4_object_open(fs, dirname))) {
errnum = ERR_FILE_NOT_FOUND;
return 0;
}
if (object->entity->plugin->h.group != DIRTORY_OBJECT) {
if ((ch = aal_strrchr(dirname, '/')))
*ch = '\0';
return 0;
}
if (reiser4_object_reset(object)) {
reiser4_close();
errnum = ERR_FSYS_CORRUPT;
return 0;
}
while (reiser4_object_readdir(object, &entry_hint) == 0) {
if (substring(entry, entry_hint.name) <= 0) {
if (print_possibilities > 0)
print_possibilities =
-print_possibilities;
print_a_completion(entry_hint.name);
}
}
} else {
#endif
if (!(object = reiser4_object_open(fs, dirname))) {
errnum = ERR_FILE_NOT_FOUND;
return 0;
}
if (object->entity->plugin->h.group != FILE_OBJECT) {
reiser4_close();
errnum = ERR_BAD_FILETYPE;
return 0;
}
filepos = 0;
filemax = reiser4_object_size(object);
return 1;
#ifndef STAGE1_5
}
if (print_possibilities < 0)
return 1;
#endif
errnum = ERR_FILE_NOT_FOUND;
return 0;
}
int reiser4_embed (int *start_sector, int needed_sectors) {
*start_sector = 1;
return needed_sectors <= ((MASTER_OFFSET >> SECTOR_BITS) - 1);
}
#endif /* FSYS_REISER4 */
- Reiser4 and GRUB..., Yury Umanets, 2003/05/22
- Re: Reiser4 and GRUB..., Yoshinori K. Okuji, 2003/05/23
- Re: Reiser4 and GRUB..., Yury Umanets, 2003/05/23
- Re: Reiser4 and GRUB..., Yoshinori K. Okuji, 2003/05/25
- Re: Reiser4 and GRUB..., Yury Umanets, 2003/05/25
- Re: Reiser4 and GRUB..., Yoshinori K. Okuji, 2003/05/25
- Re: Reiser4 and GRUB...,
Yury Umanets <=
- Re: Reiser4 and GRUB..., Yoshinori K. Okuji, 2003/05/27
- Re: Reiser4 and GRUB..., Yury Umanets, 2003/05/28
- Re: Reiser4 and GRUB..., Jochen Hoenicke, 2003/05/28
- Re: Reiser4 and GRUB..., Yury Umanets, 2003/05/28