/* 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
#include "inc.h"
+PRIVATE struct inode inodes[NUM_INODES];
+
PRIVATE TAILQ_HEAD(free_head, inode) free_list;
/*===========================================================================*
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. */
/* 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);
* - 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 */
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
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;
}
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");
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;