HGFS tweaks

This commit is contained in:
David van Moolenbroek 2010-01-27 22:59:03 +00:00
parent 6959226707
commit 564e2a4368
6 changed files with 9 additions and 8 deletions

View file

@ -2,7 +2,6 @@
/* Number of inodes. */
/* The following number must not exceed 16. The i_num field is only a short. */
#define NUM_INODE_BITS 8
#define NUM_INODES ((1 << NUM_INODE_BITS) - 1)
/* Number of entries in the name hashtable. */
#define NUM_HASH_SLOTS 1023

View file

@ -18,6 +18,8 @@
#include "inc.h"
PRIVATE struct inode inodes[NUM_INODES];
PRIVATE TAILQ_HEAD(free_head, inode) free_list;
/*===========================================================================*
@ -32,7 +34,7 @@ PUBLIC struct inode *init_inode()
TAILQ_INIT(&free_list);
dprintf(("HGFS: %d inodes, %d bytes each, equals %d bytes\n",
dprintf(("HGFS: %d inodes, %u bytes each, equals %u bytes\n",
NUM_INODES, sizeof(struct inode), sizeof(inodes)));
/* Mark all inodes except the root inode as free. */
@ -69,7 +71,7 @@ ino_t ino_nr;
/* Get an inode based on its inode number. Do not increase its reference count.
*/
struct inode *ino;
unsigned int index;
int index;
/* Inode 0 (= index -1) is not a valid inode number. */
index = INODE_INDEX(ino_nr);

View file

@ -51,7 +51,7 @@
* - A CACHED or FREE inode may be reused for other purposes at any time.
*/
EXTERN struct inode {
struct inode {
struct inode *i_parent; /* parent inode pointer */
LIST_HEAD(child_head, inode) i_child; /* child inode anchor */
LIST_ENTRY(inode) i_next; /* sibling inode chain entry */
@ -66,7 +66,7 @@ EXTERN struct inode {
hgfs_dir_t u_dir; /* handle to open HGFS directory */
} i_u;
char i_name[NAME_MAX+1]; /* entry name in parent directory */
} inodes[NUM_INODES];
};
#define i_free i_u.u_free
#define i_file i_u.u_file

View file

@ -315,7 +315,7 @@ PUBLIC int do_lookup()
assert(r != EENTERMOUNT && r != ESYMLINK);
if (r == ELEAVEMOUNT) {
m_out.RES_OFFSET = (int)(last - buf);
m_out.RES_OFFSET = (int) (last - buf);
m_out.RES_SYMLOOP = 0;
}

View file

@ -23,7 +23,7 @@ PUBLIC int do_readsuper()
int r;
dprintf(("HGFS: readsuper (dev %x, flags %x)\n",
m_in.REQ_DEV, m_in.REQ_FLAGS));
(dev_t) m_in.REQ_DEV, m_in.REQ_FLAGS));
if (m_in.REQ_FLAGS & REQ_ISROOT) {
printf("HGFS: attempt to mount as root device\n");

View file

@ -101,7 +101,7 @@ PUBLIC int do_write()
count = m_in.REQ_NBYTES;
grant = m_in.REQ_GRANT;
if (count <= 0) return EINVAL;
if (count == 0) return EINVAL;
if ((r = write_file(ino, &pos, &count, &grant)) != OK)
return r;