git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: fstat now handle symbolic link
[lunaix-os.git]
/
lunaix-os
/
kernel
/
fs
/
iso9660
/
directory.c
diff --git
a/lunaix-os/kernel/fs/iso9660/directory.c
b/lunaix-os/kernel/fs/iso9660/directory.c
index e1b37894681a46dfcf6bb51ad0e82210c750dea9..9f4d988f8c39606fd7f7e1160ecbff0bbfe433f5 100644
(file)
--- a/
lunaix-os/kernel/fs/iso9660/directory.c
+++ b/
lunaix-os/kernel/fs/iso9660/directory.c
@@
-1,4
+1,3
@@
-#include <lunaix/dirent.h>
#include <lunaix/fs.h>
#include <lunaix/fs/iso9660.h>
#include <lunaix/mm/cake.h>
#include <lunaix/fs.h>
#include <lunaix/fs/iso9660.h>
#include <lunaix/mm/cake.h>
@@
-7,6
+6,8
@@
#include <klibc/string.h>
#include <klibc/string.h>
+#include <usr/lunaix/dirent_defs.h>
+
extern struct cake_pile* drec_cache_pile;
void
extern struct cake_pile* drec_cache_pile;
void
@@
-51,10
+52,12
@@
done:
u32_t l = drec->name.len;
while (l < (u32_t)-1 && drec->name.content[l--] != ';')
;
u32_t l = drec->name.len;
while (l < (u32_t)-1 && drec->name.content[l--] != ';')
;
+
l = (l + 1) ? l : drec->name.len;
l = MIN(l, ISO9660_IDLEN - 1);
l = (l + 1) ? l : drec->name.len;
l = MIN(l, ISO9660_IDLEN - 1);
- strncpy(cache->name_val, drec->name.content, l);
+ strncpy(cache->name_val, (const char*)drec->name.content, l);
+
cache->name = HSTR(cache->name_val, l);
hstr_rehash(&cache->name, HSTR_FULL_HASH);
}
cache->name = HSTR(cache->name_val, l);
hstr_rehash(&cache->name, HSTR_FULL_HASH);
}
@@
-63,26
+66,30
@@
done:
int
iso9660_setup_dnode(struct v_dnode* dnode, struct v_inode* inode)
{
int
iso9660_setup_dnode(struct v_dnode* dnode, struct v_inode* inode)
{
- if (!(inode->itype & VFS_IFDIR)) {
+ if ((inode->itype & F_FILE)) {
+ vfs_assign_inode(dnode, inode);
+ return 0;
+ }
+
+ struct iso_inode* isoino = inode->data;
+ if (!llist_empty(&isoino->drecaches)) {
+ dnode->data = &isoino->drecaches;
vfs_assign_inode(dnode, inode);
return 0;
}
int errno = 0;
struct device* dev = dnode->super_block->dev;
vfs_assign_inode(dnode, inode);
return 0;
}
int errno = 0;
struct device* dev = dnode->super_block->dev;
- struct iso_inode* isoino = inode->data;
- struct llist_header* lead = valloc(sizeof(*lead));
void* records = valloc(ISO9660_BLKSZ);
u32_t current_pos = -ISO9660_BLKSZ, max_pos = inode->fsize,
blk = inode->lb_addr * ISO9660_BLKSZ, blk_offset = (u32_t)-1;
void* records = valloc(ISO9660_BLKSZ);
u32_t current_pos = -ISO9660_BLKSZ, max_pos = inode->fsize,
blk = inode->lb_addr * ISO9660_BLKSZ, blk_offset = (u32_t)-1;
- llist_init_head(lead);
-
// As per 6.8.1, Directory structure shall NOT recorded in interleave mode.
do {
if (blk_offset >= ISO9660_BLKSZ - sizeof(struct iso_drecord)) {
current_pos += ISO9660_BLKSZ;
// As per 6.8.1, Directory structure shall NOT recorded in interleave mode.
do {
if (blk_offset >= ISO9660_BLKSZ - sizeof(struct iso_drecord)) {
current_pos += ISO9660_BLKSZ;
- errno = dev->read(dev, records, blk + current_pos, ISO9660_BLKSZ);
+ errno =
+ dev->ops.read(dev, records, blk + current_pos, ISO9660_BLKSZ);
if (errno < 0) {
errno = EIO;
goto done;
if (errno < 0) {
errno = EIO;
goto done;
@@
-105,13
+112,12
@@
iso9660_setup_dnode(struct v_dnode* dnode, struct v_inode* inode)
struct iso_drecache* cache = cake_grab(drec_cache_pile);
iso9660_fill_drecache(cache, drec, mdu->len);
struct iso_drecache* cache = cake_grab(drec_cache_pile);
iso9660_fill_drecache(cache, drec, mdu->len);
- llist_append(
lead
, &cache->caches);
+ llist_append(
&isoino->drecaches
, &cache->caches);
cont:
blk_offset += mdu->len;
} while (current_pos + blk_offset < max_pos);
cont:
blk_offset += mdu->len;
} while (current_pos + blk_offset < max_pos);
- dnode->data = lead;
- isoino->drecaches = lead;
+ dnode->data = &isoino->drecaches;
vfs_assign_inode(dnode, inode);
vfs_assign_inode(dnode, inode);
@@
-126,10
+132,9
@@
int
iso9660_dir_lookup(struct v_inode* this, struct v_dnode* dnode)
{
struct iso_inode* isoino = this->data;
iso9660_dir_lookup(struct v_inode* this, struct v_dnode* dnode)
{
struct iso_inode* isoino = this->data;
- struct llist_header* lead = isoino->drecaches;
struct iso_drecache *pos, *n;
struct iso_drecache *pos, *n;
- llist_for_each(pos, n,
lead
, caches)
+ llist_for_each(pos, n,
&isoino->drecaches
, caches)
{
if (HSTR_EQ(&dnode->name, &pos->name)) {
goto found;
{
if (HSTR_EQ(&dnode->name, &pos->name)) {
goto found;