summaryrefslogtreecommitdiff
path: root/isofs/inode.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-09-04 18:30:17 +0000
committerRoland McGrath <roland@gnu.org>1998-09-04 18:30:17 +0000
commit8dcc9c154da590698944e05e153a9f22a9f45e3a (patch)
treeffcf6ae45b2eb15030e1f60cdf1ec8d4d39c448d /isofs/inode.c
parent364131321985116d2b924cadb329d0512a2e90f6 (diff)
1998-09-04 Roland McGrath <roland@baalperazim.frob.com>
* lookup.c (diskfs_lookup_hard): Fix defn with `const'. (diskfs_direnter_hard): Likewise. (diskfs_get_directs): Use `const' for local var NAME. * inode.c (diskfs_set_translator): Fix defn with `const'.
Diffstat (limited to 'isofs/inode.c')
-rw-r--r--isofs/inode.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/isofs/inode.c b/isofs/inode.c
index 29f35233..c2e29e4b 100644
--- a/isofs/inode.c
+++ b/isofs/inode.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1997 Free Software Foundation, Inc.
+/*
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Thomas Bushnell, n/BSG.
This file is part of the GNU Hurd.
@@ -39,7 +39,7 @@ struct node_cache
struct dirrect *dr; /* somewhere in disk_image */
off_t file_start; /* UNIQUE start of file */
-
+
struct node *np; /* if live */
};
@@ -48,9 +48,9 @@ static int node_cache_alloced = 0;
struct node_cache *node_cache = 0;
/* Forward */
-static error_t read_disknode (struct node *,
+static error_t read_disknode (struct node *,
struct dirrect *, struct rrip_lookup *);
-
+
/* See if node with file start FILE_START is in the cache. If so,
return it, with one additional reference. diskfs_node_refcnt_lock must
@@ -86,7 +86,7 @@ cache_inode (struct dirrect *dr, struct node *np)
for (i = 0; i < node_cache_size; i++)
if (node_cache[i].file_start == np->dn->file_start)
break;
-
+
if (i == node_cache_size)
{
if (node_cache_size >= node_cache_alloced)
@@ -100,7 +100,7 @@ cache_inode (struct dirrect *dr, struct node *np)
else
{
node_cache_alloced *= 2;
- node_cache = realloc (node_cache,
+ node_cache = realloc (node_cache,
sizeof (struct node_cache)
* node_cache_alloced);
}
@@ -108,7 +108,7 @@ cache_inode (struct dirrect *dr, struct node *np)
}
node_cache_size++;
}
-
+
c = &node_cache[i];
c->dr = dr;
c->file_start = np->dn->file_start;
@@ -134,7 +134,7 @@ diskfs_cached_lookup (int id, struct node **npp)
assert (id < node_cache_size);
np = node_cache[id].np;
-
+
if (!np)
{
struct node_cache *c = &node_cache[id];
@@ -142,7 +142,7 @@ diskfs_cached_lookup (int id, struct node **npp)
struct disknode *dn;
rrip_lookup (node_cache[id].dr, &rr, 1);
-
+
/* We should never cache the wrong directory entry */
assert (!(rr.valid & VALID_CL));
@@ -154,7 +154,7 @@ diskfs_cached_lookup (int id, struct node **npp)
mutex_lock (&np->lock);
c->np = np;
spin_unlock (&diskfs_node_refcnt_lock);
-
+
err = read_disknode (np, node_cache[id].dr, &rr);
if (!err)
*npp = np;
@@ -164,7 +164,7 @@ diskfs_cached_lookup (int id, struct node **npp)
return err;
}
-
+
np->references++;
spin_unlock (&diskfs_node_refcnt_lock);
mutex_lock (&np->lock);
@@ -192,7 +192,7 @@ isodate_915 (char *c, struct timespec *ts)
tm.tm_isdst = 0;
ts->tv_sec = timegm (&tm);
ts->tv_nsec = 0;
-
+
/* Only honor TZ offset if it makes sense */
if (-48 <= tz && tz <= 52)
ts->tv_sec -= 15 * 60 * tz; /* TZ is in fifteen minute chunks */
@@ -208,7 +208,7 @@ isodate_84261 (char *c, struct timespec *ts)
int hsec;
signed char tz;
- sscanf (c, "%4d%2d%2d%2d%2d%2d%2d",
+ sscanf (c, "%4d%2d%2d%2d%2d%2d%2d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
&tm.tm_hour, &tm.tm_min, &tm.tm_sec,
&hsec);
@@ -217,10 +217,10 @@ isodate_84261 (char *c, struct timespec *ts)
ts->tv_nsec = hsec * 10000000;
tm.tm_year -= 1900;
tm.tm_mon--;
-
+
tm.tm_isdst = 0;
ts->tv_sec = timegm (&tm);
-
+
tz = c[16];
/* Only honor TZ offset if it makes sense */
@@ -249,7 +249,7 @@ calculate_file_start (struct dirrect *record, off_t *file_start,
err = diskfs_catch_exception ();
if (err)
return err;
-
+
*file_start = ((isonum_733 (record->extent) + record->ext_attr_len)
* (logical_block_size / store->block_size));
@@ -262,14 +262,14 @@ calculate_file_start (struct dirrect *record, off_t *file_start,
/* Load the inode with directory entry RECORD and cached Rock-Rodge info RR
into NP. The directory entry is at OFFSET in BLOCK. */
error_t
-load_inode (struct node **npp, struct dirrect *record,
+load_inode (struct node **npp, struct dirrect *record,
struct rrip_lookup *rr)
{
error_t err;
off_t file_start;
struct disknode *dn;
struct node *np;
-
+
err = calculate_file_start (record, &file_start, rr);
if (err)
return err;
@@ -277,12 +277,12 @@ load_inode (struct node **npp, struct dirrect *record,
record = rr->realdirent;
spin_lock (&diskfs_node_refcnt_lock);
-
+
/* First check the cache */
inode_cache_find (file_start, npp);
if (*npp)
return 0;
-
+
/* Create a new node */
dn = malloc (sizeof (struct disknode));
dn->fileinfo = 0;
@@ -294,7 +294,7 @@ load_inode (struct node **npp, struct dirrect *record,
cache_inode (record, np);
spin_unlock (&diskfs_node_refcnt_lock);
-
+
err = read_disknode (np, record, rr);
*npp = np;
return err;
@@ -309,13 +309,13 @@ read_disknode (struct node *np, struct dirrect *dr,
{
error_t err;
struct stat *st = &np->dn_stat;
-
+
st->st_fstype = 9660; /* xxx */
st->st_fsid = getpid ();
st->st_ino = np->dn->file_start;
st->st_gen = 0;
st->st_rdev = 0;
-
+
err = diskfs_catch_exception ();
if (err)
return err;
@@ -334,7 +334,7 @@ read_disknode (struct node *np, struct dirrect *dr,
{
/* If there are no periods, it's a directory. */
if (((rl->valid & VALID_NM) && !index (rl->name, '.'))
- || (!(rl->valid & VALID_NM) && !memchr (dr->name, '.',
+ || (!(rl->valid & VALID_NM) && !memchr (dr->name, '.',
dr->namelen)))
st->st_mode = S_IFDIR | 0777;
else
@@ -347,7 +347,7 @@ read_disknode (struct node *np, struct dirrect *dr,
if (rl->valid & VALID_MD)
st->st_mode = rl->allmode;
-
+
if (rl->valid & VALID_AU)
st->st_author = rl->author;
else
@@ -358,13 +358,13 @@ read_disknode (struct node *np, struct dirrect *dr,
if ((rl->valid & VALID_PN)
&& (S_ISCHR (st->st_mode) || S_ISBLK (st->st_mode)))
st->st_rdev = rl->rdev;
- else
+ else
st->st_rdev = 0;
-
+
if (dr->ileave)
/* XXX ??? */
st->st_size = 0;
-
+
/* Calculate these if we'll need them */
if (!(rl->valid & VALID_TF)
|| ((rl->tfflags & (TF_CREATION|TF_ACCESS|TF_MODIFY))
@@ -373,10 +373,10 @@ read_disknode (struct node *np, struct dirrect *dr,
struct timespec ts;
isodate_915 (dr->date, &ts);
st->st_ctime = st->st_mtime = st->st_atime = ts.tv_sec;
- st->st_ctime_usec = st->st_mtime_usec = st->st_atime_usec
+ st->st_ctime_usec = st->st_mtime_usec = st->st_atime_usec
= ts.tv_nsec * 1000;
}
-
+
/* Override what we have better info for */
if (rl->valid & VALID_TF)
{
@@ -385,20 +385,20 @@ read_disknode (struct node *np, struct dirrect *dr,
st->st_ctime = rl->ctime.tv_sec;
st->st_ctime_usec = rl->ctime.tv_nsec * 1000;
}
-
+
if (rl->tfflags & TF_ACCESS)
{
st->st_atime = rl->atime.tv_sec;
st->st_atime_usec = rl->atime.tv_nsec * 1000;
}
-
+
if (rl->tfflags & TF_MODIFY)
{
st->st_mtime = rl->mtime.tv_sec;
st->st_mtime_usec = rl->mtime.tv_nsec * 1000;
}
}
-
+
st->st_blksize = logical_block_size;
st->st_blocks = (st->st_size - 1) / 512 + 1;
@@ -406,7 +406,7 @@ read_disknode (struct node *np, struct dirrect *dr,
st->st_flags = rl->flags;
else
st->st_flags = 0;
-
+
if (S_ISLNK (st->st_mode))
{
if (rl->valid & VALID_SL)
@@ -436,7 +436,7 @@ read_disknode (struct node *np, struct dirrect *dr,
}
diskfs_end_catch_exception ();
-
+
return 0;
}
@@ -447,7 +447,7 @@ read_symlink_hook (struct node *np, char *buf)
bcopy (np->dn->link_target, buf, np->dn_stat.st_size);
return 0;
}
-error_t (*diskfs_read_symlink_hook) (struct node *, char *)
+error_t (*diskfs_read_symlink_hook) (struct node *, char *)
= read_symlink_hook;
@@ -499,7 +499,8 @@ diskfs_grow (struct node *np, off_t end, struct protid *cred)
}
error_t
-diskfs_set_translator (struct node *np, char *name, u_int namelen,
+diskfs_set_translator (struct node *np,
+ const char *name, u_int namelen,
struct protid *cred)
{
return EROFS;
@@ -577,4 +578,3 @@ diskfs_alloc_node (struct node *dp, mode_t mode, struct node **np)
{
return EROFS;
}
-