]> git.proxmox.com Git - grub2.git/blob - grub-core/fs/sfs.c
90f7fb3791868b810cc2c3815ed45330775602fa
[grub2.git] / grub-core / fs / sfs.c
1 /* sfs.c - Amiga Smart FileSystem. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
5 *
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <grub/err.h>
21 #include <grub/file.h>
22 #include <grub/mm.h>
23 #include <grub/misc.h>
24 #include <grub/disk.h>
25 #include <grub/dl.h>
26 #include <grub/types.h>
27 #include <grub/fshelp.h>
28 #include <grub/charset.h>
29
30 GRUB_MOD_LICENSE ("GPLv3+");
31
32 /* The common header for a block. */
33 struct grub_sfs_bheader
34 {
35 grub_uint8_t magic[4];
36 grub_uint32_t chksum;
37 grub_uint32_t ipointtomyself;
38 } GRUB_PACKED;
39
40 /* The sfs rootblock. */
41 struct grub_sfs_rblock
42 {
43 struct grub_sfs_bheader header;
44 grub_uint32_t version;
45 grub_uint32_t createtime;
46 grub_uint8_t flags;
47 grub_uint8_t unused1[31];
48 grub_uint32_t blocksize;
49 grub_uint8_t unused2[40];
50 grub_uint8_t unused3[8];
51 grub_uint32_t rootobject;
52 grub_uint32_t btree;
53 } GRUB_PACKED;
54
55 enum
56 {
57 FLAGS_CASE_SENSITIVE = 0x80
58 };
59
60 /* A SFS object container. */
61 struct grub_sfs_obj
62 {
63 grub_uint8_t unused1[4];
64 grub_uint32_t nodeid;
65 grub_uint8_t unused2[4];
66 union
67 {
68 struct
69 {
70 grub_uint32_t first_block;
71 grub_uint32_t size;
72 } GRUB_PACKED file;
73 struct
74 {
75 grub_uint32_t hashtable;
76 grub_uint32_t dir_objc;
77 } GRUB_PACKED dir;
78 } file_dir;
79 grub_uint32_t mtime;
80 grub_uint8_t type;
81 grub_uint8_t filename[1];
82 grub_uint8_t comment[1];
83 } GRUB_PACKED;
84
85 #define GRUB_SFS_TYPE_DELETED 32
86 #define GRUB_SFS_TYPE_SYMLINK 64
87 #define GRUB_SFS_TYPE_DIR 128
88
89 /* A SFS object container. */
90 struct grub_sfs_objc
91 {
92 struct grub_sfs_bheader header;
93 grub_uint32_t parent;
94 grub_uint32_t next;
95 grub_uint32_t prev;
96 /* The amount of objects depends on the blocksize. */
97 struct grub_sfs_obj objects[1];
98 } GRUB_PACKED;
99
100 struct grub_sfs_btree_node
101 {
102 grub_uint32_t key;
103 grub_uint32_t data;
104 } GRUB_PACKED;
105
106 struct grub_sfs_btree_extent
107 {
108 grub_uint32_t key;
109 grub_uint32_t next;
110 grub_uint32_t prev;
111 grub_uint16_t size;
112 } GRUB_PACKED;
113
114 struct grub_sfs_btree
115 {
116 struct grub_sfs_bheader header;
117 grub_uint16_t nodes;
118 grub_uint8_t leaf;
119 grub_uint8_t nodesize;
120 /* Normally this can be kind of node, but just extents are
121 supported. */
122 struct grub_sfs_btree_node node[1];
123 } GRUB_PACKED;
124
125 \f
126
127 struct cache_entry
128 {
129 grub_uint32_t off;
130 grub_uint32_t block;
131 };
132
133 struct grub_fshelp_node
134 {
135 struct grub_sfs_data *data;
136 grub_uint32_t block;
137 grub_uint32_t size;
138 grub_uint32_t mtime;
139 grub_uint32_t cache_off;
140 grub_uint32_t next_extent;
141 grub_size_t cache_allocated;
142 grub_size_t cache_size;
143 struct cache_entry *cache;
144 };
145
146 /* Information about a "mounted" sfs filesystem. */
147 struct grub_sfs_data
148 {
149 struct grub_sfs_rblock rblock;
150 struct grub_fshelp_node diropen;
151 grub_disk_t disk;
152
153 /* Log of blocksize in sectors. */
154 int log_blocksize;
155
156 int fshelp_flags;
157
158 /* Label of the filesystem. */
159 char *label;
160 };
161
162 static grub_dl_t my_mod;
163
164 \f
165 /* Lookup the extent starting with BLOCK in the filesystem described
166 by DATA. Return the extent size in SIZE and the following extent
167 in NEXTEXT. */
168 static grub_err_t
169 grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
170 grub_uint32_t *size, grub_uint32_t *nextext)
171 {
172 char *treeblock;
173 struct grub_sfs_btree *tree;
174 int i;
175 grub_uint32_t next;
176 grub_size_t blocksize = GRUB_DISK_SECTOR_SIZE << data->log_blocksize;
177
178 treeblock = grub_malloc (blocksize);
179 if (!treeblock)
180 return grub_errno;
181
182 next = grub_be_to_cpu32 (data->rblock.btree);
183 tree = (struct grub_sfs_btree *) treeblock;
184
185 /* Handle this level in the btree. */
186 do
187 {
188 grub_uint16_t nnodes;
189 grub_disk_read (data->disk,
190 ((grub_disk_addr_t) next) << data->log_blocksize,
191 0, blocksize, treeblock);
192 if (grub_errno)
193 {
194 grub_free (treeblock);
195 return grub_errno;
196 }
197
198 nnodes = grub_be_to_cpu16 (tree->nodes);
199 if (nnodes * (grub_uint32_t) (tree)->nodesize > blocksize)
200 break;
201
202 for (i = (int) nnodes - 1; i >= 0; i--)
203 {
204
205 #define EXTNODE(tree, index) \
206 ((struct grub_sfs_btree_node *) (((char *) &(tree)->node[0]) \
207 + (index) * (tree)->nodesize))
208
209 /* Follow the tree down to the leaf level. */
210 if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) <= block)
211 && !tree->leaf)
212 {
213 next = grub_be_to_cpu32 (EXTNODE (tree, i)->data);
214 break;
215 }
216
217 /* If the leaf level is reached, just find the correct extent. */
218 if (grub_be_to_cpu32 (EXTNODE (tree, i)->key) == block && tree->leaf)
219 {
220 struct grub_sfs_btree_extent *extent;
221 extent = (struct grub_sfs_btree_extent *) EXTNODE (tree, i);
222
223 /* We found a correct leaf. */
224 *size = grub_be_to_cpu16 (extent->size);
225 *nextext = grub_be_to_cpu32 (extent->next);
226
227 grub_free (treeblock);
228 return 0;
229 }
230
231 #undef EXTNODE
232
233 }
234 } while (!tree->leaf);
235
236 grub_free (treeblock);
237
238 return grub_error (GRUB_ERR_FILE_READ_ERROR, "SFS extent not found");
239 }
240
241 static grub_disk_addr_t
242 grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
243 {
244 grub_uint32_t blk;
245 grub_uint32_t size = 0;
246 grub_uint32_t next = 0;
247 grub_disk_addr_t off;
248 struct grub_sfs_data *data = node->data;
249
250 /* In case of the first block we don't have to lookup the
251 extent, the minimum size is always 1. */
252 if (fileblock == 0)
253 return node->block;
254
255 if (!node->cache)
256 {
257 grub_size_t cache_size;
258 /* Assume half-max extents (32768 sectors). */
259 cache_size = ((node->size >> (data->log_blocksize + GRUB_DISK_SECTOR_BITS
260 + 15))
261 + 3);
262 if (cache_size < 8)
263 cache_size = 8;
264
265 node->cache_off = 0;
266 node->next_extent = node->block;
267 node->cache_size = 0;
268
269 node->cache = grub_calloc (cache_size, sizeof (node->cache[0]));
270 if (!node->cache)
271 {
272 grub_errno = 0;
273 node->cache_allocated = 0;
274 }
275 else
276 {
277 node->cache_allocated = cache_size;
278 node->cache[0].off = 0;
279 node->cache[0].block = node->block;
280 }
281 }
282
283 if (fileblock < node->cache_off)
284 {
285 unsigned int i = 0;
286 int j, lg;
287 for (lg = 0; node->cache_size >> lg; lg++);
288
289 for (j = lg - 1; j >= 0; j--)
290 if ((i | (1 << j)) < node->cache_size
291 && node->cache[(i | (1 << j))].off <= fileblock)
292 i |= (1 << j);
293 return node->cache[i].block + fileblock - node->cache[i].off;
294 }
295
296 off = node->cache_off;
297 blk = node->next_extent;
298
299 while (blk)
300 {
301 grub_err_t err;
302
303 err = grub_sfs_read_extent (node->data, blk, &size, &next);
304 if (err)
305 return 0;
306
307 if (node->cache && node->cache_size >= node->cache_allocated)
308 {
309 struct cache_entry *e = node->cache;
310 e = grub_realloc (node->cache,node->cache_allocated * 2
311 * sizeof (e[0]));
312 if (!e)
313 {
314 grub_errno = 0;
315 grub_free (node->cache);
316 node->cache = 0;
317 }
318 else
319 {
320 node->cache_allocated *= 2;
321 node->cache = e;
322 }
323 }
324
325 if (node->cache)
326 {
327 node->cache_off = off + size;
328 node->next_extent = next;
329 node->cache[node->cache_size].off = off;
330 node->cache[node->cache_size].block = blk;
331 node->cache_size++;
332 }
333
334 if (fileblock - off < size)
335 return fileblock - off + blk;
336
337 off += size;
338
339 blk = next;
340 }
341
342 grub_error (GRUB_ERR_FILE_READ_ERROR,
343 "reading a SFS block outside the extent");
344
345 return 0;
346 }
347
348
349 /* Read LEN bytes from the file described by DATA starting with byte
350 POS. Return the amount of read bytes in READ. */
351 static grub_ssize_t
352 grub_sfs_read_file (grub_fshelp_node_t node,
353 grub_disk_read_hook_t read_hook, void *read_hook_data,
354 grub_off_t pos, grub_size_t len, char *buf)
355 {
356 return grub_fshelp_read_file (node->data->disk, node,
357 read_hook, read_hook_data,
358 pos, len, buf, grub_sfs_read_block,
359 node->size, node->data->log_blocksize, 0);
360 }
361
362
363 static struct grub_sfs_data *
364 grub_sfs_mount (grub_disk_t disk)
365 {
366 struct grub_sfs_data *data;
367 struct grub_sfs_objc *rootobjc;
368 char *rootobjc_data = 0;
369 grub_uint32_t blk;
370
371 data = grub_malloc (sizeof (*data));
372 if (!data)
373 return 0;
374
375 /* Read the rootblock. */
376 grub_disk_read (disk, 0, 0, sizeof (struct grub_sfs_rblock),
377 &data->rblock);
378 if (grub_errno)
379 goto fail;
380
381 /* Make sure this is a sfs filesystem. */
382 if (grub_strncmp ((char *) (data->rblock.header.magic), "SFS", 4)
383 || data->rblock.blocksize == 0
384 || (data->rblock.blocksize & (data->rblock.blocksize - 1)) != 0
385 || (data->rblock.blocksize & grub_cpu_to_be32_compile_time (0xf00001ff)))
386 {
387 grub_error (GRUB_ERR_BAD_FS, "not a SFS filesystem");
388 goto fail;
389 }
390
391 for (data->log_blocksize = 9;
392 (1U << data->log_blocksize) < grub_be_to_cpu32 (data->rblock.blocksize);
393 data->log_blocksize++);
394 data->log_blocksize -= GRUB_DISK_SECTOR_BITS;
395 if (data->rblock.flags & FLAGS_CASE_SENSITIVE)
396 data->fshelp_flags = 0;
397 else
398 data->fshelp_flags = GRUB_FSHELP_CASE_INSENSITIVE;
399 rootobjc_data = grub_malloc (GRUB_DISK_SECTOR_SIZE << data->log_blocksize);
400 if (! rootobjc_data)
401 goto fail;
402
403 /* Read the root object container. */
404 grub_disk_read (disk, ((grub_disk_addr_t) grub_be_to_cpu32 (data->rblock.rootobject))
405 << data->log_blocksize, 0,
406 GRUB_DISK_SECTOR_SIZE << data->log_blocksize, rootobjc_data);
407 if (grub_errno)
408 goto fail;
409
410 rootobjc = (struct grub_sfs_objc *) rootobjc_data;
411
412 blk = grub_be_to_cpu32 (rootobjc->objects[0].file_dir.dir.dir_objc);
413 data->diropen.size = 0;
414 data->diropen.block = blk;
415 data->diropen.data = data;
416 data->diropen.cache = 0;
417 data->disk = disk;
418 data->label = grub_strdup ((char *) (rootobjc->objects[0].filename));
419
420 grub_free (rootobjc_data);
421 return data;
422
423 fail:
424 if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
425 grub_error (GRUB_ERR_BAD_FS, "not an SFS filesystem");
426
427 grub_free (data);
428 grub_free (rootobjc_data);
429 return 0;
430 }
431
432
433 static char *
434 grub_sfs_read_symlink (grub_fshelp_node_t node)
435 {
436 struct grub_sfs_data *data = node->data;
437 char *symlink;
438 char *block;
439
440 block = grub_malloc (GRUB_DISK_SECTOR_SIZE << data->log_blocksize);
441 if (!block)
442 return 0;
443
444 grub_disk_read (data->disk, ((grub_disk_addr_t) node->block)
445 << data->log_blocksize,
446 0, GRUB_DISK_SECTOR_SIZE << data->log_blocksize, block);
447 if (grub_errno)
448 {
449 grub_free (block);
450 return 0;
451 }
452
453 /* This is just a wild guess, but it always worked for me. How the
454 SLNK block looks like is not documented in the SFS docs. */
455 symlink = grub_malloc (((GRUB_DISK_SECTOR_SIZE << data->log_blocksize)
456 - 24) * GRUB_MAX_UTF8_PER_LATIN1 + 1);
457 if (!symlink)
458 {
459 grub_free (block);
460 return 0;
461 }
462 *grub_latin1_to_utf8 ((grub_uint8_t *) symlink, (grub_uint8_t *) &block[24],
463 (GRUB_DISK_SECTOR_SIZE << data->log_blocksize) - 24) = '\0';
464 grub_free (block);
465 return symlink;
466 }
467
468 /* Helper for grub_sfs_iterate_dir. */
469 static int
470 grub_sfs_create_node (struct grub_fshelp_node **node,
471 struct grub_sfs_data *data,
472 const char *name,
473 grub_uint32_t block, grub_uint32_t size, int type,
474 grub_uint32_t mtime,
475 grub_fshelp_iterate_dir_hook_t hook, void *hook_data)
476 {
477 grub_size_t len = grub_strlen (name);
478 grub_uint8_t *name_u8;
479 int ret;
480 *node = grub_malloc (sizeof (**node));
481 if (!*node)
482 return 1;
483 name_u8 = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1);
484 if (!name_u8)
485 {
486 grub_free (*node);
487 return 1;
488 }
489
490 (*node)->data = data;
491 (*node)->size = size;
492 (*node)->block = block;
493 (*node)->mtime = mtime;
494 (*node)->cache = 0;
495 (*node)->cache_off = 0;
496 (*node)->next_extent = block;
497 (*node)->cache_size = 0;
498 (*node)->cache_allocated = 0;
499
500 *grub_latin1_to_utf8 (name_u8, (const grub_uint8_t *) name, len) = '\0';
501
502 ret = hook ((char *) name_u8, type | data->fshelp_flags, *node, hook_data);
503 grub_free (name_u8);
504 return ret;
505 }
506
507 static int
508 grub_sfs_iterate_dir (grub_fshelp_node_t dir,
509 grub_fshelp_iterate_dir_hook_t hook, void *hook_data)
510 {
511 struct grub_fshelp_node *node = 0;
512 struct grub_sfs_data *data = dir->data;
513 char *objc_data;
514 struct grub_sfs_objc *objc;
515 unsigned int next = dir->block;
516 grub_uint32_t pos;
517
518 objc_data = grub_malloc (GRUB_DISK_SECTOR_SIZE << data->log_blocksize);
519 if (!objc_data)
520 goto fail;
521
522 /* The Object container can consist of multiple blocks, iterate over
523 every block. */
524 while (next)
525 {
526 grub_disk_read (data->disk, ((grub_disk_addr_t) next)
527 << data->log_blocksize, 0,
528 GRUB_DISK_SECTOR_SIZE << data->log_blocksize, objc_data);
529 if (grub_errno)
530 goto fail;
531
532 objc = (struct grub_sfs_objc *) objc_data;
533
534 pos = (char *) &objc->objects[0] - (char *) objc;
535
536 /* Iterate over all entries in this block. */
537 while (pos + sizeof (struct grub_sfs_obj)
538 < (1U << (GRUB_DISK_SECTOR_BITS + data->log_blocksize)))
539 {
540 struct grub_sfs_obj *obj;
541 obj = (struct grub_sfs_obj *) ((char *) objc + pos);
542 const char *filename = (const char *) obj->filename;
543 grub_size_t len;
544 enum grub_fshelp_filetype type;
545 grub_uint32_t block;
546
547 /* The filename and comment dynamically increase the size of
548 the object. */
549 len = grub_strlen (filename);
550 len += grub_strlen (filename + len + 1);
551
552 pos += sizeof (*obj) + len;
553 /* Round up to a multiple of two bytes. */
554 pos = ((pos + 1) >> 1) << 1;
555
556 if (filename[0] == 0)
557 continue;
558
559 /* First check if the file was not deleted. */
560 if (obj->type & GRUB_SFS_TYPE_DELETED)
561 continue;
562 else if (obj->type & GRUB_SFS_TYPE_SYMLINK)
563 type = GRUB_FSHELP_SYMLINK;
564 else if (obj->type & GRUB_SFS_TYPE_DIR)
565 type = GRUB_FSHELP_DIR;
566 else
567 type = GRUB_FSHELP_REG;
568
569 if (type == GRUB_FSHELP_DIR)
570 block = grub_be_to_cpu32 (obj->file_dir.dir.dir_objc);
571 else
572 block = grub_be_to_cpu32 (obj->file_dir.file.first_block);
573
574 if (grub_sfs_create_node (&node, data, filename, block,
575 grub_be_to_cpu32 (obj->file_dir.file.size),
576 type, grub_be_to_cpu32 (obj->mtime),
577 hook, hook_data))
578 {
579 grub_free (objc_data);
580 return 1;
581 }
582 }
583
584 next = grub_be_to_cpu32 (objc->next);
585 }
586
587 fail:
588 grub_free (objc_data);
589 return 0;
590 }
591
592
593 /* Open a file named NAME and initialize FILE. */
594 static grub_err_t
595 grub_sfs_open (struct grub_file *file, const char *name)
596 {
597 struct grub_sfs_data *data;
598 struct grub_fshelp_node *fdiro = 0;
599
600 grub_dl_ref (my_mod);
601
602 data = grub_sfs_mount (file->device->disk);
603 if (!data)
604 goto fail;
605
606 grub_fshelp_find_file (name, &data->diropen, &fdiro, grub_sfs_iterate_dir,
607 grub_sfs_read_symlink, GRUB_FSHELP_REG);
608 if (grub_errno)
609 goto fail;
610
611 file->size = fdiro->size;
612 data->diropen = *fdiro;
613 grub_free (fdiro);
614
615 file->data = data;
616 file->offset = 0;
617
618 return 0;
619
620 fail:
621 if (data && fdiro != &data->diropen)
622 grub_free (fdiro);
623 if (data)
624 grub_free (data->label);
625 grub_free (data);
626
627 grub_dl_unref (my_mod);
628
629 return grub_errno;
630 }
631
632
633 static grub_err_t
634 grub_sfs_close (grub_file_t file)
635 {
636 struct grub_sfs_data *data = (struct grub_sfs_data *) file->data;
637
638 grub_free (data->diropen.cache);
639 grub_free (data->label);
640 grub_free (data);
641
642 grub_dl_unref (my_mod);
643
644 return GRUB_ERR_NONE;
645 }
646
647
648 /* Read LEN bytes data from FILE into BUF. */
649 static grub_ssize_t
650 grub_sfs_read (grub_file_t file, char *buf, grub_size_t len)
651 {
652 struct grub_sfs_data *data = (struct grub_sfs_data *) file->data;
653
654 return grub_sfs_read_file (&data->diropen,
655 file->read_hook, file->read_hook_data,
656 file->offset, len, buf);
657 }
658
659
660 /* Context for grub_sfs_dir. */
661 struct grub_sfs_dir_ctx
662 {
663 grub_fs_dir_hook_t hook;
664 void *hook_data;
665 };
666
667 /* Helper for grub_sfs_dir. */
668 static int
669 grub_sfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
670 grub_fshelp_node_t node, void *data)
671 {
672 struct grub_sfs_dir_ctx *ctx = data;
673 struct grub_dirhook_info info;
674
675 grub_memset (&info, 0, sizeof (info));
676 info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
677 info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
678 info.mtimeset = 1;
679 grub_free (node->cache);
680 grub_free (node);
681 return ctx->hook (filename, &info, ctx->hook_data);
682 }
683
684 static grub_err_t
685 grub_sfs_dir (grub_device_t device, const char *path,
686 grub_fs_dir_hook_t hook, void *hook_data)
687 {
688 struct grub_sfs_dir_ctx ctx = { hook, hook_data };
689 struct grub_sfs_data *data = 0;
690 struct grub_fshelp_node *fdiro = 0;
691
692 grub_dl_ref (my_mod);
693
694 data = grub_sfs_mount (device->disk);
695 if (!data)
696 goto fail;
697
698 grub_fshelp_find_file (path, &data->diropen, &fdiro, grub_sfs_iterate_dir,
699 grub_sfs_read_symlink, GRUB_FSHELP_DIR);
700 if (grub_errno)
701 goto fail;
702
703 grub_sfs_iterate_dir (fdiro, grub_sfs_dir_iter, &ctx);
704
705 fail:
706 if (data && fdiro != &data->diropen)
707 grub_free (fdiro);
708 if (data)
709 grub_free (data->label);
710 grub_free (data);
711
712 grub_dl_unref (my_mod);
713
714 return grub_errno;
715 }
716
717
718 static grub_err_t
719 grub_sfs_label (grub_device_t device, char **label)
720 {
721 struct grub_sfs_data *data;
722 grub_disk_t disk = device->disk;
723
724 data = grub_sfs_mount (disk);
725 if (data)
726 {
727 grub_size_t len = grub_strlen (data->label);
728 *label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1);
729 if (*label)
730 *grub_latin1_to_utf8 ((grub_uint8_t *) *label,
731 (const grub_uint8_t *) data->label,
732 len) = '\0';
733 grub_free (data->label);
734 }
735 grub_free (data);
736
737 return grub_errno;
738 }
739
740 \f
741 static struct grub_fs grub_sfs_fs =
742 {
743 .name = "sfs",
744 .fs_dir = grub_sfs_dir,
745 .fs_open = grub_sfs_open,
746 .fs_read = grub_sfs_read,
747 .fs_close = grub_sfs_close,
748 .fs_label = grub_sfs_label,
749 #ifdef GRUB_UTIL
750 .reserved_first_sector = 0,
751 .blocklist_install = 1,
752 #endif
753 .next = 0
754 };
755
756 GRUB_MOD_INIT(sfs)
757 {
758 grub_fs_register (&grub_sfs_fs);
759 my_mod = mod;
760 }
761
762 GRUB_MOD_FINI(sfs)
763 {
764 grub_fs_unregister (&grub_sfs_fs);
765 }