9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Alexander Viro <viro@math.psu.edu>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] ext2srv ?
Date: Tue, 14 Aug 2001 12:55:37 -0400	[thread overview]
Message-ID: <Pine.GSO.4.21.0108141238120.12316-100000@weyl.math.psu.edu> (raw)
In-Reply-To: <20010814155817.2BEC7199E9@mail.cse.psu.edu>



On Tue, 14 Aug 2001, Russ Cox wrote:

> ext2srv is in /sys/lib/pcdist/cmd.  i'm not convinced
> of its reliability enough to run it in read-write
> mode, but that's just because it's been so long since
> i ran it.  for the distribution, i had to update one
> piece of on-disk data structure, and that scared me.
> specifically, the file name length has apparently
> always been a byte followed by an unused (zero) byte.
> ext2srv was reading the length as a short.  apparently
> the unused byte is now used, but i and ext2srv don't
> know what for.

It's a cached file type (for getdents(2)).

enum {
	S_SHIFT = 12	/* mode bits */
};
static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = {
        [S_IFREG >> S_SHIFT]    EXT2_FT_REG_FILE,
        [S_IFDIR >> S_SHIFT]    EXT2_FT_DIR,
        [S_IFCHR >> S_SHIFT]    EXT2_FT_CHRDEV,
        [S_IFBLK >> S_SHIFT]    EXT2_FT_BLKDEV,
        [S_IFIFO >> S_SHIFT]    EXT2_FT_FIFO,
        [S_IFSOCK >> S_SHIFT]   EXT2_FT_SOCK,
        [S_IFLNK >> S_SHIFT]    EXT2_FT_SYMLINK,
};

and that byte will be ext2_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT]

ext2 superblock has a 32-bit bitmap (->s_feature_incompat). If ->s_rev_level
is 0 or bit 1 in ->s_feature_incompat (little-endian) is not set - leave
that byte zero. Otherwise set it as above.

BTW, you might want to check ext2 in recent tree - it got more readable
than it used to be.



  reply	other threads:[~2001-08-14 16:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-14 15:56 Russ Cox
2001-08-14 16:55 ` Alexander Viro [this message]
2001-08-15 11:27 ` pac
  -- strict thread matches above, loose matches on Subject: below --
2001-08-14 12:06 pac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.21.0108141238120.12316-100000@weyl.math.psu.edu \
    --to=viro@math.psu.edu \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).