b1d068470b
isofs now uses an in-memory directory listing built on-the-fly instead of parsing the ISO 9660 data structures over and over for almost every request. This yields huge performance improvements. The directory listing is allocated dynamically, but Minix servers aren't normally supposed to do that because critical servers would crash if the system runs out of memory. isofs is quite frugal, won't allocate memory after having the whole directory tree cached and is not that critical (its most important job is to serve as a root file system during installation). The benefits and elegance of this scheme far outweights this small problem in practice. Change-Id: I13d070388c07d274cbee0645cbc50295c447c5b6
25 lines
487 B
C
25 lines
487 B
C
#include "inc.h"
|
|
|
|
ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes)
|
|
{
|
|
struct inode *i_node;
|
|
size_t len = 0;
|
|
int r;
|
|
|
|
/* Try to get inode according to its index */
|
|
if ((i_node = get_inode(ino_nr)) == NULL)
|
|
return EINVAL; /* no inode found */
|
|
|
|
if (!S_ISLNK(i_node->i_stat.st_mode))
|
|
return EACCES;
|
|
|
|
len = strlen(i_node->s_name);
|
|
if (len > bytes)
|
|
len = bytes;
|
|
|
|
if ((r = fsdriver_copyout(data, 0, i_node->s_name, len)) != OK)
|
|
return r;
|
|
|
|
return len;
|
|
}
|