summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libfs
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-02-24 20:58:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-02-24 20:58:47 +0000
commit3cf8394af5f646642df593c8de833441e186af64 (patch)
tree879804337835a352853d5eb06d31565d4dba33d7 /c/src/exec/libfs
parentMoved mpc860.h around to make things compile. (diff)
downloadrtems-3cf8394af5f646642df593c8de833441e186af64.tar.bz2
Changed IMFS to use IMFS_NAME_MAX as the maximum length of a basename
rather then NAME_MAX. NAME_MAX is 255 and that lets IMFS chew up memory too fast. Perhaps in the future, the places in IMFS that put a maximum length name string on the stack and the jnode structure does not include a maximu length name string can be fixed so this is not a problem.
Diffstat (limited to 'c/src/exec/libfs')
-rw-r--r--c/src/exec/libfs/src/imfs/imfs.h36
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_creat.c2
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_eval.c4
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_gtkn.c4
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_link.c2
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_mknod.c2
-rw-r--r--c/src/exec/libfs/src/imfs/imfs_symlink.c2
7 files changed, 29 insertions, 23 deletions
diff --git a/c/src/exec/libfs/src/imfs/imfs.h b/c/src/exec/libfs/src/imfs/imfs.h
index e67964971e..0421e9e25c 100644
--- a/c/src/exec/libfs/src/imfs/imfs.h
+++ b/c/src/exec/libfs/src/imfs/imfs.h
@@ -126,25 +126,31 @@ typedef union {
} IMFS_types_union;
/*
+ * Maximum length of a "basename" of an IMFS file/node.
+ */
+
+#define IMFS_NAME_MAX 32
+
+/*
* The control structure for an IMFS jnode.
*/
struct IMFS_jnode_tt {
- Chain_Node Node; /* for chaining them together */
- IMFS_jnode_t *Parent; /* Parent node */
- char name[NAME_MAX+1]; /* "basename" */
- mode_t st_mode; /* File mode */
- nlink_t st_nlink; /* Link count */
- ino_t st_ino; /* inode */
-
- uid_t st_uid; /* User ID of owner */
- gid_t st_gid; /* Group ID of owner */
-
- time_t st_atime; /* Time of last access */
- time_t st_mtime; /* Time of last modification */
- time_t st_ctime; /* Time of last status change */
- IMFS_jnode_types_t type; /* Type of this entry */
- IMFS_types_union info;
+ Chain_Node Node; /* for chaining them together */
+ IMFS_jnode_t *Parent; /* Parent node */
+ char name[IMFS_NAME_MAX+1]; /* "basename" */
+ mode_t st_mode; /* File mode */
+ nlink_t st_nlink; /* Link count */
+ ino_t st_ino; /* inode */
+
+ uid_t st_uid; /* User ID of owner */
+ gid_t st_gid; /* Group ID of owner */
+
+ time_t st_atime; /* Time of last access */
+ time_t st_mtime; /* Time of last modification */
+ time_t st_ctime; /* Time of last status change */
+ IMFS_jnode_types_t type; /* Type of this entry */
+ IMFS_types_union info;
};
#define IMFS_update_atime( _jnode ) \
diff --git a/c/src/exec/libfs/src/imfs/imfs_creat.c b/c/src/exec/libfs/src/imfs/imfs_creat.c
index fd38e7f993..6b638ed07c 100644
--- a/c/src/exec/libfs/src/imfs/imfs_creat.c
+++ b/c/src/exec/libfs/src/imfs/imfs_creat.c
@@ -51,7 +51,7 @@ IMFS_jnode_t *IMFS_create_node(
node->st_nlink = 1;
node->type = type;
- strncpy( node->name, name, NAME_MAX );
+ strncpy( node->name, name, IMFS_NAME_MAX );
/*
* Fill in the mode and permission information for the jnode structure.
diff --git a/c/src/exec/libfs/src/imfs/imfs_eval.c b/c/src/exec/libfs/src/imfs/imfs_eval.c
index d6d444f6d2..e7e2d47908 100644
--- a/c/src/exec/libfs/src/imfs/imfs_eval.c
+++ b/c/src/exec/libfs/src/imfs/imfs_eval.c
@@ -277,7 +277,7 @@ int IMFS_evaluate_for_make(
int i = 0;
int len;
IMFS_token_types type;
- char token[ NAME_MAX + 1 ];
+ char token[ IMFS_NAME_MAX + 1 ];
rtems_filesystem_location_info_t newloc;
IMFS_jnode_t *node;
int done = 0;
@@ -467,7 +467,7 @@ int IMFS_eval_path(
int i = 0;
int len;
IMFS_token_types type = IMFS_CURRENT_DIR;
- char token[ NAME_MAX + 1 ];
+ char token[ IMFS_NAME_MAX + 1 ];
rtems_filesystem_location_info_t newloc;
IMFS_jnode_t *node;
int result;
diff --git a/c/src/exec/libfs/src/imfs/imfs_gtkn.c b/c/src/exec/libfs/src/imfs/imfs_gtkn.c
index 052c67ceba..aa63841725 100644
--- a/c/src/exec/libfs/src/imfs/imfs_gtkn.c
+++ b/c/src/exec/libfs/src/imfs/imfs_gtkn.c
@@ -32,11 +32,11 @@ IMFS_token_types IMFS_get_token(
* Copy a name into token. (Remember NULL is a token.)
*/
- while ( !IMFS_is_separator( path[i] ) && (i <= NAME_MAX) ) {
+ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) {
token[i] = path[i];
- if (i == NAME_MAX)
+ if (i == IMFS_NAME_MAX)
return IMFS_INVALID_TOKEN;
if ( !IMFS_is_valid_name_char( token[i] ) )
diff --git a/c/src/exec/libfs/src/imfs/imfs_link.c b/c/src/exec/libfs/src/imfs/imfs_link.c
index 2232209705..34d277646d 100644
--- a/c/src/exec/libfs/src/imfs/imfs_link.c
+++ b/c/src/exec/libfs/src/imfs/imfs_link.c
@@ -28,7 +28,7 @@ int IMFS_link(
{
IMFS_types_union info;
IMFS_jnode_t *new_node;
- char new_name[ NAME_MAX + 1 ];
+ char new_name[ IMFS_NAME_MAX + 1 ];
int i;
/*
diff --git a/c/src/exec/libfs/src/imfs/imfs_mknod.c b/c/src/exec/libfs/src/imfs/imfs_mknod.c
index d4feef4f36..c8c05b3a26 100644
--- a/c/src/exec/libfs/src/imfs/imfs_mknod.c
+++ b/c/src/exec/libfs/src/imfs/imfs_mknod.c
@@ -35,7 +35,7 @@ int IMFS_mknod(
IMFS_token_types type = 0;
IMFS_jnode_t *new_node;
int result;
- char new_name[ NAME_MAX + 1 ];
+ char new_name[ IMFS_NAME_MAX + 1 ];
IMFS_types_union info;
IMFS_get_token( token, new_name, &result );
diff --git a/c/src/exec/libfs/src/imfs/imfs_symlink.c b/c/src/exec/libfs/src/imfs/imfs_symlink.c
index 0d3ebbd670..36b24fef88 100644
--- a/c/src/exec/libfs/src/imfs/imfs_symlink.c
+++ b/c/src/exec/libfs/src/imfs/imfs_symlink.c
@@ -28,7 +28,7 @@ int IMFS_symlink(
{
IMFS_types_union info;
IMFS_jnode_t *new_node;
- char new_name[ NAME_MAX + 1 ];
+ char new_name[ IMFS_NAME_MAX + 1 ];
int i;
/*