1 |
/* libdiskfs implementation of fs.defs: file_get_translator |
/* libdiskfs implementation of fs.defs: file_get_translator |
2 |
Copyright (C) 1992,93,94,95,96,98,99 Free Software Foundation, Inc. |
Copyright (C) 1992,93,94,95,96,98,99,2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
5 |
modify it under the terms of the GNU General Public License as |
modify it under the terms of the GNU General Public License as |
25 |
kern_return_t |
kern_return_t |
26 |
diskfs_S_file_get_translator (struct protid *cred, |
diskfs_S_file_get_translator (struct protid *cred, |
27 |
char **trans, |
char **trans, |
28 |
u_int *translen) |
size_t *translen) |
29 |
{ |
{ |
30 |
struct node *np; |
struct node *np; |
31 |
error_t error = 0; |
error_t error = 0; |
41 |
if (S_ISLNK (np->dn_stat.st_mode)) |
if (S_ISLNK (np->dn_stat.st_mode)) |
42 |
{ |
{ |
43 |
unsigned int len = sizeof _HURD_SYMLINK + np->dn_stat.st_size + 1; |
unsigned int len = sizeof _HURD_SYMLINK + np->dn_stat.st_size + 1; |
44 |
int amt; |
size_t amt; |
45 |
assert (diskfs_shortcut_symlink); |
assert (diskfs_shortcut_symlink); |
46 |
if (len > *translen) |
if (len > *translen) |
47 |
*trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); |
*trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); |
107 |
|
|
108 |
len = sizeof _HURD_IFSOCK; |
len = sizeof _HURD_IFSOCK; |
109 |
if (len > *translen) |
if (len > *translen) |
110 |
*trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); |
*trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); |
111 |
bcopy (_HURD_IFSOCK, *trans, sizeof _HURD_IFSOCK); |
bcopy (_HURD_IFSOCK, *trans, sizeof _HURD_IFSOCK); |
112 |
*translen = len; |
*translen = len; |
113 |
error = 0; |
error = 0; |