1 |
/* Directory management routines |
/* Directory management routines |
2 |
Copyright (C) 1994,95,96,97,98,99,2000 Free Software Foundation, Inc. |
Copyright (C) 1994,95,96,97,98,99,2000,02 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 |
379 |
|| DIRSIZ (DIRECT_NAMLEN (entry)) > read_disk_entry (entry->d_reclen) |
|| DIRSIZ (DIRECT_NAMLEN (entry)) > read_disk_entry (entry->d_reclen) |
380 |
|| memchr (entry->d_name, '\0', DIRECT_NAMLEN (entry))) |
|| memchr (entry->d_name, '\0', DIRECT_NAMLEN (entry))) |
381 |
{ |
{ |
382 |
fprintf (stderr, "Bad directory entry: inode: %d offset: %d\n", |
fprintf (stderr, "Bad directory entry: inode: %d offset: %zd\n", |
383 |
dp->dn->number, currentoff - blockaddr + idx * DIRBLKSIZ); |
dp->dn->number, currentoff - blockaddr + idx * DIRBLKSIZ); |
384 |
return ENOENT; |
return ENOENT; |
385 |
} |
} |
729 |
struct protid *cred) |
struct protid *cred) |
730 |
{ |
{ |
731 |
struct directory_entry *entry; |
struct directory_entry *entry; |
732 |
int curoff; |
vm_address_t buf, curoff; |
|
vm_address_t buf; |
|
733 |
memory_object_t memobj; |
memory_object_t memobj; |
734 |
error_t err; |
error_t err; |
735 |
|
|
797 |
static error_t |
static error_t |
798 |
count_dirents (struct node *dp, int nb, char *buf) |
count_dirents (struct node *dp, int nb, char *buf) |
799 |
{ |
{ |
800 |
int amt; |
size_t amt; |
801 |
char *offinblk; |
char *offinblk; |
802 |
struct directory_entry *entry; |
struct directory_entry *entry; |
803 |
int count = 0; |
int count = 0; |
832 |
int entry, |
int entry, |
833 |
int nentries, |
int nentries, |
834 |
char **data, |
char **data, |
835 |
u_int *datacnt, |
size_t *datacnt, |
836 |
vm_size_t bufsiz, |
vm_size_t bufsiz, |
837 |
int *amt) |
int *amt) |
838 |
{ |
{ |
847 |
char *datap; |
char *datap; |
848 |
struct directory_entry *entryp; |
struct directory_entry *entryp; |
849 |
int allocsize; |
int allocsize; |
850 |
int checklen; |
size_t checklen; |
851 |
struct dirent *userp; |
struct dirent *userp; |
852 |
|
|
853 |
nblks = dp->dn_stat.st_size/DIRBLKSIZ; |
nblks = dp->dn_stat.st_size/DIRBLKSIZ; |